Skip to content

Commit 24f2e72

Browse files
logs: print proposal if error
1 parent 1e7f3bf commit 24f2e72

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

baseapp/abci_utils.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package baseapp
22

33
import (
4+
"encoding/json"
45
"fmt"
56

67
"github.com/cockroachdb/errors"
@@ -199,10 +200,13 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
199200
maxBlockGas = b.MaxGas
200201
}
201202

202-
for _, txBytes := range req.Txs {
203+
for i, txBytes := range req.Txs {
203204
tx, err := h.txVerifier.ProcessProposalVerifyTx(txBytes)
204205
if err != nil {
205-
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err)
206+
proposal, err := json.Marshal(req)
207+
if err == nil {
208+
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err, "proposal", string(proposal), "tx_index", i)
209+
}
206210
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
207211
}
208212

@@ -213,6 +217,10 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
213217
}
214218

215219
if totalTxGas > uint64(maxBlockGas) {
220+
proposal, err := json.Marshal(req)
221+
if err == nil {
222+
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err, "proposal", string(proposal), "tx_index", i)
223+
}
216224
ctx.Logger().Error("proposal failed on totalTxGas > maxBlockGas", "totalTxGas", totalTxGas, "maxBlockGas", maxBlockGas)
217225
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
218226
}

0 commit comments

Comments
 (0)