Return all messages

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2019-11-13 23:41:39 +01:00
parent c7b82dbc40
commit c1ebb72824
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -1,6 +1,7 @@
package chain
import (
"sort"
"sync"
"time"
@ -337,13 +338,17 @@ func (mp *MessagePool) pendingFor(a address.Address) []*types.SignedMessage {
return nil
}
set := make([]*types.SignedMessage, len(mset.msgs))
var i uint64
set := make([]*types.SignedMessage, 0, len(mset.msgs))
for i = mset.nextNonce - 1; mset.msgs[i] != nil; i-- {
set[len(mset.msgs)-int(mset.nextNonce-i)] = mset.msgs[i]
for _, m := range mset.msgs {
set = append(set, m)
}
return set[len(mset.msgs)-int(mset.nextNonce-i-1):]
sort.Slice(set, func(i, j int) bool {
return set[i].Message.Nonce < set[j].Message.Nonce
})
return set
}
func (mp *MessagePool) HeadChange(revert []*types.TipSet, apply []*types.TipSet) error {