mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-18 21:26:20 +00:00
initial logic to remove txs from the mempool
This commit is contained in:
@@ -221,6 +221,18 @@ func (rpp *ResponsePrepareProposal) IncludedTxs() []*TxRecord {
|
||||
return trs
|
||||
}
|
||||
|
||||
// RemovedTxs returns all of the TxRecords that are marked for removal from the
|
||||
// mempool.
|
||||
func (rpp *ResponsePrepareProposal) RemovedTxs() []*TxRecord {
|
||||
trs := []*TxRecord{}
|
||||
for _, tr := range rpp.TxRecords {
|
||||
if tr.Action == TxRecord_REMOVED {
|
||||
trs = append(trs, tr)
|
||||
}
|
||||
}
|
||||
return trs
|
||||
}
|
||||
|
||||
// Validate checks that the fields of the ResponsePrepareProposal are properly
|
||||
// constructed. Validate returns an error if any of the validation checks fail.
|
||||
func (rpp *ResponsePrepareProposal) Validate(maxSizeBytes int64, otxs [][]byte) error {
|
||||
|
||||
@@ -144,7 +144,11 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
|
||||
if err := rpp.Validate(maxDataBytes, txs.ToSliceOfBytes()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, rtx := range rpp.RemovedTxs() {
|
||||
if err := blockExec.mempool.RemoveTxByKey(types.Tx(rtx.Tx).Key()); err != nil {
|
||||
blockExec.logger.Debug("error removing transaction from the mempool", "error", err)
|
||||
}
|
||||
}
|
||||
return state.MakeBlock(height, types.TxRecordsToTxs(rpp.IncludedTxs()), commit, evidence, proposerAddr)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user