This commit is contained in:
Yeastplume 2019-04-16 11:24:53 +01:00
parent 12fe928112
commit 2f38ae1caf
No known key found for this signature in database
GPG key ID: AE6E005DF6E76B95
5 changed files with 142 additions and 139 deletions

View file

@ -146,7 +146,8 @@ fn test_coinbase_maturity() {
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter().unwrap()); let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter().unwrap());
let reward = libtx::reward::output(&keychain, &key_id1, 0, false).unwrap(); let reward = libtx::reward::output(&keychain, &key_id1, 0, false).unwrap();
let mut block = core::core::Block::new(&prev, vec![], Difficulty::min(), reward).unwrap(); let mut block =
core::core::Block::new(&prev, vec![], Difficulty::min(), reward).unwrap();
block.header.timestamp = prev.timestamp + Duration::seconds(60); block.header.timestamp = prev.timestamp + Duration::seconds(60);
block.header.pow.secondary_scaling = next_header_info.secondary_scaling; block.header.pow.secondary_scaling = next_header_info.secondary_scaling;
@ -227,7 +228,8 @@ fn test_coinbase_maturity() {
let reward = libtx::reward::output(&keychain, &pk, 0, false).unwrap(); let reward = libtx::reward::output(&keychain, &pk, 0, false).unwrap();
let mut block = let mut block =
core::core::Block::new(&prev, vec![], Difficulty::min(), reward).unwrap(); core::core::Block::new(&prev, vec![], Difficulty::min(), reward).unwrap();
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter().unwrap()); let next_header_info =
consensus::next_difficulty(1, chain.difficulty_iter().unwrap());
block.header.timestamp = prev.timestamp + Duration::seconds(60); block.header.timestamp = prev.timestamp + Duration::seconds(60);
block.header.pow.secondary_scaling = next_header_info.secondary_scaling; block.header.pow.secondary_scaling = next_header_info.secondary_scaling;

View file

@ -42,7 +42,8 @@ fn test_transaction_pool_block_building() {
// Initialize the chain/txhashset with an initial block // Initialize the chain/txhashset with an initial block
// so we have a non-empty UTXO set. // so we have a non-empty UTXO set.
let add_block = |prev_header: BlockHeader, txs: Vec<Transaction>, chain: &mut ChainAdapter| { let add_block =
|prev_header: BlockHeader, txs: Vec<Transaction>, chain: &mut ChainAdapter| {
let height = prev_header.height + 1; let height = prev_header.height + 1;
let key_id = ExtKeychain::derive_key_id(1, height as u32, 0, 0, 0); let key_id = ExtKeychain::derive_key_id(1, height as u32, 0, 0, 0);
let fee = txs.iter().map(|x| x.fee()).sum(); let fee = txs.iter().map(|x| x.fee()).sum();

View file

@ -46,7 +46,8 @@ fn test_block_building_max_weight() {
let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new())); let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new()));
// Convenient was to add a new block to the chain. // Convenient was to add a new block to the chain.
let add_block = |prev_header: BlockHeader, txs: Vec<Transaction>, chain: &mut ChainAdapter| { let add_block =
|prev_header: BlockHeader, txs: Vec<Transaction>, chain: &mut ChainAdapter| {
let height = prev_header.height + 1; let height = prev_header.height + 1;
let key_id = ExtKeychain::derive_key_id(1, height as u32, 0, 0, 0); let key_id = ExtKeychain::derive_key_id(1, height as u32, 0, 0, 0);
let fee = txs.iter().map(|x| x.fee()).sum(); let fee = txs.iter().map(|x| x.fee()).sum();
@ -67,7 +68,8 @@ fn test_block_building_max_weight() {
// Now create tx to spend that first coinbase (now matured). // Now create tx to spend that first coinbase (now matured).
// Provides us with some useful outputs to test with. // Provides us with some useful outputs to test with.
let initial_tx = test_transaction_spending_coinbase(&keychain, &header, vec![100, 200, 300]); let initial_tx =
test_transaction_spending_coinbase(&keychain, &header, vec![100, 200, 300]);
// Mine that initial tx so we can spend it with multiple txs // Mine that initial tx so we can spend it with multiple txs
let block = add_block(header, vec![initial_tx], &mut chain); let block = add_block(header, vec![initial_tx], &mut chain);

View file

@ -177,7 +177,6 @@ fn test_transaction_pool_block_reconciliation() {
// And reconcile the pool with this latest block. // And reconcile the pool with this latest block.
{ {
let mut write_pool = pool.write(); let mut write_pool = pool.write();
write_pool.reconcile_block(&block).unwrap(); write_pool.reconcile_block(&block).unwrap();

View file

@ -331,8 +331,7 @@ impl<T: PMMRable> PMMRBackend<T> {
pos as u64 - shift pos as u64 - shift
}); });
self.hash_file self.hash_file.save_prune(&pos_to_rm)?;
.save_prune(&pos_to_rm)?;
} }
// 2. Save compact copy of the data file, skipping removed leaves. // 2. Save compact copy of the data file, skipping removed leaves.