Skip to content

Commit

Permalink
Merge pull request #3772 from filecoin-project/fix/prune-protect-local
Browse files Browse the repository at this point in the history
don't prune locally published messages
  • Loading branch information
magik6k authored Sep 11, 2020
2 parents b83463c + b78fe0b commit aa83a4c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions chain/messagepool/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,17 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro

pending, _ := mp.getPendingMessages(ts, ts)

// priority actors -- not pruned
priority := make(map[address.Address]struct{})
// protected actors -- not pruned
protected := make(map[address.Address]struct{})

// we never prune priority addresses
for _, actor := range mp.cfg.PriorityAddrs {
priority[actor] = struct{}{}
protected[actor] = struct{}{}
}

// we also never prune locally published messages
for actor := range mp.localAddrs {
protected[actor] = struct{}{}
}

// Collect all messages to track which ones to remove and create chains for block inclusion
Expand All @@ -62,14 +69,14 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro

var chains []*msgChain
for actor, mset := range pending {
// we never prune priority actors
_, keep := priority[actor]
// we never prune protected actors
_, keep := protected[actor]
if keep {
keepCount += len(mset)
continue
}

// not a priority actor, track the messages and create chains
// not a protected actor, track the messages and create chains
for _, m := range mset {
pruneMsgs[m.Message.Cid()] = m
}
Expand Down

0 comments on commit aa83a4c

Please sign in to comment.