Skip to content

Commit

Permalink
fix bug: messages from the same wallet cannot be scattered in multipl…
Browse files Browse the repository at this point in the history
…e blocks in a cycle (#4428)

Co-authored-by: 一页素书 <[email protected]>
  • Loading branch information
diwufeiwen and ta0li authored May 6, 2021
1 parent 9ada7f3 commit d323003
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/messagepool/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,10 @@ func (mp *MessagePool) SelectMessages(ts *types.TipSet, tq float64) (msgs []*typ
}

func deleteSelectedMessages(pending map[address.Address]map[uint64]*types.SignedMessage, msgs []*types.SignedMessage) map[address.Address]map[uint64]*types.SignedMessage {
// messages from the same wallet cannot be scattered in multiple blocks in a cycle, eg b1{nonce: 20~30}, b2{nonce: 31~40}
for _, msg := range msgs {
if mset, ok := pending[msg.Message.From]; ok {
if _, ok := mset[msg.Message.Nonce]; ok {
delete(mset, msg.Message.Nonce)
if len(mset) <= 0 {
delete(pending, msg.Message.From)
}
}
if _, ok := pending[msg.Message.From]; ok {
delete(pending, msg.Message.From)
}
}

Expand Down

0 comments on commit d323003

Please sign in to comment.