diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d36264fde..b8da07261a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * [#1648](https://github.com/crypto-org-chain/cronos/pull/1648) Add abort OE in PrepareProposal. * (testground)[#1651](https://github.com/crypto-org-chain/cronos/pull/1651) Benchmark use cosmos broadcast rpc. * (testground)[#1650](https://github.com/crypto-org-chain/cronos/pull/1650) Benchmark support batch mode. +* [#1658](https://github.com/crypto-org-chain/cronos/pull/1658) Optimize when block-list is empty. *Oct 14, 2024* diff --git a/app/proposal.go b/app/proposal.go index 8a755941c5..3e4465b084 100644 --- a/app/proposal.go +++ b/app/proposal.go @@ -124,6 +124,11 @@ func (h *ProposalHandler) SetBlockList(blob []byte) error { } func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error { + if len(h.blocklist) == 0 { + // fast path, accept all txs + return nil + } + sigTx, ok := tx.(signing.SigVerifiableTx) if !ok { return fmt.Errorf("tx of type %T does not implement SigVerifiableTx", tx) @@ -147,6 +152,11 @@ func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error { func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler { return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) { + if len(h.blocklist) == 0 { + // fast path, accept all txs + return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil + } + for _, txBz := range req.Txs { memTx, err := h.TxDecoder(txBz) if err != nil {