Skip to content

Commit b2fe441

Browse files
committed
fix: assertion for commit amount in rbf
1 parent 14a4acd commit b2fe441

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

testnet/stacks-node/src/nakamoto_node/relayer.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,9 +1682,11 @@ impl RelayerThread {
16821682

16831683
// update local state
16841684
last_committed.set_txid(&txid);
1685-
self.globals
1686-
.counters
1687-
.bump_naka_submitted_commits(last_committed.burn_tip.block_height, tip_height);
1685+
self.globals.counters.bump_naka_submitted_commits(
1686+
last_committed.burn_tip.block_height,
1687+
tip_height,
1688+
last_committed.block_commit.burn_fee,
1689+
);
16881690
self.last_committed = Some(last_committed);
16891691

16901692
Ok(())

testnet/stacks-node/src/run_loop/neon.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub struct Counters {
117117
pub naka_signer_pushed_blocks: RunLoopCounter,
118118
pub naka_miner_directives: RunLoopCounter,
119119
pub naka_submitted_commit_last_stacks_tip: RunLoopCounter,
120+
pub naka_submitted_commit_last_commit_amount: RunLoopCounter,
120121

121122
pub naka_miner_current_rejections: RunLoopCounter,
122123
pub naka_miner_current_rejections_timeout_secs: RunLoopCounter,
@@ -178,6 +179,7 @@ impl Counters {
178179
&self,
179180
committed_burn_height: u64,
180181
committed_stacks_height: u64,
182+
committed_sats_amount: u64,
181183
) {
182184
Counters::inc(&self.naka_submitted_commits);
183185
Counters::set(
@@ -188,6 +190,10 @@ impl Counters {
188190
&self.naka_submitted_commit_last_stacks_tip,
189191
committed_stacks_height,
190192
);
193+
Counters::set(
194+
&self.naka_submitted_commit_last_commit_amount,
195+
committed_sats_amount,
196+
);
191197
}
192198

193199
pub fn bump_naka_mined_blocks(&self) {

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11355,6 +11355,8 @@ fn rbf_on_config_change() {
1135511355

1135611356
let commits_before = counters.naka_submitted_commits.get();
1135711357

11358+
let commit_amount_before = counters.naka_submitted_commit_last_commit_amount.get();
11359+
1135811360
info!("---- Updating config ----");
1135911361

1136011362
update_config(155000, 57);
@@ -11365,6 +11367,10 @@ fn rbf_on_config_change() {
1136511367
})
1136611368
.expect("Expected new commit after config change");
1136711369

11370+
let commit_amount_after = counters.naka_submitted_commit_last_commit_amount.get();
11371+
assert_eq!(commit_amount_after, 155000);
11372+
assert_ne!(commit_amount_after, commit_amount_before);
11373+
1136811374
coord_channel
1136911375
.lock()
1137011376
.expect("Mutex poisoned")

0 commit comments

Comments
 (0)