From: Matt Corallo Date: Wed, 17 Mar 2021 03:24:41 +0000 (-0400) Subject: [test] Demonstrate that the next commit is trivially safe X-Git-Tag: v0.0.14~44^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=4266518d8dfc3bfb3caccc375c0ba20ac1a69522;p=rust-lightning [test] Demonstrate that the next 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 3672a1ba..3e91f6d9 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -83,6 +83,12 @@ pub fn confirm_transaction_at<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &T } pub fn connect_blocks<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, depth: u32, height: u32, parent: bool, prev_blockhash: BlockHash) -> BlockHash { + // The next commit drops the height, parent, and prev_blockhash parameters. In order to + // demonstrate that they are currently unused, we assert that they always match the new default + // parameters here. + if parent { assert_eq!(prev_blockhash, node.best_block_hash()); } + assert_eq!(node.best_block_info().1, height); + let mut block = Block { header: BlockHeader { version: 0x2000000, prev_blockhash: if parent { prev_blockhash } else { node.best_block_hash() }, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 }, txdata: vec![],