Skip to content

Commit 108edaf

Browse files
committed
tests: test against genesis block from bitcoin crate
1 parent 7c2108c commit 108edaf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

tests/bitcoin.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ static STORAGE: once_cell::sync::Lazy<
77
#[test]
88
fn test_bitcoin_genesis() {
99
let genesis = STORAGE.lock().unwrap().get_block(0).unwrap();
10+
assert_eq!(
11+
genesis,
12+
bitcoin::blockdata::constants::genesis_block(bitcoin::network::constants::Network::Bitcoin)
13+
);
1014

1115
assert_eq!(285, genesis.size());
1216

tests/testnet3.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ static STORAGE: once_cell::sync::Lazy<
66

77
#[test]
88
fn test_blockdata_parsing() {
9+
let genesis = STORAGE.lock().unwrap().get_block(0).unwrap();
910
assert_eq!(
10-
STORAGE
11-
.lock()
12-
.unwrap()
13-
.get_block(0)
14-
.unwrap()
15-
.block_hash()
16-
.to_string(),
11+
genesis,
12+
bitcoin::blockdata::constants::genesis_block(bitcoin::network::constants::Network::Testnet)
13+
);
14+
assert_eq!(
15+
genesis.block_hash().to_string(),
1716
"000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
1817
);
1918
for height in 0..=120 {

0 commit comments

Comments
 (0)