Skip to content

Commit 2e6d279

Browse files
committed
added block_id test over canonical_tip in test_try_make_response
1 parent c0f53ff commit 2e6d279

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stackslib/src/net/api/tests/getblockbyheight.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ fn test_try_make_response() {
9292
let rpc_test = TestRPC::setup_nakamoto(function_name!(), &test_observer);
9393

9494
let nakamoto_chain_tip_height = rpc_test.tip_height.clone();
95+
let canonical_tip = rpc_test.canonical_tip.clone();
9596
let consensus_hash = rpc_test.consensus_hash.clone();
9697

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

148149
assert_eq!(resp.header.consensus_hash, consensus_hash);
150+
assert_eq!(resp.header.block_id(), canonical_tip);
149151

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

160162
assert_eq!(resp.header.consensus_hash, consensus_hash);
163+
assert_eq!(resp.header.block_id(), canonical_tip);
161164

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

166169
assert_eq!(resp.header.consensus_hash, consensus_hash);
170+
assert_eq!(resp.header.block_id(), canonical_tip);
167171

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

0 commit comments

Comments
 (0)