mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Remove unwrap() and add tx. pool error member to Error enum (#1839)
This commit is contained in:
parent
711fad6c24
commit
58e68a867e
2 changed files with 9 additions and 2 deletions
|
@ -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<core::block::Error> for Error {
|
||||
|
@ -87,6 +89,12 @@ impl From<wallet::Error> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<pool::PoolError> 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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue