Skip to content

Commit dccfb94

Browse files
Alan Chentailingchen
authored andcommitted
consensus/istanbul: remove checkpoints from round state
1 parent 4db0948 commit dccfb94

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

consensus/istanbul/core/roundstate.go

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,24 @@ import (
3131
// we need to keep a reference of preprepare in order to propose locked proposal when there is a lock and itself is the proposer
3232
func newRoundState(view *istanbul.View, validatorSet istanbul.ValidatorSet, lockedHash common.Hash, preprepare *istanbul.Preprepare) *roundState {
3333
return &roundState{
34-
round: view.Round,
35-
sequence: view.Sequence,
36-
Preprepare: preprepare,
37-
Prepares: newMessageSet(validatorSet),
38-
Commits: newMessageSet(validatorSet),
39-
Checkpoints: newMessageSet(validatorSet),
40-
lockedHash: lockedHash,
41-
mu: new(sync.RWMutex),
34+
round: view.Round,
35+
sequence: view.Sequence,
36+
Preprepare: preprepare,
37+
Prepares: newMessageSet(validatorSet),
38+
Commits: newMessageSet(validatorSet),
39+
lockedHash: lockedHash,
40+
mu: new(sync.RWMutex),
4241
}
4342
}
4443

4544
// roundState stores the consensus state
4645
type roundState struct {
47-
round *big.Int
48-
sequence *big.Int
49-
Preprepare *istanbul.Preprepare
50-
Prepares *messageSet
51-
Commits *messageSet
52-
Checkpoints *messageSet
53-
lockedHash common.Hash
46+
round *big.Int
47+
sequence *big.Int
48+
Preprepare *istanbul.Preprepare
49+
Prepares *messageSet
50+
Commits *messageSet
51+
lockedHash common.Hash
5452

5553
mu *sync.RWMutex
5654
}
@@ -153,13 +151,12 @@ func (s *roundState) GetLockedHash() common.Hash {
153151
// be confusing.
154152
func (s *roundState) DecodeRLP(stream *rlp.Stream) error {
155153
var ss struct {
156-
Round *big.Int
157-
Sequence *big.Int
158-
Preprepare *istanbul.Preprepare
159-
Prepares *messageSet
160-
Commits *messageSet
161-
Checkpoints *messageSet
162-
lockedHash common.Hash
154+
Round *big.Int
155+
Sequence *big.Int
156+
Preprepare *istanbul.Preprepare
157+
Prepares *messageSet
158+
Commits *messageSet
159+
lockedHash common.Hash
163160
}
164161

165162
if err := stream.Decode(&ss); err != nil {
@@ -170,7 +167,6 @@ func (s *roundState) DecodeRLP(stream *rlp.Stream) error {
170167
s.Preprepare = ss.Preprepare
171168
s.Prepares = ss.Prepares
172169
s.Commits = ss.Commits
173-
s.Checkpoints = ss.Checkpoints
174170
s.lockedHash = ss.lockedHash
175171
s.mu = new(sync.RWMutex)
176172

@@ -195,7 +191,6 @@ func (s *roundState) EncodeRLP(w io.Writer) error {
195191
s.Preprepare,
196192
s.Prepares,
197193
s.Commits,
198-
s.Checkpoints,
199194
s.lockedHash,
200195
})
201196
}

consensus/istanbul/core/roundstate_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ import (
2727

2828
func newTestRoundState(view *istanbul.View, validatorSet istanbul.ValidatorSet) *roundState {
2929
return &roundState{
30-
round: view.Round,
31-
sequence: view.Sequence,
32-
Preprepare: newTestPreprepare(view),
33-
Prepares: newMessageSet(validatorSet),
34-
Commits: newMessageSet(validatorSet),
35-
Checkpoints: newMessageSet(validatorSet),
36-
mu: new(sync.RWMutex),
30+
round: view.Round,
31+
sequence: view.Sequence,
32+
Preprepare: newTestPreprepare(view),
33+
Prepares: newMessageSet(validatorSet),
34+
Commits: newMessageSet(validatorSet),
35+
mu: new(sync.RWMutex),
3736
}
3837
}
3938

0 commit comments

Comments
 (0)