-
Notifications
You must be signed in to change notification settings - Fork 698
fix rbf calculation - fixes #2010 #2011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -664,7 +664,7 @@ impl BitcoinRegtestController { | |||
|
|||
// RBF | |||
let tx_fee = self.config.burnchain.burnchain_op_tx_fee | |||
+ (attempt * self.last_tx_len * self.min_relay_fee); | |||
+ ((attempt - 1) * self.last_tx_len * self.min_relay_fee / 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For good measure, can you change attempt - 1
to attempt.saturating_sub(1)
so it doesn't ever underflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can you group the numerator explicitly? I.e. ((attempt.saturating_sub(1) * self.last_tx_len * self.min_relay_fee) / 1024);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea. addressed in 00d7880
Thanks for catching this @psq! Are you able to mine blocks on the testnet with these settings? Once my comment is addressed this will LGTM. |
yes, the miner is mining, but I'm no sure it is the second transaction is the one accepted when there is a second attempt based on how the UTXO seem to get updated, so I'll dig deeper tomorrow. |
seems to work fine, I changed the code to send 2 sats more per new attempt, and the replaced transaction is the one that gets committed, not the original one. So all good.
you can see 11_001 per address instead of 11_000, and the first transaction is not found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @psq!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #2010. Current calculation overpays by a factor of 2048 (should use
attempt-1
as multiplier, and fee is per kb, not per byte