rename priority variable to protected

This commit is contained in:
vyzo 2020-09-11 21:12:11 +03:00
parent cf9820137c
commit bf1036c78f

View File

@ -50,16 +50,18 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro
pending, _ := mp.getPendingMessages(ts, ts) pending, _ := mp.getPendingMessages(ts, ts)
// priority actors -- not pruned // protected actors -- not pruned
priority := make(map[address.Address]struct{}) protected := make(map[address.Address]struct{})
// we never prune priority addresses
for _, actor := range mp.cfg.PriorityAddrs { for _, actor := range mp.cfg.PriorityAddrs {
priority[actor] = struct{}{} protected[actor] = struct{}{}
} }
// we also never prune locally published messages // we also never prune locally published messages
mp.lk.Lock() mp.lk.Lock()
for actor := range mp.localAddrs { for actor := range mp.localAddrs {
priority[actor] = struct{}{} protected[actor] = struct{}{}
} }
mp.lk.Unlock() mp.lk.Unlock()
@ -69,14 +71,14 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro
var chains []*msgChain var chains []*msgChain
for actor, mset := range pending { for actor, mset := range pending {
// we never prune priority actors // we never prune protected actors
_, keep := priority[actor] _, keep := protected[actor]
if keep { if keep {
keepCount += len(mset) keepCount += len(mset)
continue 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 { for _, m := range mset {
pruneMsgs[m.Message.Cid()] = m pruneMsgs[m.Message.Cid()] = m
} }