Skip to content

Commit 48ca4e5

Browse files
committed
test: reduce test flakiness by ignoring phantom transactions
Multiple tests check for a specific number of transfers in a block, and if a phantom transaction happens to end up in that block, the count will be off and the test will fail.
1 parent 94b55c5 commit 48ca4e5

File tree

1 file changed

+5
-2
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12176,8 +12176,11 @@ fn transfers_in_block(block: &serde_json::Value) -> usize {
1217612176
let raw_tx = tx["raw_tx"].as_str().unwrap();
1217712177
let tx_bytes = hex_bytes(&raw_tx[2..]).unwrap();
1217812178
let parsed = StacksTransaction::consensus_deserialize(&mut &tx_bytes[..]).unwrap();
12179-
if let TransactionPayload::TokenTransfer(..) = &parsed.payload {
12180-
count += 1;
12179+
if let TransactionPayload::TokenTransfer(_, amount, _) = &parsed.payload {
12180+
// Don't count phantom transactions, which have a 0 amount.
12181+
if *amount > 0 {
12182+
count += 1;
12183+
}
1218112184
}
1218212185
}
1218312186
count

0 commit comments

Comments
 (0)