Skip to content

Commit

Permalink
added block_id test over canonical_tip in test_try_make_response
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeioris committed Nov 19, 2024
1 parent f3301f1 commit 7f3bce1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stackslib/src/net/api/tests/getblockbyheight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fn test_try_make_response() {
let rpc_test = TestRPC::setup_nakamoto(function_name!(), &test_observer);

let nakamoto_chain_tip_height = rpc_test.tip_height.clone();
let canonical_tip = rpc_test.canonical_tip.clone();
let consensus_hash = rpc_test.consensus_hash.clone();

let mut requests = vec![];
Expand Down Expand Up @@ -146,6 +147,7 @@ fn test_try_make_response() {
let resp = response.decode_nakamoto_block().unwrap();

assert_eq!(resp.header.consensus_hash, consensus_hash);
assert_eq!(resp.header.block_id(), canonical_tip);

// no block
let response = responses.remove(0);
Expand All @@ -158,12 +160,14 @@ fn test_try_make_response() {
let resp = response.decode_nakamoto_block().unwrap();

assert_eq!(resp.header.consensus_hash, consensus_hash);
assert_eq!(resp.header.block_id(), canonical_tip);

// got the block from the tip (unconfirmed)
let response = responses.remove(0);
let resp = response.decode_nakamoto_block().unwrap();

assert_eq!(resp.header.consensus_hash, consensus_hash);
assert_eq!(resp.header.block_id(), canonical_tip);

// no block for dummy tip
let response = responses.remove(0);
Expand Down

0 comments on commit 7f3bce1

Please sign in to comment.