Merge pull request #3456 from filecoin-project/misc/account-for-premium

Account for GasPremium in GasEstimateFeeCap
This commit is contained in:
Łukasz Magiera 2020-09-02 18:20:32 +02:00 committed by GitHub
commit 5aeabe39b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,10 @@ func (a *GasAPI) GasEstimateFeeCap(ctx context.Context, msg *types.Message, maxq
out = types.BigDiv(maxAccepted, gasLimitBig)
}
if msg.GasPremium != types.EmptyInt {
out = types.BigAdd(out, msg.GasPremium)
}
return out, nil
}
@ -214,7 +218,7 @@ func (a *GasAPI) GasEstimateMessageGas(ctx context.Context, msg *types.Message,
if err != nil {
return nil, xerrors.Errorf("estimating fee cap: %w", err)
}
msg.GasFeeCap = big.Add(feeCap, msg.GasPremium)
msg.GasFeeCap = feeCap
}
capGasFee(msg, spec.Get().MaxFee)