• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revisioncf13a1d9a87cac11edbcaec14c9bd90abfc70667 (tree)
Time2019-06-13 12:17:59
AuthorChengcheng Zhang <943420582@qq.c...>
CommiterChengcheng Zhang

Log Message

update

Change Summary

Incremental Difference

--- a/consensus/general.go
+++ b/consensus/general.go
@@ -23,11 +23,11 @@ const (
2323 VotePendingBlockNumber = uint64(10000)
2424
2525 //DPOS parameter
26- NumOfConsensusNode = 10
27- BlockNumEachNode = 12
28- RoundVoteBlockNums = NumOfConsensusNode * BlockNumEachNode * 10
29- MinVoteNum = 10000000
30- MinVoteOutputAmount = uint64(100000000)
26+ NumOfConsensusNode = 10
27+ BlockNumEachNode = 12
28+ RoundVoteBlockNums = NumOfConsensusNode * BlockNumEachNode * 10
29+ MinConsensusNodeVoteNum = uint64(100000000000000) // min is 1 million BTM
30+ MinVoteOutputAmount = uint64(100000000) // min is 1 BTM
3131
3232 // BlockTimeInterval indicate product one block per 500 milliseconds
3333 BlockTimeInterval = 500
--- a/protocol/state/vote_result.go
+++ b/protocol/state/vote_result.go
@@ -4,8 +4,8 @@ import (
44 "encoding/hex"
55 "sort"
66
7- "github.com/vapor/consensus"
87 "github.com/vapor/config"
8+ "github.com/vapor/consensus"
99 "github.com/vapor/crypto/ed25519/chainkd"
1010 "github.com/vapor/errors"
1111 "github.com/vapor/math/checked"
@@ -96,7 +96,7 @@ func (v *VoteResult) ApplyBlock(block *types.Block) error {
9696 func (v *VoteResult) ConsensusNodes() (map[string]*ConsensusNode, error) {
9797 var nodes []*ConsensusNode
9898 for pubkey, voteNum := range v.NumOfVote {
99- if voteNum >= consensus.MinVoteNum {
99+ if voteNum >= consensus.MinConsensusNodeVoteNum {
100100 var xpub chainkd.XPub
101101 if err := xpub.UnmarshalText([]byte(pubkey)); err != nil {
102102 return nil, err
@@ -113,7 +113,7 @@ func (v *VoteResult) ConsensusNodes() (map[string]*ConsensusNode, error) {
113113 nodes[i].Order = uint64(i)
114114 result[nodes[i].XPub.String()] = nodes[i]
115115 }
116-
116+
117117 if len(result) != 0 {
118118 return result, nil
119119 }
--- a/protocol/validation/tx.go
+++ b/protocol/validation/tx.go
@@ -237,8 +237,8 @@ func checkValid(vs *validationState, e bc.Entry) (err error) {
237237 if err = checkValidSrc(&vs2, e.Source); err != nil {
238238 return errors.Wrap(err, "checking vote output source")
239239 }
240- if err = checkVoteOutputAmount(e.Source); err != nil {
241- return errors.Wrap(err, "checking vote output amount")
240+ if e.Source.Value.Amount < consensus.MinVoteOutputAmount {
241+ return ErrVoteOutputAmount
242242 }
243243
244244 case *bc.Retirement:
@@ -575,10 +575,3 @@ func ValidateTx(tx *bc.Tx, block *bc.Block) (*GasState, error) {
575575 }
576576 return vs.gasStatus, checkValid(vs, tx.TxHeader)
577577 }
578-
579-func checkVoteOutputAmount(vs *bc.ValueSource) error {
580- if vs.Value.Amount < consensus.MinVoteOutputAmount {
581- return ErrVoteOutputAmount
582- }
583- return nil
584-}
Show on old repository browser