* fix the bug
* modify soft point height
* modify
PayToWitnessPubKeyHashDataSize = 20
PayToWitnessScriptHashDataSize = 32
PayToWitnessPubKeyHashDataSize = 20
PayToWitnessScriptHashDataSize = 32
+
+ _ = iota
+ SoftFork001
)
// BTMAssetID is BTM's asset id, the soul asset of Bytom
)
// BTMAssetID is BTM's asset id, the soul asset of Bytom
// ProducerSubsidys defines the producer subsidy by block height
ProducerSubsidys []ProducerSubsidy
// ProducerSubsidys defines the producer subsidy by block height
ProducerSubsidys []ProducerSubsidy
+
+ SoftForkPoint map[uint64]uint64
}
// ActiveNetParams is the active NetParams
}
// ActiveNetParams is the active NetParams
ProducerSubsidys: []ProducerSubsidy{
{BeginBlock: 1, EndBlock: 63072000, Subsidy: 9512938},
},
ProducerSubsidys: []ProducerSubsidy{
{BeginBlock: 1, EndBlock: 63072000, Subsidy: 9512938},
},
+ SoftForkPoint: map[uint64]uint64{SoftFork001: 10461600},
}
// TestNetParams is the config for vapor-testnet
}
// TestNetParams is the config for vapor-testnet
ErrGasCalculate = errors.New("gas usage calculate got a math error")
ErrVotePubKey = errors.New("invalid public key of vote")
ErrVoteOutputAmount = errors.New("invalid vote amount")
ErrGasCalculate = errors.New("gas usage calculate got a math error")
ErrVotePubKey = errors.New("invalid public key of vote")
ErrVoteOutputAmount = errors.New("invalid vote amount")
+ ErrVoteOutputAseet = errors.New("incorrect asset_id while checking vote asset")
)
// GasState record the gas usage status
)
// GasState record the gas usage status
if len(e.Vote) != 64 {
return ErrVotePubKey
}
if len(e.Vote) != 64 {
return ErrVotePubKey
}
vs2 := *vs
vs2.sourcePos = 0
if err = checkValidSrc(&vs2, e.Source); err != nil {
vs2 := *vs
vs2.sourcePos = 0
if err = checkValidSrc(&vs2, e.Source); err != nil {
return ErrVoteOutputAmount
}
return ErrVoteOutputAmount
}
+ if *e.Source.Value.AssetId != *consensus.BTMAssetID {
+ return ErrVoteOutputAseet
+ }
+
case *bc.Retirement:
vs2 := *vs
vs2.sourcePos = 0
case *bc.Retirement:
vs2 := *vs
vs2.sourcePos = 0
+func applySoftFork001(vs *validationState, err error) {
+ if err == nil || vs.block.Height < consensus.ActiveNetParams.SoftForkPoint[consensus.SoftFork001] {
+ return
+ }
+
+ if rootErr := errors.Root(err); rootErr == ErrVotePubKey || rootErr == ErrVoteOutputAmount || rootErr == ErrVoteOutputAseet {
+ vs.gasStatus.GasValid = false
+ }
+}
+
// ValidateTx validates a transaction.
func ValidateTx(tx *bc.Tx, block *bc.Block) (*GasState, error) {
gasStatus := &GasState{GasValid: false}
// ValidateTx validates a transaction.
func ValidateTx(tx *bc.Tx, block *bc.Block) (*GasState, error) {
gasStatus := &GasState{GasValid: false}
gasStatus: gasStatus,
cache: make(map[bc.Hash]error),
}
gasStatus: gasStatus,
cache: make(map[bc.Hash]error),
}
- return vs.gasStatus, checkValid(vs, tx.TxHeader)
+
+ err := checkValid(vs, tx.TxHeader)
+ applySoftFork001(vs, err)
+ return vs.gasStatus, err
}
type validateTxWork struct {
}
type validateTxWork struct {
var (
// The full version string
var (
// The full version string
// GitCommit is set with --ldflags "-X main.gitCommit=$(git rev-parse HEAD)"
GitCommit string
Status *UpdateStatus
// GitCommit is set with --ldflags "-X main.gitCommit=$(git rev-parse HEAD)"
GitCommit string
Status *UpdateStatus