From 6562b7a4bc0279147d5ef375dda2b65745634410 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 6 Aug 2020 21:14:08 +0200 Subject: [PATCH] Fix some tests Signed-off-by: Jakub Sztandera --- chain/types/message.go | 2 +- node/impl/full/mpool.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/chain/types/message.go b/chain/types/message.go index a2b7c391c..edd003e32 100644 --- a/chain/types/message.go +++ b/chain/types/message.go @@ -141,7 +141,7 @@ func (m *Message) ValidForBlockInclusion(minGas int64) error { return xerrors.New("'Value' field cannot be greater than total filecoin supply") } - if m.GasPrice.LessThan(big.Zero()) { + if m.GasFeeCap.LessThan(big.Zero()) { return xerrors.New("'GasPrice' field cannot be negative") } diff --git a/node/impl/full/mpool.go b/node/impl/full/mpool.go index df4428801..d4400359d 100644 --- a/node/impl/full/mpool.go +++ b/node/impl/full/mpool.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/api" + "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/messagepool" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" @@ -118,6 +119,12 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*t } msg.GasPrice = gasPrice } + if msg.GasPremium == types.EmptyInt || types.BigCmp(msg.GasPremium, types.NewInt(0)) == 0 { + msg.GasPremium = types.NewInt(100) + } + if msg.GasFeeCap == types.EmptyInt || types.BigCmp(msg.GasFeeCap, types.NewInt(0)) == 0 { + msg.GasFeeCap = types.NewInt(10 * build.InitialBaseFee) + } return a.Mpool.PushWithNonce(ctx, msg.From, func(from address.Address, nonce uint64) (*types.SignedMessage, error) { msg.Nonce = nonce