File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ func (vt *votesTracker) delete(blockHash common.Hash) {
146
146
147
147
// getMessagesForBlockHash returns all the vote messages
148
148
// for a particular block hash from the tracker as a slice
149
- // of networkVoteMessage.
149
+ // of networkVoteMessage. There is no order in the slice.
150
150
// It returns nil if the block hash does not exist.
151
151
func (vt * votesTracker ) getMessagesForBlockHash (
152
152
blockHash common.Hash ) (messages []networkVoteMessage ) {
Original file line number Diff line number Diff line change @@ -308,6 +308,13 @@ func Test_votesTracker_getMessagesForBlockHash(t *testing.T) {
308
308
vt := testCase .votesTracker
309
309
messages := vt .getMessagesForBlockHash (testCase .blockHash )
310
310
311
+ sort .Slice (messages , func (i , j int ) bool {
312
+ if messages [i ].from == messages [j ].from {
313
+ return messages [i ].msg .Round < messages [j ].msg .Round
314
+ }
315
+ return messages [i ].from < messages [j ].from
316
+ })
317
+
311
318
assert .Equal (t , testCase .messages , messages )
312
319
})
313
320
}
You can’t perform that action at this time.
0 commit comments