Merge pull request #466 from paritytech/segwit2x_rollback_protection

Added Segwit2x rollback protection
This commit is contained in:
Svyatoslav Nikolsky 2017-11-06 12:48:39 +03:00 committed by GitHub
commit 0bf96f1649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -179,7 +179,7 @@ impl ConsensusFork {
pub fn min_block_size(&self, height: u32) -> usize {
match *self {
// size of first fork block must be larger than 1MB
ConsensusFork::BitcoinCash(fork_height) if height == fork_height => 1_000_001,
ConsensusFork::BitcoinCash(fork_height) | ConsensusFork::SegWit2x(fork_height) if height == fork_height => 1_000_001,
ConsensusFork::NoFork | ConsensusFork::BitcoinCash(_) | ConsensusFork::SegWit2x(_) => 0,
}
}
@ -270,7 +270,7 @@ mod tests {
fn test_consensus_fork_min_block_size() {
assert_eq!(ConsensusFork::NoFork.min_block_size(0), 0);
assert_eq!(ConsensusFork::SegWit2x(100).min_block_size(0), 0);
assert_eq!(ConsensusFork::SegWit2x(100).min_block_size(100), 0);
assert_eq!(ConsensusFork::SegWit2x(100).min_block_size(100), 1_000_001);
assert_eq!(ConsensusFork::BitcoinCash(100).min_block_size(0), 0);
assert_eq!(ConsensusFork::BitcoinCash(100).min_block_size(100), 1_000_001);
}