Skip to content

Commit 7cdc467

Browse files
authored
Fix getSnapshotProposerSequence (#1796)
Use the correct block number for retrieving the snapshot. This is change is required because the behavior of `snapshot()` in bor consensus had changed. Before, it was expecting the caller to pass the parent block of the target block, but now it is expecting the target block to be directly passed in.
1 parent ce29e45 commit 7cdc467

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

consensus/bor/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (api *API) GetSnapshotProposerSequence(blockNrOrHash *rpc.BlockNumberOrHash
9898
return BlockSigners{}, errUnknownBlock
9999
}
100100

101-
snapNumber := rpc.BlockNumber(header.Number.Int64() - 1)
101+
snapNumber := rpc.BlockNumber(header.Number.Int64())
102102
snap, err := api.GetSnapshot(&snapNumber)
103103

104104
var difficulties = make(map[common.Address]uint64)
@@ -161,7 +161,7 @@ func (api *API) GetSnapshotProposer(blockNrOrHash *rpc.BlockNumberOrHash) (commo
161161
return common.Address{}, errUnknownBlock
162162
}
163163

164-
snapNumber := rpc.BlockNumber(header.Number.Int64() - 1)
164+
snapNumber := rpc.BlockNumber(header.Number.Int64())
165165
snap, err := api.GetSnapshot(&snapNumber)
166166

167167
if err != nil {

0 commit comments

Comments
 (0)