diff --git a/cmd/debora/main.go b/cmd/debora/main.go index 51e7360df..de1459979 100644 --- a/cmd/debora/main.go +++ b/cmd/debora/main.go @@ -241,16 +241,15 @@ func cliDownloadFile(c *cli.Context) { wg := sync.WaitGroup{} for i, remote := range Config.Remotes { wg.Add(1) - go func(remote string) { + go func(remote string, localPath string) { defer wg.Done() - localPath := Fmt("%v_%v", localPathPrefix, i) n, err := DownloadFile(Config.PrivKey, remote, command, localPath) if err != nil { fmt.Printf("%v failure. %v\n", remote, err) } else { fmt.Printf("%v success. Wrote %v bytes to %v\n", remote, n, localPath) } - }(remote) + }(remote, Fmt("%v_%v", localPathPrefix, i)) } wg.Wait() } diff --git a/consensus/state.go b/consensus/state.go index 5bf7dfdf9..4994be76e 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1025,10 +1025,18 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote) (added bool, switch vote.Type { case types.VoteTypePrevote: // Prevotes checks for height+round match. - return cs.Prevotes.Add(address, vote) + added, index, err = cs.Prevotes.Add(address, vote) + if added { + log.Debug(Fmt("Added prevote: %v", cs.Prevotes.StringShort())) + } + return case types.VoteTypePrecommit: // Precommits checks for height+round match. - return cs.Precommits.Add(address, vote) + added, index, err = cs.Precommits.Add(address, vote) + if added { + log.Debug(Fmt("Added precommit: %v", cs.Precommits.StringShort())) + } + return case types.VoteTypeCommit: if vote.Height == cs.Height { // No need to check if vote.Round < cs.Round ... @@ -1045,10 +1053,18 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote) (added bool, cs.queueAction(RoundAction{cs.Height, cs.Round, RoundActionTryFinalize}) } } - return added, index, err + if added { + log.Debug(Fmt("Added commit: %v\nprecommits: %v\nprevotes: %v", + cs.Commits.StringShort(), + cs.Precommits.StringShort(), + cs.Prevotes.StringShort())) + } + return } if vote.Height+1 == cs.Height { - return cs.LastCommits.Add(address, vote) + added, index, err = cs.LastCommits.Add(address, vote) + log.Debug(Fmt("Added lastCommits: %v", cs.LastCommits.StringShort())) + return } return false, 0, nil default: diff --git a/consensus/vote_set.go b/consensus/vote_set.go index 973d4b7a1..960e8f070 100644 --- a/consensus/vote_set.go +++ b/consensus/vote_set.go @@ -287,6 +287,6 @@ func (voteSet *VoteSet) StringShort() string { } voteSet.mtx.Lock() defer voteSet.mtx.Unlock() - return fmt.Sprintf(`VoteSet{H:%v R:%v T:%v %v}`, - voteSet.height, voteSet.round, voteSet.type_, voteSet.votesBitArray) + return fmt.Sprintf(`VoteSet{H:%v R:%v T:%v +2/3:%v %v}`, + voteSet.height, voteSet.round, voteSet.type_, voteSet.maj23Exists, voteSet.votesBitArray) }