Skip to content

Commit

Permalink
update miner dynasty logic
Browse files Browse the repository at this point in the history
  • Loading branch information
qywang2012 committed Apr 15, 2019
1 parent 9da6d80 commit 9a6703f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion consensus/dpos/dpos_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (ds *State) NextConsensusState(elapsedSecond int64, worldState state.WorldS
"timestamp": ds.timestamp,
}).Fatal("Type conversion failed, unexpected error.")
}
nextTimestamp := ds.timestamp + BlockIntervalInMs/SecondInMs
nextTimestamp := ds.timestamp + elapsedSecond
dynastyTrie, err := dpos.dynasty.getDynasty(nextTimestamp)
if err != nil {
return nil, err
Expand Down
13 changes: 8 additions & 5 deletions consensus/dpos/dynasty.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,21 @@ func (d *Dynasty) getDynasty(timestamp int64) (*trie.Trie, error) {

if dt == nil {
logging.CLog().WithFields(logrus.Fields{
"genesis": d.genesisTimestamp,
"interval": interval,
"timestamp": timestamp,
"tmpDynasty": tmpDynasty,
"curDynasty": curDynasty,
}).Fatal("Failed to get dynasty with current genesis and dynasty.")
}

//logging.VLog().WithFields(logrus.Fields{
// "timestamp": timestamp,
// "curDynasty": curDynasty,
// "dt": dt,
//}).Debug("dynasty info.")
logging.VLog().WithFields(logrus.Fields{
"interval": interval,
"tmpDynasty": tmpDynasty,
"timestamp": timestamp,
"curDynasty": curDynasty,
"dt": dt,
}).Debug("dynasty info.")

dynastyTrie, err := dt.Clone()
if err != nil {
Expand Down

0 comments on commit 9a6703f

Please sign in to comment.