mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-07 16:47:07 +00:00
Add TotalTx to block header, issue #952
Update state to keep track of this info. Change function args as needed. Make NumTx also an int64 for consistency.
This commit is contained in:
@@ -108,7 +108,8 @@ func TestTxConcurrentWithCommit(t *testing.T) {
|
||||
for nTxs := 0; nTxs < NTxs; {
|
||||
select {
|
||||
case b := <-newBlockCh:
|
||||
nTxs += b.(types.TMEventData).Unwrap().(types.EventDataNewBlock).Block.Header.NumTxs
|
||||
evt := b.(types.TMEventData).Unwrap().(types.EventDataNewBlock)
|
||||
nTxs += int(evt.Block.Header.NumTxs)
|
||||
case <-ticker.C:
|
||||
panic("Timed out waiting to commit blocks with transactions")
|
||||
}
|
||||
|
||||
+3
-2
@@ -863,7 +863,8 @@ func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts
|
||||
|
||||
// Mempool validated transactions
|
||||
txs := cs.mempool.Reap(cs.config.MaxBlockSizeTxs)
|
||||
return types.MakeBlock(cs.Height, cs.state.ChainID, txs, commit,
|
||||
return types.MakeBlock(cs.Height, cs.state.ChainID, txs,
|
||||
cs.state.LastBlockTotalTx, commit,
|
||||
cs.state.LastBlockID, cs.state.Validators.Hash(),
|
||||
cs.state.AppHash, cs.state.Params.BlockPartSizeBytes)
|
||||
}
|
||||
@@ -1200,7 +1201,7 @@ func (cs *ConsensusState) finalizeCommit(height int64) {
|
||||
// Create a copy of the state for staging
|
||||
// and an event cache for txs
|
||||
stateCopy := cs.state.Copy()
|
||||
txEventBuffer := types.NewTxEventBuffer(cs.eventBus, block.NumTxs)
|
||||
txEventBuffer := types.NewTxEventBuffer(cs.eventBus, int(block.NumTxs))
|
||||
|
||||
// Execute and commit the block, update and save the state, and update the mempool.
|
||||
// All calls to the proxyAppConn come here.
|
||||
|
||||
Reference in New Issue
Block a user