Fix some tests

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-08-06 21:14:08 +02:00
parent b384ac6943
commit 6562b7a4bc
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 8 additions and 1 deletions

View File

@ -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")
}

View File

@ -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