From ba25592f159fa1891905df5b0aea8b6ca9099270 Mon Sep 17 00:00:00 2001 From: antiochp <30642645+antiochp@users.noreply.github.com> Date: Wed, 23 Jan 2019 10:49:16 +0000 Subject: [PATCH] log loudly if we fail to prepare txs for mining --- servers/src/mining/mine_block.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/servers/src/mining/mine_block.rs b/servers/src/mining/mine_block.rs index 379ac45a9..0e8e7632c 100644 --- a/servers/src/mining/mine_block.rs +++ b/servers/src/mining/mine_block.rs @@ -111,10 +111,14 @@ fn build_block( // If this fails for *any* reason then fallback to an empty vec of txs. // This will allow us to mine an "empty" block if the txpool is in an // invalid (and unexpected) state. - let txs = tx_pool - .read() - .prepare_mineable_transactions() - .unwrap_or(vec![]); + let txs = match tx_pool.read().prepare_mineable_transactions() { + Ok(txs) => txs, + Err(e) => { + error!("build_block: Failed to prepare mineable txs from txpool: {:?}", e); + warn!("build_block: Falling back to mining empty block."); + vec![] + } + }; // build the coinbase and the block itself let fees = txs.iter().map(|tx| tx.fee()).sum();