Skip to content

Commit 24f60d8

Browse files
committed
test: improve tests
1 parent 0a58e58 commit 24f60d8

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
@@ -3090,9 +3090,7 @@ mod tests {
30903090
assert_eq!(5000000000, utxo.amount);
30913091
}
30923092

3093-
30943093
#[test]
3095-
//NOTE: STALL if burn block at block_height doesn't exist....
30963094
fn test_get_utxos_fails_due_to_filtering() {
30973095
let miner_seed = vec![1, 1, 1, 1];
30983096
let keychain = Keychain::default(miner_seed.clone());
@@ -3113,20 +3111,49 @@ mod tests {
31133111
btc_controller.bootstrap_chain(101);
31143112

31153113
let too_much_required = 1000000000000000000_u64;
3116-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, too_much_required, None, 0);
3114+
let utxos = btc_controller.get_utxos(
3115+
StacksEpochId::Epoch31,
3116+
&miner_pubkey,
3117+
0,
3118+
None,
3119+
0,
3120+
);
31173121
assert!(utxos.is_none(), "None because too much required");
31183122

3119-
let other_pubkey = Secp256k1PublicKey::from_hex("01010101010101100101010101").unwrap();
3120-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &other_pubkey, too_much_required, None, 0);
3121-
assert!(utxos.is_none(), "None because utxos for other pubkey don't exist");
3123+
let other_pubkey = Secp256k1PublicKey::from_hex("04ee0b1602eb18fef7986887a7e8769a30c9df981d33c8380d255edef003abdcd243a0eb74afdf6740e6c423e62aec631519a24cf5b1d62bf8a3e06ddc695dcb77").unwrap();
3124+
let utxos = btc_controller.get_utxos(
3125+
StacksEpochId::Epoch31,
3126+
&other_pubkey,
3127+
too_much_required,
3128+
None,
3129+
0,
3130+
);
3131+
assert!(
3132+
utxos.is_none(),
3133+
"None because utxos for other pubkey don't exist"
3134+
);
3135+
3136+
let existent_utxo = btc_controller
3137+
.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, None, 0)
3138+
.expect("utxo set should exist");
3139+
let utxos = btc_controller.get_utxos(
3140+
StacksEpochId::Epoch31,
3141+
&miner_pubkey,
3142+
0,
3143+
Some(existent_utxo),
3144+
0,
3145+
);
3146+
assert!(
3147+
utxos.is_none(),
3148+
"None because filtering exclude existent utxo set"
3149+
);
31223150

3151+
//NOTE: Operation stall if burn block at block_height doesn't exist
3152+
/*
31233153
let future_block_height = 1000;
3124-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, too_much_required, None, future_block_height);
3154+
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, None, future_block_height);
31253155
assert!(utxos.is_none(), "None because utxos for future block height don't exist");
3126-
3127-
let existent_utxo = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, None, 0).expect("utxo set should exist");
3128-
let utxos = btc_controller.get_utxos(StacksEpochId::Epoch31, &miner_pubkey, 0, Some(existent_utxo), 0);
3129-
assert!(utxos.is_none(), "None because utxos filtering out existent utxo set");
3156+
*/
31303157
}
31313158

31323159
#[test]

0 commit comments

Comments
 (0)