Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't prune locally published messages #3772

Merged
merged 3 commits into from
Sep 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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