diff --git a/consensus/block.go b/consensus/block.go index 93038f3..5c230b4 100644 --- a/consensus/block.go +++ b/consensus/block.go @@ -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 } } diff --git a/consensus/block_test.go b/consensus/block_test.go index 6a360c0..3655815 100644 --- a/consensus/block_test.go +++ b/consensus/block_test.go @@ -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,