From: Matt Corallo Date: Tue, 17 May 2022 23:57:52 +0000 (+0000) Subject: Fix off-by-one in test_onchain_htlc_claim_reorg_remote_commitment X-Git-Tag: v0.0.111~34^2~6 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=e76ac333304c4080f56f7931ec555d3a1f8269af;p=rust-lightning Fix off-by-one in test_onchain_htlc_claim_reorg_remote_commitment The test intended to disconnect a transaction previously connected but didn't disconnect enough blocks to do so, leading to it confirming two conflicting transactions. In the next few commits this will become an assertion failure. --- diff --git a/lightning/src/ln/reorg_tests.rs b/lightning/src/ln/reorg_tests.rs index cbf920f58..e4b916c93 100644 --- a/lightning/src/ln/reorg_tests.rs +++ b/lightning/src/ln/reorg_tests.rs @@ -130,7 +130,8 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) { assert_eq!(nodes[1].node.get_and_clear_pending_events().len(), 0); if claim { - disconnect_blocks(&nodes[1], ANTI_REORG_DELAY - 2); + // Disconnect Node 1's HTLC-Timeout which was connected above + disconnect_blocks(&nodes[1], ANTI_REORG_DELAY - 1); let block = Block { header: BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42 },