Merge pull request #466 from paritytech/segwit2x_rollback_protection
Added Segwit2x rollback protection
This commit is contained in:
commit
0bf96f1649
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue