abci: remove TotalTxs and NumTxs from Header (#3783)

* Removal of TotalTx & NumTx

- Removed totalTx and numTx

closes #2521

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* abci proto changes

* proto number fix

* txfilter_test fix

* comments on PR

* further changes

* bring back metrics

* fix indexer

* fix TestBlockMaxDataBytes and TestBlockMaxDataBytesUnknownEvidence

* indexer service back to header

* statistics.go fix

* fix ci

* listen for blocks, not headers

to be able to record txs throughput

* fix TestNetworkNewBlock

* fix tests

* fix tests in types package

* fixes after Anton's review

* fix tests

* bring back `consensus_total_txs` metric

I mistakenly thought it was removed.

* improve changelog

* remove LastBlockTotalTx from state

* docs: remove getNumTxs from BeginBlock Java example
This commit is contained in:
Marko
2019-11-14 10:56:13 +01:00
committed by Anton Kaliaev
parent 9174fb7892
commit 1604047c39
37 changed files with 327 additions and 534 deletions

View File

@@ -123,7 +123,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) {
select {
case msg := <-newBlockCh:
blockEvent := msg.Data().(types.EventDataNewBlock)
nTxs += int(blockEvent.Block.Header.NumTxs)
nTxs += len(blockEvent.Block.Txs)
case <-ticker.C:
panic("Timed out waiting to commit blocks with transactions")
}

View File

@@ -1376,8 +1376,11 @@ func (cs *ConsensusState) finalizeCommit(height int64) {
panic(fmt.Sprintf("+2/3 committed an invalid block: %v", err))
}
cs.Logger.Info(fmt.Sprintf("Finalizing commit of block with %d txs", block.NumTxs),
"height", block.Height, "hash", block.Hash(), "root", block.AppHash)
cs.Logger.Info("Finalizing commit of block with N txs",
"height", block.Height,
"hash", block.Hash(),
"root", block.AppHash,
"N", len(block.Txs))
cs.Logger.Info(fmt.Sprintf("%v", block))
fail.Fail() // XXX
@@ -1488,11 +1491,10 @@ func (cs *ConsensusState) recordMetrics(height int64, block *types.Block) {
)
}
cs.metrics.NumTxs.Set(float64(block.NumTxs))
cs.metrics.NumTxs.Set(float64(len(block.Data.Txs)))
cs.metrics.TotalTxs.Add(float64(len(block.Data.Txs)))
cs.metrics.BlockSizeBytes.Set(float64(block.Size()))
cs.metrics.TotalTxs.Set(float64(block.TotalTxs))
cs.metrics.CommittedHeight.Set(float64(block.Height))
}
//-----------------------------------------------------------------------------