mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-02 22:27:19 +00:00
Merge branch 'master' into wb/abci-process-proposal-synchronize
This commit is contained in:
@@ -1086,6 +1086,8 @@ func (cs *State) handleTxsAvailable(ctx context.Context) {
|
||||
// Enter: +2/3 prevotes any or +2/3 precommits for block or any from (height, round)
|
||||
// NOTE: cs.StartTime was already set for height.
|
||||
func (cs *State) enterNewRound(ctx context.Context, height int64, round int32) {
|
||||
// TODO: remove panics in this function and return an error
|
||||
|
||||
logger := cs.logger.With("height", height, "round", round)
|
||||
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && cs.Step != cstypes.RoundStepNewHeight) {
|
||||
@@ -1106,7 +1108,11 @@ func (cs *State) enterNewRound(ctx context.Context, height int64, round int32) {
|
||||
validators := cs.Validators
|
||||
if cs.Round < round {
|
||||
validators = validators.Copy()
|
||||
validators.IncrementProposerPriority(tmmath.SafeSubInt32(round, cs.Round))
|
||||
r, err := tmmath.SafeSubInt32(round, cs.Round)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
validators.IncrementProposerPriority(r)
|
||||
}
|
||||
|
||||
// Setup new round
|
||||
@@ -1126,7 +1132,12 @@ func (cs *State) enterNewRound(ctx context.Context, height int64, round int32) {
|
||||
cs.ProposalBlockParts = nil
|
||||
}
|
||||
|
||||
cs.Votes.SetRound(tmmath.SafeAddInt32(round, 1)) // also track next round (round+1) to allow round-skipping
|
||||
r, err := tmmath.SafeAddInt32(round, 1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
cs.Votes.SetRound(r) // also track next round (round+1) to allow round-skipping
|
||||
cs.TriggeredTimeoutPrecommit = false
|
||||
|
||||
if err := cs.eventBus.PublishEventNewRound(ctx, cs.NewRoundEvent()); err != nil {
|
||||
|
||||
@@ -85,7 +85,11 @@ func (hvs *HeightVoteSet) Round() int32 {
|
||||
func (hvs *HeightVoteSet) SetRound(round int32) {
|
||||
hvs.mtx.Lock()
|
||||
defer hvs.mtx.Unlock()
|
||||
newRound := tmmath.SafeSubInt32(hvs.round, 1)
|
||||
newRound, err := tmmath.SafeSubInt32(hvs.round, 1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if hvs.round != 0 && (round < newRound) {
|
||||
panic("SetRound() must increment hvs.round")
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func (env *Environment) Subscribe(ctx context.Context, query string) (*coretypes
|
||||
// Capture the current ID, since it can change in the future.
|
||||
subscriptionID := callInfo.RPCRequest.ID
|
||||
go func() {
|
||||
opctx, opcancel := context.WithCancel(context.Background())
|
||||
opctx, opcancel := context.WithCancel(context.TODO())
|
||||
defer opcancel()
|
||||
|
||||
for {
|
||||
|
||||
@@ -504,8 +504,12 @@ func (store dbStore) LoadValidators(height int64) (*types.ValidatorSet, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h, err := tmmath.SafeConvertInt32(height - lastStoredHeight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vs.IncrementProposerPriority(tmmath.SafeConvertInt32(height - lastStoredHeight)) // mutate
|
||||
vs.IncrementProposerPriority(h) // mutate
|
||||
vi2, err := vs.ToProto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user