Make total_difficulty the sum of network difficulty [testnet2] (#523)
* Make total_difficulty the sum of network difficulty, not whatever the miner happened to mine. - Only for Testnet2 / Mainnet (hardforks Testnet1) - update chain::pipe validate_header to validate according to Testnet2 rules for cumulative difference Fixes #280 * tests that should ignore (network) difficulty * fn new_block is explained as "utility to create a block without worrying about the key or previous header" so it gets network difficulty := 0 too * update tx pool tests (going with "minimum" for network difficulty for now) * add ERR outputs about bannable offences (#406 should know about these) * whitespace fix * mine_simple_chain: Probably DON'T overwrite difficulty (?) * core/mod tests "reward_empty_block" and "reward_with_tx_block" tests set to use lowest network difficulty possible
This commit is contained in:
committed by
Ignotus Peverell
parent
5edc63f617
commit
8b2f9503c9
+10
-2
@@ -20,6 +20,7 @@ pub use graph;
|
||||
use core::core::transaction;
|
||||
use core::core::block;
|
||||
use core::core::hash;
|
||||
use core::core::target::Difficulty;
|
||||
use core::global;
|
||||
|
||||
use util::secp::pedersen::Commitment;
|
||||
@@ -930,6 +931,7 @@ mod tests {
|
||||
txs.iter().collect(),
|
||||
&keychain,
|
||||
&key_id,
|
||||
Difficulty::minimum(),
|
||||
).unwrap();
|
||||
|
||||
// now apply the block to ensure the chainstate is updated before we reconcile
|
||||
@@ -1060,6 +1062,7 @@ mod tests {
|
||||
block_transactions,
|
||||
&keychain,
|
||||
&key_id,
|
||||
Difficulty::minimum(),
|
||||
).unwrap();
|
||||
|
||||
chain_ref.apply_block(&block);
|
||||
@@ -1183,8 +1186,13 @@ mod tests {
|
||||
|
||||
let keychain = Keychain::from_random_seed().unwrap();
|
||||
let key_id = keychain.derive_key_id(1).unwrap();
|
||||
block = block::Block::new(&block::BlockHeader::default(), tx_refs, &keychain, &key_id)
|
||||
.unwrap();
|
||||
block = block::Block::new(
|
||||
&block::BlockHeader::default(),
|
||||
tx_refs,
|
||||
&keychain,
|
||||
&key_id,
|
||||
Difficulty::minimum()
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
chain_ref.apply_block(&block);
|
||||
|
||||
Reference in New Issue
Block a user