From 8e3aa5e31449b7f91edddeee1f0f16be94911479 Mon Sep 17 00:00:00 2001 From: Vitaly Drogan Date: Tue, 13 Sep 2022 18:45:07 +0300 Subject: [PATCH] fix proposer payout bug with payout tx (#27) --- miner/worker.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/miner/worker.go b/miner/worker.go index e9612dae3635..132f8bbde9d2 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1826,6 +1826,9 @@ func (w *worker) createProposerPayoutTx(env *environment, recipient *common.Addr nonce := env.state.GetNonce(w.coinbase) fee := new(big.Int).Mul(big.NewInt(21000), env.header.BaseFee) amount := new(big.Int).Sub(profit, fee) + if amount.Sign() == -1 { + return nil, errors.New("negative amount of proposer payout") + } gasPrice := new(big.Int).Set(env.header.BaseFee) chainId := w.chainConfig.ChainID log.Debug("createProposerPayoutTx", "sender", sender, "chainId", chainId.String(), "nonce", nonce, "amount", amount.String(), "gas", params.TxGas, "baseFee", env.header.BaseFee.String(), "fee", fee)