Skip to content

Commit

Permalink
v3.11.2: prioritize transfer tx in tx pool
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji Qiren committed Dec 16, 2023
1 parent 3783fb7 commit 16e8e29
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GO_INSTALL := $(GO) install

PROJECT_NAME := $(shell basename "$(PWD)")
BUILDER_VERSION = 3.11.0
VERSION = 3.11.1
VERSION = 3.11.2
COMMIT = $(shell git rev-parse --short HEAD)
PROJECT = github.com/iost-official/go-iost
DOCKER_IMAGE = iostio/iost-node:$(VERSION)-$(COMMIT)
Expand Down
2 changes: 1 addition & 1 deletion core/txpool/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (pool *TxPImpl) initBlockTx() {
}

func (pool *TxPImpl) verifyTx(t *tx.Tx) error {
isSimpleTransfer := len(t.Actions) == 1 && t.Actions[0].Contract == "token.iost"
isSimpleTransfer := len(t.Actions) == 1 && t.Actions[0].Contract == "token.iost" && len(t.Actions[0].Data) <= 70
if isSimpleTransfer {
if pool.pendingTx.Size() > maxCacheTxs {
return ErrCacheFull
Expand Down
8 changes: 8 additions & 0 deletions core/txpool/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ func compareTx(a, b any) int {
txb := b.(*tx.Tx)
isSimpleTransferA := len(txa.Actions) == 1 && txa.Actions[0].Contract == "token.iost"
isSimpleTransferB := len(txb.Actions) == 1 && txb.Actions[0].Contract == "token.iost"
if isSimpleTransferA && isSimpleTransferB {
if len(txa.Actions[0].Data) < len(txb.Actions[0].Data) {
return 1
}
if len(txa.Actions[0].Data) > len(txb.Actions[0].Data) {
return -1
}
}
if isSimpleTransferA && !isSimpleTransferB {
return 1
}
Expand Down

0 comments on commit 16e8e29

Please sign in to comment.