From: Matt Corallo Date: Thu, 18 Mar 2021 00:42:59 +0000 (-0400) Subject: [tests] Demonstrate that the commit is trivially safe X-Git-Tag: v0.0.14~44^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=580190f78acf21d5a51f41b7ee77693c67af4865;p=rust-lightning [tests] Demonstrate that the commit is trivially safe See comment in the code, This commit exists only to aid reviewers. --- diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index 03208cfaa..4a96a14b1 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -100,6 +100,7 @@ pub fn connect_blocks<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, depth: u32) -> } pub fn connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: &Block, height: u32) { + assert_eq!(height, node.best_block_info().1 + 1); // height is always equal to the parameter we'll fix it at in the next commit let txdata: Vec<_> = block.txdata.iter().enumerate().collect(); node.chain_monitor.chain_monitor.block_connected(&block.header, &txdata, height); node.node.block_connected(&block.header, &txdata, height); @@ -108,6 +109,7 @@ pub fn connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: &Block, } pub fn disconnect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, header: &BlockHeader, height: u32) { + assert_eq!(height, node.best_block_info().1); // height is always equal to the parameter we'll fix it at in the next commit node.chain_monitor.chain_monitor.block_disconnected(header, height); node.node.block_disconnected(header); node.blocks.borrow_mut().pop();