This commit is contained in:
Jared Wasinger 2025-04-09 18:19:49 +08:00
parent 95948b60d4
commit 7d313c14fa
3 changed files with 1 additions and 19 deletions

View file

@ -19,7 +19,6 @@ package legacypool
import (
"errors"
"fmt"
"maps"
"math"
"math/big"
@ -978,7 +977,6 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error {
pool.requestPromoteExecutables(req)
if sync {
<-req.done
fmt.Printf("added %x\n", txs[0].Hash())
}
return errs
}
@ -1205,7 +1203,6 @@ func (pool *LegacyPool) scheduleReorgLoop() {
select {
case req := <-pool.reqResetCh:
fmt.Printf("request reset to %d\n", req.newHead.Number)
// Reset request: update head if request is already pending.
if reset == nil {
reset = req
@ -1214,10 +1211,8 @@ func (pool *LegacyPool) scheduleReorgLoop() {
}
nextDones = append(nextDones, req.done)
launchNextRun = true
//pool.reorgDoneCh <- nextDone
case req := <-pool.reqPromoteCh:
fmt.Println("request promote")
// Promote request: update address set if request is already pending.
if dirtyAccounts == nil {
dirtyAccounts = req.set
@ -1226,7 +1221,6 @@ func (pool *LegacyPool) scheduleReorgLoop() {
}
nextDones = append(nextDones, req.done)
launchNextRun = true
//pool.reorgDoneCh <- nextDone
case tx := <-pool.queueTxEventCh:
// Queue up the event, but don't schedule a reorg. It's up to the caller to
@ -1310,7 +1304,6 @@ func (pool *LegacyPool) runReorg(done chan struct{}, reset *txpoolResetRequest,
for addr, list := range pool.pending {
highestPending := list.LastElement()
nonces[addr] = highestPending.Nonce() + 1
fmt.Printf("set pending nonce %x <- %d\n", addr, highestPending.Nonce()+1)
}
pool.pendingNonces.setAll(nonces)
}
@ -1467,11 +1460,8 @@ func (pool *LegacyPool) promoteExecutables(accounts []common.Address) []*types.T
log.Trace("Removed unpayable queued transactions", "count", len(drops))
queuedNofundsMeter.Mark(int64(len(drops)))
fmt.Printf("pending nonce of %x is %d\n", addr, pool.pendingNonces.get(addr))
fmt.Printf("in-state nonce of %x is %d\n", addr, pool.currentState.GetNonce(addr))
// Gather all executable transactions and promote them
readies := list.Ready(pool.pendingNonces.get(addr))
fmt.Println(len(readies))
for _, tx := range readies {
hash := tx.Hash()
@ -1479,11 +1469,6 @@ func (pool *LegacyPool) promoteExecutables(accounts []common.Address) []*types.T
promoted = append(promoted, tx)
}
}
fmt.Println(len(promoted))
if len(promoted) > 0 {
fmt.Println(promoted[0].Hash())
fmt.Println(promoted[0].Nonce())
}
log.Trace("Promoted queued transactions", "count", len(promoted))
queuedGauge.Dec(int64(len(readies)))

View file

@ -361,7 +361,6 @@ func (p *TxPool) Add(txs []*types.Transaction, sync bool) []error {
splits := make([]int, len(txs))
for i, tx := range txs {
fmt.Printf("txpool attempting to add %v\n", tx.Hash())
// Mark this transaction belonging to no-subpool
splits[i] = -1

View file

@ -119,7 +119,6 @@ func TestEth2AssembleBlock(t *testing.T) {
t.Fatalf("error signing transaction, err=%v", err)
}
ethservice.TxPool().Add([]*types.Transaction{tx}, true)
fmt.Println("in test: added txs")
blockParams := engine.PayloadAttributes{
Timestamp: blocks[9].Time() + 5,
}
@ -139,7 +138,7 @@ func assembleWithTransactions(api *ConsensusAPI, parentHash common.Hash, params
return nil, err
}
if have, want := len(execData.Transactions), want; have != want {
err = fmt.Errorf("block %d: invalid number of transactions, have %d want %d", execData.Number, have, want)
err = fmt.Errorf("invalid number of transactions, have %d want %d", have, want)
continue
}
return execData, nil
@ -448,7 +447,6 @@ func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block)
n.Close()
t.Fatal("can't import test blocks:", err)
}
time.Sleep(100 * time.Millisecond)
ethservice.SetSynced()
return n, ethservice