Skip to content

Commit c473537

Browse files
committed
fix test_script_list_unspent by not depending on order of returned results
1 parent 1a02524 commit c473537

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/raw_client.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,14 +1113,13 @@ mod test {
11131113
let resp = client.script_list_unspent(&addr.script_pubkey()).unwrap();
11141114

11151115
assert!(resp.len() >= 329);
1116-
assert_eq!(resp[0].value, 7995600000000);
1117-
assert_eq!(resp[0].height, 111194);
1118-
assert_eq!(resp[0].tx_pos, 0);
1119-
assert_eq!(
1120-
resp[0].tx_hash,
1121-
Txid::from_hex("e67a0550848b7932d7796aeea16ab0e48a5cfe81c4e8cca2c5b03e0416850114")
1122-
.unwrap()
1123-
);
1116+
let txid = "e67a0550848b7932d7796aeea16ab0e48a5cfe81c4e8cca2c5b03e0416850114";
1117+
let txid = Txid::from_hex(txid).unwrap();
1118+
let txs: Vec<_> = resp.iter().filter(|e| e.tx_hash == txid).collect();
1119+
assert_eq!(txs.len(), 1);
1120+
assert_eq!(txs[0].value, 7995600000000);
1121+
assert_eq!(txs[0].height, 111194);
1122+
assert_eq!(txs[0].tx_pos, 0);
11241123
}
11251124

11261125
#[test]

0 commit comments

Comments
 (0)