refactor getBaseFeeLowerBound, use it to prune less aggressively
This commit is contained in:
parent
232cc320bd
commit
3dfb3e641b
@ -399,7 +399,7 @@ func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.T
|
|||||||
publish := local
|
publish := local
|
||||||
if strictBaseFeeValidation && len(curTs.Blocks()) > 0 {
|
if strictBaseFeeValidation && len(curTs.Blocks()) > 0 {
|
||||||
baseFee := curTs.Blocks()[0].ParentBaseFee
|
baseFee := curTs.Blocks()[0].ParentBaseFee
|
||||||
baseFeeLowerBound := types.BigDiv(baseFee, baseFeeLowerBoundFactor)
|
baseFeeLowerBound := getBaseFeeLowerBound(baseFee)
|
||||||
if m.Message.GasFeeCap.LessThan(baseFeeLowerBound) {
|
if m.Message.GasFeeCap.LessThan(baseFeeLowerBound) {
|
||||||
if local {
|
if local {
|
||||||
log.Warnf("local message will not be immediately published because GasFeeCap doesn't meet the lower bound for inclusion in the next 20 blocks (GasFeeCap: %s, baseFeeLowerBound: %s)",
|
log.Warnf("local message will not be immediately published because GasFeeCap doesn't meet the lower bound for inclusion in the next 20 blocks (GasFeeCap: %s, baseFeeLowerBound: %s)",
|
||||||
@ -1282,3 +1282,12 @@ func (mp *MessagePool) Clear(local bool) {
|
|||||||
delete(mp.pending, a)
|
delete(mp.pending, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getBaseFeeLowerBound(baseFee types.BigInt) types.BigInt {
|
||||||
|
baseFeeLowerBound := types.BigDiv(baseFee, baseFeeLowerBoundFactor)
|
||||||
|
if baseFeeLowerBound.LessThan(minimumBaseFee) {
|
||||||
|
baseFeeLowerBound = minimumBaseFee
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseFeeLowerBound
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("computing basefee: %w", err)
|
return xerrors.Errorf("computing basefee: %w", err)
|
||||||
}
|
}
|
||||||
|
baseFeeLowerBound := getBaseFeeLowerBound(baseFee)
|
||||||
|
|
||||||
pending, _ := mp.getPendingMessages(ts, ts)
|
pending, _ := mp.getPendingMessages(ts, ts)
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro
|
|||||||
for _, m := range mset {
|
for _, m := range mset {
|
||||||
pruneMsgs[m.Message.Cid()] = m
|
pruneMsgs[m.Message.Cid()] = m
|
||||||
}
|
}
|
||||||
actorChains := mp.createMessageChains(actor, mset, baseFee, ts)
|
actorChains := mp.createMessageChains(actor, mset, baseFeeLowerBound, ts)
|
||||||
chains = append(chains, actorChains...)
|
chains = append(chains, actorChains...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,7 @@ func (mp *MessagePool) republishPendingMessages() error {
|
|||||||
mp.curTsLk.Unlock()
|
mp.curTsLk.Unlock()
|
||||||
return xerrors.Errorf("computing basefee: %w", err)
|
return xerrors.Errorf("computing basefee: %w", err)
|
||||||
}
|
}
|
||||||
|
baseFeeLowerBound := getBaseFeeLowerBound(baseFee)
|
||||||
baseFeeLowerBound := types.BigDiv(baseFee, baseFeeLowerBoundFactor)
|
|
||||||
if baseFeeLowerBoundFactor.LessThan(minimumBaseFee) {
|
|
||||||
baseFeeLowerBound = minimumBaseFee
|
|
||||||
}
|
|
||||||
|
|
||||||
pending := make(map[address.Address]map[uint64]*types.SignedMessage)
|
pending := make(map[address.Address]map[uint64]*types.SignedMessage)
|
||||||
mp.lk.Lock()
|
mp.lk.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user