mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
mempool: length prefix txs when getting them from mempool (#5483)
## Description In protobuf `[]byte` is varint encoded. When adding txs to the block we were not taking this into account. Closes: #XXX
This commit is contained in:
@@ -104,6 +104,7 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
|
||||
|
||||
// Fetch a limited amount of valid txs
|
||||
maxDataBytes := types.MaxDataBytes(maxBytes, evSize, state.Validators.Size())
|
||||
|
||||
txs := blockExec.mempool.ReapMaxBytesMaxGas(maxDataBytes, maxGas)
|
||||
|
||||
return state.MakeBlock(height, txs, commit, evidence, proposerAddr)
|
||||
|
||||
@@ -25,8 +25,8 @@ func TestTxFilter(t *testing.T) {
|
||||
tx types.Tx
|
||||
isErr bool
|
||||
}{
|
||||
{types.Tx(tmrand.Bytes(2154)), false},
|
||||
{types.Tx(tmrand.Bytes(2155)), true},
|
||||
{types.Tx(tmrand.Bytes(2151)), false},
|
||||
{types.Tx(tmrand.Bytes(2152)), true},
|
||||
{types.Tx(tmrand.Bytes(3000)), true},
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestTxFilter(t *testing.T) {
|
||||
state, err := stateStore.LoadFromDBOrGenesisDoc(genDoc)
|
||||
require.NoError(t, err)
|
||||
|
||||
f := sm.TxPreCheck(state) // current max size of a tx 1850
|
||||
f := sm.TxPreCheck(state)
|
||||
if tc.isErr {
|
||||
assert.NotNil(t, f(tc.tx), "#%v", i)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user