Skip to content

Commit 0a06f68

Browse files
committed
integration_test: Remove best_block_hash help function
This function is wrong because it creates a new node. Remove it.
1 parent 51ede15 commit 0a06f68

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

integration_test/tests/blockchain.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
55
use integration_test::{Node, NodeExt as _};
66

7-
// FIXME: Do we need this?
8-
fn best_block_hash() -> bitcoin::BlockHash {
9-
let node = Node::new_no_wallet();
10-
node.client.best_block_hash().expect("best_block_hash failed")
11-
}
12-
137
#[test]
148
fn get_blockchain_info() {
159
let node = Node::new_no_wallet();
@@ -27,7 +21,7 @@ fn get_best_block_hash() {
2721
#[test]
2822
fn get_block() {
2923
let node = Node::new_no_wallet();
30-
let block_hash = best_block_hash();
24+
let block_hash = node.client.best_block_hash().expect("best_block_hash failed");
3125

3226
let json = node.client.get_block_verbose_zero(block_hash).expect("getblock verbose=0");
3327
assert!(json.into_model().is_ok());
@@ -57,15 +51,15 @@ fn get_block_hash() {
5751
#[test]
5852
fn get_block_header() { // verbose = false
5953
let node = Node::new_no_wallet();
60-
let block_hash = best_block_hash();
54+
let block_hash = node.client.best_block_hash().expect("best_block_hash failed");
6155
let json = node.client.get_block_header(&block_hash).expect("getblockheader");
6256
assert!(json.into_model().is_ok());
6357
}
6458

6559
#[test]
6660
fn get_block_header_verbose() { // verbose = true
6761
let node = Node::new_no_wallet();
68-
let block_hash = best_block_hash();
62+
let block_hash = node.client.best_block_hash().expect("best_block_hash failed");
6963
let json = node.client.get_block_header_verbose(&block_hash).expect("getblockheader");
7064
assert!(json.into_model().is_ok());
7165
}
@@ -92,7 +86,7 @@ fn getblockstats() {
9286
let json = node.client.get_block_stats_by_height(1).expect("getblockstats");
9387
assert!(json.into_model().is_ok());
9488

95-
let block_hash = best_block_hash();
89+
let block_hash = node.client.best_block_hash().expect("best_block_hash failed");
9690
let json = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats");
9791
assert!(json.into_model().is_ok());
9892
}
@@ -105,7 +99,7 @@ fn getblockstats_txindex() {
10599
let json = node.client.get_block_stats_by_height(1).expect("getblockstats");
106100
assert!(json.into_model().is_ok());
107101

108-
let block_hash = best_block_hash();
102+
let block_hash = node.client.best_block_hash().expect("best_block_hash failed");
109103
let json = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats");
110104
assert!(json.into_model().is_ok());
111105
}
@@ -234,7 +228,7 @@ fn get_tx_out_set_info() {
234228
fn precious_block() {
235229
let node = Node::new_with_default_wallet();
236230
node.mine_a_block();
237-
let hash = node.client.best_block_hash().expect("bestblockhash");
231+
let hash = node.client.best_block_hash().expect("best_block_hash failed");
238232
node.mine_a_block();
239233

240234
let _ = node.client.precious_block(hash).expect("preciousblock");

0 commit comments

Comments
 (0)