mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
Remove counter from every mempoolTx (#2891)
Within every tx in the mempool, we store a 64 bit counter, as an index for when it was inserted into the mempool. This counter doesn't really serve any purpose. It was likely added for debugging at one point, Removing the counter reclaims memory, which enables greater mempool sizes / mitigates resources at the same size. Closes #2835
This commit is contained in:
parent
2d525bf2b8
commit
1610a05cbd
@ -27,5 +27,6 @@ program](https://hackerone.com/tendermint).
|
||||
|
||||
- [config] \#2877 add blocktime_iota to the config.toml (@ackratos)
|
||||
- [mempool] \#2855 add txs from Update to cache
|
||||
- [mempool] \#2835 Remove local int64 counter from being stored in every tx
|
||||
|
||||
### BUG FIXES:
|
||||
|
@ -131,7 +131,6 @@ type Mempool struct {
|
||||
proxyMtx sync.Mutex
|
||||
proxyAppConn proxy.AppConnMempool
|
||||
txs *clist.CList // concurrent linked-list of good txs
|
||||
counter int64 // simple incrementing counter
|
||||
height int64 // the last block Update()'d to
|
||||
rechecking int32 // for re-checking filtered txs on Update()
|
||||
recheckCursor *clist.CElement // next expected response
|
||||
@ -167,7 +166,6 @@ func NewMempool(
|
||||
config: config,
|
||||
proxyAppConn: proxyAppConn,
|
||||
txs: clist.New(),
|
||||
counter: 0,
|
||||
height: height,
|
||||
rechecking: 0,
|
||||
recheckCursor: nil,
|
||||
@ -365,9 +363,7 @@ func (mem *Mempool) resCbNormal(req *abci.Request, res *abci.Response) {
|
||||
postCheckErr = mem.postCheck(tx, r.CheckTx)
|
||||
}
|
||||
if (r.CheckTx.Code == abci.CodeTypeOK) && postCheckErr == nil {
|
||||
mem.counter++
|
||||
memTx := &mempoolTx{
|
||||
counter: mem.counter,
|
||||
height: mem.height,
|
||||
gasWanted: r.CheckTx.GasWanted,
|
||||
tx: tx,
|
||||
@ -378,7 +374,6 @@ func (mem *Mempool) resCbNormal(req *abci.Request, res *abci.Response) {
|
||||
"res", r,
|
||||
"height", memTx.height,
|
||||
"total", mem.Size(),
|
||||
"counter", memTx.counter,
|
||||
)
|
||||
mem.metrics.TxSizeBytes.Observe(float64(len(tx)))
|
||||
mem.notifyTxsAvailable()
|
||||
@ -613,7 +608,6 @@ func (mem *Mempool) recheckTxs(txs []types.Tx) {
|
||||
|
||||
// mempoolTx is a transaction that successfully ran
|
||||
type mempoolTx struct {
|
||||
counter int64 // a simple incrementing counter
|
||||
height int64 // height that this tx had been validated in
|
||||
gasWanted int64 // amount of gas this tx states it will require
|
||||
tx types.Tx //
|
||||
|
Loading…
x
Reference in New Issue
Block a user