]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix full_stack_target mishandling of block disconnection
authorAntoine Riard <ariard@student.42.fr>
Fri, 17 Jan 2020 19:21:02 +0000 (14:21 -0500)
committerAntoine Riard <ariard@student.42.fr>
Fri, 17 Jan 2020 19:21:02 +0000 (14:21 -0500)
fuzz/src/full_stack.rs

index 7e6135b5c658aeba7ee179af755c4ef80234677f..e6496125ac656ded582209d631ae74db71ba728a 100644 (file)
@@ -196,10 +196,10 @@ impl<'a> MoneyLossDetector<'a> {
 
        fn disconnect_block(&mut self) {
                if self.height > 0 && (self.max_height < 6 || self.height >= self.max_height - 6) {
-                       self.height -= 1;
                        let header = BlockHeader { version: 0x20000000, prev_blockhash: self.header_hashes[self.height], merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
                        self.manager.block_disconnected(&header, self.height as u32);
                        self.monitor.block_disconnected(&header, self.height as u32);
+                       self.height -= 1;
                        let removal_height = self.height;
                        self.txids_confirmed.retain(|_, height| {
                                removal_height != *height