fix(consensus): restore pre-hf1 miner tx version
This commit is contained in:
parent
0993b081c7
commit
2e92407233
2 changed files with 27 additions and 5 deletions
|
|
@ -67,8 +67,10 @@ func expectedMinerTxVersion(forks []config.HardFork, height uint64) uint64 {
|
|||
return types.VersionPostHF5
|
||||
case config.IsHardForkActive(forks, config.HF4Zarcanum, height):
|
||||
return types.VersionPostHF4
|
||||
default:
|
||||
case config.IsHardForkActive(forks, config.HF1, height):
|
||||
return types.VersionPreHF4
|
||||
default:
|
||||
return types.VersionInitial
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func TestCheckTimestamp_Ugly(t *testing.T) {
|
|||
|
||||
func validMinerTx(height uint64) *types.Transaction {
|
||||
return &types.Transaction{
|
||||
Version: types.VersionPreHF4,
|
||||
Version: types.VersionInitial,
|
||||
Vin: []types.TxInput{types.TxInputGenesis{Height: height}},
|
||||
Vout: []types.TxOutput{
|
||||
types.TxOutputBare{Amount: config.BlockReward, Target: types.TxOutToKey{Key: types.PublicKey{1}}},
|
||||
|
|
@ -134,11 +134,21 @@ func TestValidateMinerTx_Version_Good(t *testing.T) {
|
|||
height uint64
|
||||
}{
|
||||
{
|
||||
name: "mainnet_pre_hf4_v1",
|
||||
name: "mainnet_pre_hf1_v0",
|
||||
forks: config.MainnetForks,
|
||||
height: 100,
|
||||
tx: validMinerTx(100),
|
||||
},
|
||||
{
|
||||
name: "mainnet_post_hf1_pre_hf4_v1",
|
||||
forks: config.MainnetForks,
|
||||
height: 10081,
|
||||
tx: &types.Transaction{
|
||||
Version: types.VersionPreHF4,
|
||||
Vin: []types.TxInput{types.TxInputGenesis{Height: 10081}},
|
||||
Vout: []types.TxOutput{types.TxOutputBare{Amount: config.BlockReward, Target: types.TxOutToKey{Key: types.PublicKey{1}}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "testnet_post_hf4_v2",
|
||||
forks: config.TestnetForks,
|
||||
|
|
@ -178,15 +188,25 @@ func TestValidateMinerTx_Version_Bad(t *testing.T) {
|
|||
tx *types.Transaction
|
||||
}{
|
||||
{
|
||||
name: "mainnet_pre_hf4_v0",
|
||||
name: "mainnet_pre_hf1_v1",
|
||||
forks: config.MainnetForks,
|
||||
height: 100,
|
||||
tx: &types.Transaction{
|
||||
Version: types.VersionInitial,
|
||||
Version: types.VersionPreHF4,
|
||||
Vin: []types.TxInput{types.TxInputGenesis{Height: 100}},
|
||||
Vout: []types.TxOutput{types.TxOutputBare{Amount: config.BlockReward, Target: types.TxOutToKey{Key: types.PublicKey{1}}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "mainnet_post_hf1_pre_hf4_v0",
|
||||
forks: config.MainnetForks,
|
||||
height: 10081,
|
||||
tx: &types.Transaction{
|
||||
Version: types.VersionInitial,
|
||||
Vin: []types.TxInput{types.TxInputGenesis{Height: 10081}},
|
||||
Vout: []types.TxOutput{types.TxOutputBare{Amount: config.BlockReward, Target: types.TxOutToKey{Key: types.PublicKey{1}}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "testnet_post_hf4_v1",
|
||||
forks: config.TestnetForks,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue