From bcf0e0b4eb2ea55ae7d4af375dea3ca33eb00c34 Mon Sep 17 00:00:00 2001 From: Antioch Peverell <apeverell@protonmail.com> Date: Fri, 28 Feb 2020 12:41:40 +0000 Subject: [PATCH] we need to be lenient when deleting entries from the output_pos index (may be missing) (#3251) --- chain/src/txhashset/txhashset.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chain/src/txhashset/txhashset.rs b/chain/src/txhashset/txhashset.rs index 3cc5facfb..eaf240914 100644 --- a/chain/src/txhashset/txhashset.rs +++ b/chain/src/txhashset/txhashset.rs @@ -1174,8 +1174,19 @@ impl<'a> Extension<'a> { // Remove any entries from the output_pos created by the block being rewound. let block = batch.get_block(&header.hash())?; + let mut missing_count = 0; for out in block.outputs() { - batch.delete_output_pos_height(&out.commitment())?; + if batch.delete_output_pos_height(&out.commitment()).is_err() { + missing_count += 1; + } + } + if missing_count > 0 { + warn!( + "rewind_single_block: {} output_pos entries missing for: {} at {}", + missing_count, + header.hash(), + header.height, + ); } // Update output_pos based on "unspending" all spent pos from this block.