Don't reject messages that don't pass RBF, ignore them
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
5ea9df1824
commit
3710f33e14
@ -56,6 +56,7 @@ var (
|
|||||||
ErrInvalidToAddr = errors.New("message had invalid to address")
|
ErrInvalidToAddr = errors.New("message had invalid to address")
|
||||||
|
|
||||||
ErrBroadcastAnyway = errors.New("broadcasting message despite validation fail")
|
ErrBroadcastAnyway = errors.New("broadcasting message despite validation fail")
|
||||||
|
ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -135,8 +136,9 @@ func (ms *msgSet) add(m *types.SignedMessage, mp *MessagePool) (bool, error) {
|
|||||||
} else {
|
} else {
|
||||||
log.Info("add with duplicate nonce")
|
log.Info("add with duplicate nonce")
|
||||||
return false, xerrors.Errorf("message from %s with nonce %d already in mpool,"+
|
return false, xerrors.Errorf("message from %s with nonce %d already in mpool,"+
|
||||||
" increase GasPremium to %s from %s to trigger replace by fee",
|
" increase GasPremium to %s from %s to trigger replace by fee: %w",
|
||||||
m.Message.From, m.Message.Nonce, minPrice, m.Message.GasPremium)
|
m.Message.From, m.Message.Nonce, minPrice, m.Message.GasPremium,
|
||||||
|
ErrRBFTooLowPremium)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -517,7 +519,7 @@ func (mp *MessagePool) addLocked(m *types.SignedMessage) error {
|
|||||||
incr, err := mset.add(m, mp)
|
incr, err := mset.add(m, mp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info(err)
|
log.Info(err)
|
||||||
return err // TODO(review): this error return was dropped at some point, was it on purpose?
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if incr {
|
if incr {
|
||||||
|
@ -510,7 +510,7 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs
|
|||||||
)
|
)
|
||||||
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
switch {
|
switch {
|
||||||
case xerrors.Is(err, messagepool.ErrBroadcastAnyway):
|
case xerrors.Is(err, messagepool.ErrBroadcastAnyway) || xerrors.Is(err, messagepool.ErrRBFTooLowPremium):
|
||||||
return pubsub.ValidationIgnore
|
return pubsub.ValidationIgnore
|
||||||
default:
|
default:
|
||||||
return pubsub.ValidationReject
|
return pubsub.ValidationReject
|
||||||
|
Loading…
Reference in New Issue
Block a user