From 5920d310de65aca21d39e675c615468942cd4129 Mon Sep 17 00:00:00 2001 From: Ji Qiren Date: Fri, 15 Dec 2023 13:02:09 +0800 Subject: [PATCH] v3.11.0: prioritize transfer tx in tx pool --- CHANGELOG.md | 5 +++++ core/txpool/tx_pool.go | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd1c7fe6b..a38363ad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v3.11.0 +Fri Dec 15 12:59:23 CST 2023 + +- prioritize transfer tx in tx pool + ## v3.10.1 Tue Aug 22 21:03:12 CST 2023 diff --git a/core/txpool/tx_pool.go b/core/txpool/tx_pool.go index 46ee6e8c4..9aa356c61 100644 --- a/core/txpool/tx_pool.go +++ b/core/txpool/tx_pool.go @@ -148,8 +148,15 @@ func (pool *TxPImpl) initBlockTx() { } func (pool *TxPImpl) verifyTx(t *tx.Tx) error { - if pool.pendingTx.Size() > maxCacheTxs { - return ErrCacheFull + isSimpleTransfer := len(t.Actions) == 1 && t.Actions[0].Contract == "token.iost" + if isSimpleTransfer { + if pool.pendingTx.Size() > 2*maxCacheTxs { + return ErrCacheFull + } + } else { + if pool.pendingTx.Size() > maxCacheTxs { + return ErrCacheFull + } } // Add one second delay for tx created time check currentTime := time.Now().UnixNano()