[WIP] txpool (tx validation) using block sums for full validation (#1567)

tx validation (txpool) rework/simplify
This commit is contained in:
Antioch Peverell
2018-09-24 09:24:10 +01:00
committed by GitHub
parent 82b785282c
commit e72d8b58e4
22 changed files with 521 additions and 712 deletions
+7 -9
View File
@@ -109,7 +109,12 @@ fn build_block(
let difficulty = consensus::next_difficulty(diff_iter).unwrap();
// extract current transaction from the pool
let txs = tx_pool.read().unwrap().prepare_mineable_transactions();
// TODO - we have a lot of unwrap() going on in this fn...
let txs = tx_pool
.read()
.unwrap()
.prepare_mineable_transactions()
.unwrap();
// build the coinbase and the block itself
let fees = txs.iter().map(|tx| tx.fee()).sum();
@@ -121,14 +126,7 @@ fn build_block(
};
let (output, kernel, block_fees) = get_coinbase(wallet_listener_url, block_fees)?;
let mut b = core::Block::with_reward(
&head,
txs,
output,
kernel,
difficulty.clone(),
verifier_cache.clone(),
)?;
let mut b = core::Block::with_reward(&head, txs, output, kernel, difficulty.clone())?;
// making sure we're not spending time mining a useless block
b.validate(