max block size -> 32_000_000

This commit is contained in:
Svyatoslav Nikolsky 2018-04-12 14:41:11 +03:00
parent 1ebe3375f4
commit aeee2ffdc1
1 changed files with 9 additions and 2 deletions

View File

@ -35,9 +35,12 @@ pub struct ConsensusParams {
pub struct BitcoinCashConsensusParams { pub struct BitcoinCashConsensusParams {
/// Initial BCH hard fork height. /// Initial BCH hard fork height.
pub height: u32, pub height: u32,
/// Time when difficulty adjustment hardfork becomes active. /// Height of difficulty adjustment hardfork.
/// https://reviews.bitcoinabc.org/D601 /// https://reviews.bitcoinabc.org/D601
pub difficulty_adjustion_height: u32, pub difficulty_adjustion_height: u32,
/// Height of monolith (aka May 2018) hardfork.
/// https://github.com/bitcoincashorg/spec/blob/4fbb0face661e293bcfafe1a2a4744dcca62e50d/may-2018-hardfork.md
pub monolith_height: u32,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -154,7 +157,7 @@ impl ConsensusParams {
impl ConsensusFork { impl ConsensusFork {
/// Absolute (across all forks) maximum block size. Currently is 8MB for post-HF BitcoinCash /// Absolute (across all forks) maximum block size. Currently is 8MB for post-HF BitcoinCash
pub fn absolute_maximum_block_size() -> usize { pub fn absolute_maximum_block_size() -> usize {
8_000_000 32_000_000
} }
/// Absolute (across all forks) maximum number of sigops in single block. Currently is max(sigops) for 8MB post-HF BitcoinCash block /// Absolute (across all forks) maximum number of sigops in single block. Currently is max(sigops) for 8MB post-HF BitcoinCash block
@ -190,6 +193,7 @@ impl ConsensusFork {
pub fn max_block_size(&self, height: u32) -> usize { pub fn max_block_size(&self, height: u32) -> usize {
match *self { match *self {
ConsensusFork::BitcoinCash(ref fork) if height >= fork.monolith_height => 32_000_000,
ConsensusFork::BitcoinCash(ref fork) if height >= fork.height => 8_000_000, ConsensusFork::BitcoinCash(ref fork) if height >= fork.height => 8_000_000,
ConsensusFork::NoFork | ConsensusFork::BitcoinCash(_) => 1_000_000, ConsensusFork::NoFork | ConsensusFork::BitcoinCash(_) => 1_000_000,
} }
@ -229,14 +233,17 @@ impl BitcoinCashConsensusParams {
Network::Mainnet | Network::Other(_) => BitcoinCashConsensusParams { Network::Mainnet | Network::Other(_) => BitcoinCashConsensusParams {
height: 478559, height: 478559,
difficulty_adjustion_height: 504031, difficulty_adjustion_height: 504031,
monolith_height: ::std::u32::MAX, // TODO: change me + tests
}, },
Network::Testnet => BitcoinCashConsensusParams { Network::Testnet => BitcoinCashConsensusParams {
height: 1155876, height: 1155876,
difficulty_adjustion_height: 1188697, difficulty_adjustion_height: 1188697,
monolith_height: ::std::u32::MAX, // TODO: change me
}, },
Network::Regtest | Network::Unitest => BitcoinCashConsensusParams { Network::Regtest | Network::Unitest => BitcoinCashConsensusParams {
height: 0, height: 0,
difficulty_adjustion_height: 0, difficulty_adjustion_height: 0,
monolith_height: ::std::u32::MAX, // TODO: change me
}, },
} }
} }