libitx / txforge

Modern Bitcoin transaction builder, capable of supporting any non-standard and custom script type.
Apache License 2.0
61 stars 21 forks source link

Review fee calculation logic #5

Closed libitx closed 3 years ago

libitx commented 3 years ago

Reports that sometimes the fee gets calculated at 0.499 s/b. Review the fee calculation logic. Possibly the feeEstimate function is just wrong. Possibly the p2pkh input size is wrong (check sig size).

sirdeggen commented 3 years ago

If others make the same mistake I did, then it's just a float rounding error, fixed by adding

return Math.ceil(size)

To the end of your size function in the locking and unlocking script of custom Casts.

Cheers,