stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

Improve RBF behavior in `BitcoinRegtestController`

Open obycode opened this issue 8 months ago • 4 comments

When sending a block commit, a miner needs to be cautious about which Bitcoin block it gets included in. If the miner intends to RBF a block commit targeting block X, but then block X is mined, it should not submit that block commit for block X+1. The logic in bitcoin_regtest_controller.rs should be able to handle this if the necessary information is passed along to the correct functions.

obycode avatar May 09 '25 19:05 obycode

@kantai I think to resolve this, I basically just want to delete this code:

https://github.com/stacks-network/stacks-core/blob/c125757949409beb70614bbe3f4768fe458a9266/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs#L1620-L1629

Does that seem right to you? I don't think that case will ever be good for the miner.

obycode avatar May 20 '25 19:05 obycode

It's going to be difficult to test 😰.

obycode avatar May 20 '25 19:05 obycode

Also this I think:

diff --git a/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs b/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs
index 5cab6be2ad..2447152293 100644
--- a/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs
+++ b/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs
@@ -1539,6 +1539,12 @@ impl BitcoinRegtestController {
                     Ok(true)
                 );
             if ongoing_tx_confirmed {
+                if ongoing_op.payload == payload {
+                    info!("Abort attempt to re-submit confirmed LeaderBlockCommit");
+                    self.ongoing_block_commit = Some(ongoing_op);
+                    return Err(BurnchainControllerError::IdenticalOperation);
+                }
+
                 debug!("Was able to retrieve confirmation of ongoing burnchain TXID - {txid}");
                 let res = self.send_block_commit_operation(
                     epoch_id,

obycode avatar May 20 '25 20:05 obycode

PR #6157

obycode avatar Jun 04 '25 14:06 obycode

This was resolved in #6219.

obycode avatar Sep 11 '25 16:09 obycode

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 19 '25 00:09 github-actions[bot]