Skip to content

Commit

Permalink
Merge pull request #594 from libotony/improve-txpool
Browse files Browse the repository at this point in the history
txpool: minor improvement, ignore local submitted flag when fill pool
  • Loading branch information
libotony committed Jul 18, 2023
2 parents e664012 + 891c9fe commit b2704f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/thor/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (n *Node) txStashLoop(ctx context.Context) {

{
txs := stash.LoadAll()
n.txPool.Fill(txs, false)
n.txPool.Fill(txs)
log.Debug("loaded txs from stash", "count", len(txs))
}

Expand Down
8 changes: 4 additions & 4 deletions txpool/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (p *TxPool) Close() {
log.Debug("closed")
}

//SubscribeTxEvent receivers will receive a tx
// SubscribeTxEvent receivers will receive a tx
func (p *TxPool) SubscribeTxEvent(ch chan *TxEvent) event.Subscription {
return p.scope.Track(p.txFeed.Subscribe(ch))
}
Expand Down Expand Up @@ -323,15 +323,15 @@ func (p *TxPool) Executables() tx.Transactions {
}

// Fill fills txs into pool.
func (p *TxPool) Fill(txs tx.Transactions, localSubmitted bool) {
func (p *TxPool) Fill(txs tx.Transactions) {
txObjs := make([]*txObject, 0, len(txs))
for _, tx := range txs {
origin, _ := tx.Origin()
if thor.IsOriginBlocked(origin) || p.blocklist.Contains(origin) {
continue
}
// here we ignore errors
if txObj, err := resolveTx(tx, localSubmitted); err == nil {
if txObj, err := resolveTx(tx, false); err == nil {
txObjs = append(txObjs, txObj)
}
}
Expand Down Expand Up @@ -464,8 +464,8 @@ func (p *TxPool) wash(headSummary *chain.BlockSummary) (executables tx.Transacti
}

p.goes.Go(func() {
executable := true
for _, tx := range toBroadcast {
executable := true
p.txFeed.Send(&TxEvent{tx, &executable})
}
})
Expand Down

0 comments on commit b2704f3

Please sign in to comment.