]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix off-by-one in test_onchain_htlc_claim_reorg_remote_commitment
authorMatt Corallo <git@bluematt.me>
Tue, 17 May 2022 23:57:52 +0000 (23:57 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 15 Aug 2022 23:18:12 +0000 (23:18 +0000)
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.

lightning/src/ln/reorg_tests.rs

index cbf920f587db38187dc07a79c3be942c5226fdb0..e4b916c9345d59c7aecd92ab536541a042534ad3 100644 (file)
@@ -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 },