[tests] Demonstrate that the commit is trivially safe
authorMatt Corallo <git@bluematt.me>
Thu, 18 Mar 2021 00:42:59 +0000 (20:42 -0400)
committerMatt Corallo <git@bluematt.me>
Sat, 20 Mar 2021 03:32:38 +0000 (23:32 -0400)
See comment in the code, This commit exists only to aid reviewers.

lightning/src/ln/functional_test_utils.rs

index 03208cfaa6989502a9ad20e51a78aa01b351296f..4a96a14b18c0755060a9a9a7295cbe4797dca30f 100644 (file)
@@ -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();