Skip to content

Commit d3a047e

Browse files
committed
Add '()' annotation and error handling to submit_header
1 parent cd12639 commit d3a047e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

integration_test/tests/mining.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,12 @@ fn mining__submit_header() {
221221
let best_block = node.client.get_best_block_hash().expect("getbestblockhash").into_model().unwrap().0;
222222
let mut header = node.client.get_block_header(&best_block).expect("getblockheader").into_model().unwrap().0;
223223

224-
// Change the nonce to ensure the header is different from the current tip.
225-
header.nonce = header.nonce.wrapping_add(1);
224+
for _ in 1..=u32::MAX {
225+
header.nonce = header.nonce.wrapping_add(1);
226+
if header.validate_pow(header.target()).is_ok() {
227+
break;
228+
}
229+
}
226230

227-
let _ = node.client.submit_header(&header);
231+
let _: () = node.client.submit_header(&header).expect("submitheader");
228232
}

0 commit comments

Comments
 (0)