VotePendingBlockNumber = uint64(10000)
//DPOS parameter
- NumOfConsensusNode = 10
- BlockNumEachNode = 12
- RoundVoteBlockNums = NumOfConsensusNode * BlockNumEachNode * 10
- MinVoteNum = 10000000
+ NumOfConsensusNode = 10
+ BlockNumEachNode = 12
+ RoundVoteBlockNums = NumOfConsensusNode * BlockNumEachNode * 10
+ MinConsensusNodeVoteNum = uint64(100000000000000) // min is 1 million BTM
+ MinVoteOutputAmount = uint64(100000000) // min is 1 BTM
// BlockTimeInterval indicate product one block per 500 milliseconds
BlockTimeInterval = 500
"encoding/hex"
"sort"
- "github.com/vapor/consensus"
"github.com/vapor/config"
+ "github.com/vapor/consensus"
"github.com/vapor/crypto/ed25519/chainkd"
"github.com/vapor/errors"
"github.com/vapor/math/checked"
func (v *VoteResult) ConsensusNodes() (map[string]*ConsensusNode, error) {
var nodes []*ConsensusNode
for pubkey, voteNum := range v.NumOfVote {
- if voteNum >= consensus.MinVoteNum {
+ if voteNum >= consensus.MinConsensusNodeVoteNum {
var xpub chainkd.XPub
if err := xpub.UnmarshalText([]byte(pubkey)); err != nil {
return nil, err
nodes[i].Order = uint64(i)
result[nodes[i].XPub.String()] = nodes[i]
}
-
+
if len(result) != 0 {
return result, nil
}
ErrOverGasCredit = errors.New("all gas credit has been spend")
ErrGasCalculate = errors.New("gas usage calculate got a math error")
ErrVotePubKey = errors.New("invalid public key of vote")
+ ErrVoteOutputAmount = errors.New("invalid vote amount")
)
// GasState record the gas usage status
if err = checkValidSrc(&vs2, e.Source); err != nil {
return errors.Wrap(err, "checking vote output source")
}
+ if e.Source.Value.Amount < consensus.MinVoteOutputAmount {
+ return ErrVoteOutputAmount
+ }
case *bc.Retirement:
vs2 := *vs