Skip to content

Commit

Permalink
v3.11.0: prioritize transfer tx in tx pool
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji Qiren committed Dec 15, 2023
1 parent 843190a commit 5920d31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
11 changes: 9 additions & 2 deletions core/txpool/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5920d31

Please sign in to comment.