Skip to content

Commit f538eab

Browse files
committed
test: improve tests
1 parent 41491db commit f538eab

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,9 +3101,7 @@ mod tests {
31013101
assert_eq!(5000000000, utxo.amount);
31023102
}
31033103

3104-
31053104
#[test]
3106-
//NOTE: STALL if burn block at block_height doesn't exist....
31073105
fn test_get_utxos_fails_due_to_filtering() {
31083106
let miner_seed = vec![1, 1, 1, 1];
31093107
let keychain = Keychain::default(miner_seed.clone());
@@ -3124,20 +3122,49 @@ mod tests {
31243122
btc_controller.bootstrap_chain(101);
31253123

31263124
let too_much_required = 1000000000000000000_u64;
3127-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, too_much_required, None, 0);
3125+
let utxos = btc_controller.get_utxos(
3126+
StacksEpochId::Epoch31,
3127+
&miner_pubkey,
3128+
0,
3129+
None,
3130+
0,
3131+
);
31283132
assert!(utxos.is_none(), "None because too much required");
31293133

3130-
let other_pubkey = Secp256k1PublicKey::from_hex("01010101010101100101010101").unwrap();
3131-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &other_pubkey, too_much_required, None, 0);
3132-
assert!(utxos.is_none(), "None because utxos for other pubkey don't exist");
3134+
let other_pubkey = Secp256k1PublicKey::from_hex("04ee0b1602eb18fef7986887a7e8769a30c9df981d33c8380d255edef003abdcd243a0eb74afdf6740e6c423e62aec631519a24cf5b1d62bf8a3e06ddc695dcb77").unwrap();
3135+
let utxos = btc_controller.get_utxos(
3136+
StacksEpochId::Epoch31,
3137+
&other_pubkey,
3138+
too_much_required,
3139+
None,
3140+
0,
3141+
);
3142+
assert!(
3143+
utxos.is_none(),
3144+
"None because utxos for other pubkey don't exist"
3145+
);
3146+
3147+
let existent_utxo = btc_controller
3148+
.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, None, 0)
3149+
.expect("utxo set should exist");
3150+
let utxos = btc_controller.get_utxos(
3151+
StacksEpochId::Epoch31,
3152+
&miner_pubkey,
3153+
0,
3154+
Some(existent_utxo),
3155+
0,
3156+
);
3157+
assert!(
3158+
utxos.is_none(),
3159+
"None because filtering exclude existent utxo set"
3160+
);
31333161

3162+
//NOTE: Operation stall if burn block at block_height doesn't exist
3163+
/*
31343164
let future_block_height = 1000;
3135-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, too_much_required, None, future_block_height);
3165+
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, None, future_block_height);
31363166
assert!(utxos.is_none(), "None because utxos for future block height don't exist");
3137-
3138-
let existent_utxo = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, None, 0).expect("utxo set should exist");
3139-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, Some(existent_utxo), 0);
3140-
assert!(utxos.is_none(), "None because utxos filtering out existent utxo set");
3167+
*/
31413168
}
31423169

31433170
#[test]

0 commit comments

Comments
 (0)