diff --git a/servers/src/common/types.rs b/servers/src/common/types.rs index 79d2c583..fe4a6e93 100644 --- a/servers/src/common/types.rs +++ b/servers/src/common/types.rs @@ -44,6 +44,8 @@ pub enum Error { Wallet(wallet::Error), /// Error originating from the cuckoo miner Cuckoo(pow::Error), + /// Error originating from the transaction pool. + Pool(pool::PoolError), } impl From for Error { @@ -87,6 +89,12 @@ impl From for Error { } } +impl From for Error { + fn from(e: pool::PoolError) -> Error { + Error::Pool(e) + } +} + /// Type of seeding the server will use to find other peers on the network. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum ChainValidationMode { diff --git a/servers/src/mining/mine_block.rs b/servers/src/mining/mine_block.rs index aa89cdc4..d61f7108 100644 --- a/servers/src/mining/mine_block.rs +++ b/servers/src/mining/mine_block.rs @@ -108,8 +108,7 @@ fn build_block( let difficulty = consensus::next_difficulty(head.height + 1, chain.difficulty_iter()); // extract current transaction from the pool - // TODO - we have a lot of unwrap() going on in this fn... - let txs = tx_pool.read().prepare_mineable_transactions().unwrap(); + let txs = tx_pool.read().prepare_mineable_transactions()?; // build the coinbase and the block itself let fees = txs.iter().map(|tx| tx.fee()).sum();