params: allow setting Petersburg block before chain head (#21473)

* Allow setting PetersburgBlock before chainhead

if it is at the same block as ConstantinopleBlock

* Add a negative test
This commit is contained in:
Vinod Damle
2020-09-16 02:39:35 -04:00
committed by GitHub
parent cf2a77af28
commit 8696dd39cb
2 changed files with 22 additions and 1 deletions

View File

@ -70,6 +70,23 @@ func TestCheckCompatible(t *testing.T) {
RewindTo: 9,
},
},
{
stored: &ChainConfig{ConstantinopleBlock: big.NewInt(30)},
new: &ChainConfig{ConstantinopleBlock: big.NewInt(30), PetersburgBlock: big.NewInt(30)},
head: 40,
wantErr: nil,
},
{
stored: &ChainConfig{ConstantinopleBlock: big.NewInt(30)},
new: &ChainConfig{ConstantinopleBlock: big.NewInt(30), PetersburgBlock: big.NewInt(31)},
head: 40,
wantErr: &ConfigCompatError{
What: "Petersburg fork block",
StoredConfig: nil,
NewConfig: big.NewInt(31),
RewindTo: 30,
},
},
}
for _, test := range tests {