From 2adb80729b16d06a9bf4f5912b3c0a7650a60838 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 5 Sep 2020 15:17:55 +0200 Subject: [PATCH] Add additional info about gas premium Signed-off-by: Jakub Sztandera --- node/impl/full/mpool.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node/impl/full/mpool.go b/node/impl/full/mpool.go index bfb7439bb..6acb17990 100644 --- a/node/impl/full/mpool.go +++ b/node/impl/full/mpool.go @@ -2,6 +2,7 @@ package full import ( "context" + "encoding/json" "github.com/filecoin-project/go-address" "github.com/ipfs/go-cid" @@ -113,6 +114,7 @@ func (a *MpoolAPI) MpoolPush(ctx context.Context, smsg *types.SignedMessage) (ci } func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) { + inMsg := *msg { fromA, err := a.Stmgr.ResolveToKeyAddress(ctx, msg.From, nil) if err != nil { @@ -134,6 +136,13 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spe return nil, xerrors.Errorf("GasEstimateMessageGas error: %w", err) } + if msg.GasPremium.GreaterThan(msg.GasFeeCap) { + inJson, _ := json.Marshal(inMsg) + outJson, _ := json.Marshal(msg) + return nil, xerrors.Errorf("After estimation, GasPremium is greater than GasFeeCap, inmsg: %s, outmsg: %s", + inJson, outJson) + } + sign := func(from address.Address, nonce uint64) (*types.SignedMessage, error) { msg.Nonce = nonce if msg.From.Protocol() == address.ID {