Skip to content

Commit ba194c4

Browse files
committed
crc: code improvements from pr feedback
1 parent bca320c commit ba194c4

File tree

2 files changed

+25
-37
lines changed

2 files changed

+25
-37
lines changed

stackslib/src/net/api/postblock_proposal.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,6 @@ impl NakamotoBlockProposal {
715715

716716
// If a list of replay transactions is set, this transaction must be the next
717717
// mineable transaction from this list.
718-
// if let Some(ref mut replay_txs) = replay_txs_maybe {
719718
loop {
720719
if matches!(
721720
tx.payload,
@@ -822,8 +821,8 @@ impl NakamotoBlockProposal {
822821
let no_replay_txs_remaining = replay_txs.is_empty();
823822

824823
// Now, we need to check if the remaining replay transactions are unmineable.
825-
let only_unmineable_remaining = replay_txs.is_empty()
826-
|| replay_txs.iter().all(|tx| {
824+
let only_unmineable_remaining = !replay_txs.is_empty()
825+
&& replay_txs.iter().all(|tx| {
827826
let tx_result = replay_builder.try_mine_tx_with_len(
828827
&mut replay_tenure_tx,
829828
&tx,

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,7 +3668,6 @@ fn tx_replay_btc_on_stx_invalidation() {
36683668

36693669
info!("------------------------- Beginning test -------------------------");
36703670

3671-
let pre_fork_tenures = 10;
36723671
let burnchain = conf.get_burnchain();
36733672

36743673
let tip = signer_test.get_peer_info();
@@ -3681,31 +3680,31 @@ fn tx_replay_btc_on_stx_invalidation() {
36813680
"pox_info" => ?pox_info,
36823681
);
36833682

3683+
info!("Submitting first pre-stx op");
3684+
let pre_stx_op = PreStxOp {
3685+
output: sender_addr,
3686+
// to be filled in
3687+
txid: Txid([0u8; 32]),
3688+
vtxindex: 0,
3689+
block_height: 0,
3690+
burn_header_hash: BurnchainHeaderHash([0u8; 32]),
3691+
};
3692+
3693+
assert!(
3694+
btc_controller
3695+
.submit_operation(
3696+
StacksEpochId::Epoch30,
3697+
BlockstackOperationType::PreStx(pre_stx_op),
3698+
&mut miner_keychain,
3699+
1
3700+
)
3701+
.is_ok(),
3702+
"Pre-stx operation should submit successfully"
3703+
);
3704+
3705+
let pre_fork_tenures = 9;
36843706
for i in 0..pre_fork_tenures {
36853707
info!("Mining pre-fork tenure {} of {pre_fork_tenures}", i + 1);
3686-
if i == 0 {
3687-
info!("Submitting first pre-stx op");
3688-
let pre_stx_op = PreStxOp {
3689-
output: sender_addr,
3690-
// to be filled in
3691-
txid: Txid([0u8; 32]),
3692-
vtxindex: 0,
3693-
block_height: 0,
3694-
burn_header_hash: BurnchainHeaderHash([0u8; 32]),
3695-
};
3696-
3697-
assert!(
3698-
btc_controller
3699-
.submit_operation(
3700-
StacksEpochId::Epoch30,
3701-
BlockstackOperationType::PreStx(pre_stx_op),
3702-
&mut miner_keychain,
3703-
1
3704-
)
3705-
.is_ok(),
3706-
"Pre-stx operation should submit successfully"
3707-
);
3708-
}
37093708
signer_test.mine_nakamoto_block(Duration::from_secs(30), true);
37103709
}
37113710

@@ -3776,8 +3775,6 @@ fn tx_replay_btc_on_stx_invalidation() {
37763775

37773776
info!("---- Wait for tx replay set to be updated ----");
37783777

3779-
let mut last_log = Instant::now();
3780-
last_log -= Duration::from_secs(5);
37813778
signer_test
37823779
.wait_for_signer_state_check(30, |state| {
37833780
let Some(tx_replay_set) = state.get_tx_replay_set() else {
@@ -3791,14 +3788,6 @@ fn tx_replay_btc_on_stx_invalidation() {
37913788
"len_ok" => len_ok,
37923789
"txid_ok" => txid_ok,
37933790
);
3794-
if last_log.elapsed() > Duration::from_secs(5) {
3795-
info!("---- Signer state check ----";
3796-
"tx_replay_set" => ?tx_replay_set,
3797-
"len_ok" => len_ok,
3798-
"txid_ok" => txid_ok,
3799-
);
3800-
last_log = Instant::now();
3801-
}
38023791
Ok(len_ok && txid_ok)
38033792
})
38043793
.expect("Timed out waiting for tx replay set to be updated");

0 commit comments

Comments
 (0)