Merge pull request #2552 from filecoin-project/fix/rbf-error-msg

Improve RBF error message
This commit is contained in:
Łukasz Magiera 2020-07-23 21:21:06 +02:00 committed by GitHub
commit af50e69293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,12 +117,14 @@ func (ms *msgSet) add(m *types.SignedMessage) error {
minPrice := exms.Message.GasPrice minPrice := exms.Message.GasPrice
minPrice = types.BigAdd(minPrice, types.BigDiv(types.BigMul(minPrice, rbfNum), rbfDenom)) minPrice = types.BigAdd(minPrice, types.BigDiv(types.BigMul(minPrice, rbfNum), rbfDenom))
minPrice = types.BigAdd(minPrice, types.NewInt(1)) minPrice = types.BigAdd(minPrice, types.NewInt(1))
if types.BigCmp(m.Message.GasPrice, minPrice) > 0 { if types.BigCmp(m.Message.GasPrice, minPrice) >= 0 {
log.Infow("add with RBF", "oldprice", exms.Message.GasPrice, log.Infow("add with RBF", "oldprice", exms.Message.GasPrice,
"newprice", m.Message.GasPrice, "addr", m.Message.From, "nonce", m.Message.Nonce) "newprice", m.Message.GasPrice, "addr", m.Message.From, "nonce", m.Message.Nonce)
} else { } else {
log.Info("add with duplicate nonce") log.Info("add with duplicate nonce")
return xerrors.Errorf("message to %s with nonce %d already in mpool", m.Message.To, m.Message.Nonce) return xerrors.Errorf("message from %s with nonce %d already in mpool,"+
" increase GasPrice to %s from %s to trigger replace by fee",
m.Message.From, m.Message.Nonce, minPrice, m.Message.GasPrice)
} }
} }
} }