Add an extra byte to TX size when calculating Bitcoin TX fees #3358
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After investigating, it seems Bisq will sometimes create Bitcoin transactions with less than 1 sat/byte fee for TX, caused by:
For example:
2080/4 = 520 (good)
2081/4 = 520.25 (bad, gets rounded down to 520)
2082/4 = 520.5 (good, gets rounded up to 521)
2083/4 = 520.75 (good, gets rounded up to 521)
In the case TX is 2081 bytes, 520 sats of fee gets used, for what should be considered a 521 vbyte TX. This results in a net fee of 0.998 sats/vbyte, which won't get relayed through Bitcoin network with the latest Bitcoin Core default settings.
This PR fixes the above issue by adding a workaround to add 1 byte to the TX size when calculating the fee, so it always "rounds up"