mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-18 02:32:51 +00:00
Compare commits
2 Commits
master
...
wb/issue-8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c74df714d4 | ||
|
|
1d2858f1b2 |
@@ -158,11 +158,6 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
|
||||
blockExec.logger.Debug("error removing transaction from the mempool", "error", err, "tx hash", rtx.Hash())
|
||||
}
|
||||
}
|
||||
for _, atx := range txrSet.AddedTxs() {
|
||||
if err := blockExec.mempool.CheckTx(ctx, atx, nil, mempool.TxInfo{}); err != nil {
|
||||
blockExec.logger.Error("error adding tx to the mempool", "error", err, "tx hash", atx.Hash())
|
||||
}
|
||||
}
|
||||
itxs := txrSet.IncludedTxs()
|
||||
return state.MakeBlock(height, itxs, commit, evidence, proposerAddr), nil
|
||||
}
|
||||
|
||||
@@ -773,8 +773,7 @@ func TestPrepareProposalRemoveTxs(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestPrepareProposalAddedTxsIncluded tests that any transactions marked as ADDED
|
||||
// in the prepare proposal response are included in the block. The test also
|
||||
// ensures that any transactions added are also checked into the mempool.
|
||||
// in the prepare proposal response are included in the block.
|
||||
func TestPrepareProposalAddedTxsIncluded(t *testing.T) {
|
||||
const height = 2
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -793,7 +792,6 @@ func TestPrepareProposalAddedTxsIncluded(t *testing.T) {
|
||||
txs := factory.MakeTenTxs(height)
|
||||
mp := &mpmocks.Mempool{}
|
||||
mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs(txs[2:]))
|
||||
mp.On("CheckTx", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Twice()
|
||||
|
||||
trs := txsToTxRecords(types.Txs(txs))
|
||||
trs[0].Action = abci.TxRecord_ADDED
|
||||
@@ -828,8 +826,6 @@ func TestPrepareProposalAddedTxsIncluded(t *testing.T) {
|
||||
require.Equal(t, txs[1], block.Data.Txs[1])
|
||||
|
||||
mp.AssertExpectations(t)
|
||||
mp.AssertCalled(t, "CheckTx", mock.Anything, types.Tx(trs[0].Tx), mock.Anything, mock.Anything)
|
||||
mp.AssertCalled(t, "CheckTx", mock.Anything, types.Tx(trs[1].Tx), mock.Anything, mock.Anything)
|
||||
}
|
||||
|
||||
// TestPrepareProposalReorderTxs tests that CreateBlock produces a block with transactions
|
||||
|
||||
@@ -378,7 +378,7 @@ and _p_'s _validValue_ is `nil`:
|
||||
`ResponsePrepareProposal.validator_updates`, and `ResponsePrepareProposal.consensus_param_updates`.
|
||||
* in both modes, the Application can manipulate transactions
|
||||
* leave transactions untouched - `TxAction = UNMODIFIED`
|
||||
* add new transactions (not previously in the mempool) - `TxAction = ADDED`
|
||||
* add new transactions directly to the proposal - `TxAction = ADDED`
|
||||
* remove transactions (invalid) from the proposal and from the mempool - `TxAction = REMOVED`
|
||||
* remove transactions from the proposal but not from the mempool (effectively _delaying_ them) - the
|
||||
Application removes the transaction from the list
|
||||
@@ -840,7 +840,7 @@ enum TxAction {
|
||||
* **Usage**:
|
||||
* If `Action` is `UNKNOWN`, a problem happened in the Application. Tendermint will assume the application is faulty and crash.
|
||||
* If `Action` is `UNMODIFIED`, Tendermint includes the transaction in the proposal. Nothing to do on the mempool.
|
||||
* If `Action` is `ADDED`, Tendermint includes the transaction in the proposal. The transaction is also added to the mempool and gossipped.
|
||||
* If `Action` is `ADDED`, Tendermint includes the transaction in the proposal.
|
||||
* If `Action` is `REMOVED`, Tendermint excludes the transaction from the proposal. The transaction is also removed from the mempool if it exists,
|
||||
similar to `CheckTx` returning _false_.
|
||||
### TxRecord
|
||||
|
||||
@@ -159,11 +159,6 @@ func (t TxRecordSet) IncludedTxs() []Tx {
|
||||
return t.included
|
||||
}
|
||||
|
||||
// AddedTxs returns the transactions added by the application.
|
||||
func (t TxRecordSet) AddedTxs() []Tx {
|
||||
return t.added
|
||||
}
|
||||
|
||||
// RemovedTxs returns the transactions marked for removal by the application.
|
||||
func (t TxRecordSet) RemovedTxs() []Tx {
|
||||
return t.removed
|
||||
|
||||
Reference in New Issue
Block a user