From 580190f78acf21d5a51f41b7ee77693c67af4865 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 17 Mar 2021 20:42:59 -0400 Subject: [PATCH] [tests] Demonstrate that the commit is trivially safe See comment in the code, This commit exists only to aid reviewers. --- lightning/src/ln/functional_test_utils.rs | 2 ++ 1 file changed, 2 insertions(+) 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(); -- 2.39.5