Skip to content

Commit

Permalink
debug: add more logs1
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Apr 22, 2024
1 parent c39e300 commit 2b9c886
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions miner/ordering.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
"github.com/ethereum/go-ethereum/log"
)

// txWithMinerFee wraps a transaction with its gas price or effective miner gasTipCap
Expand Down Expand Up @@ -109,6 +110,7 @@ func newTransactionsByPriceAndNonce(signer types.Signer, txs map[common.Address]
for from, accTxs := range txs {
wrapped, err := newTxWithMinerFee(accTxs[0], from, baseFeeUint)
if err != nil {
log.Info("Failed to wrap transaction", "err", err)
delete(txs, from)
continue
}
Expand Down Expand Up @@ -205,11 +207,11 @@ func (t *transactionsByPriceAndNonce) Forward(tx *types.Transaction) {
}
return
}
//check whether target tx exists in t.heads
// check whether target tx exists in t.heads
for _, head := range t.heads {
if head.tx != nil && head.tx.Resolve() != nil {
if tx == head.tx.Tx {
//shift t to the position one after tx
// shift t to the position one after tx
txTmp := t.PeekWithUnwrap()
for txTmp != tx {
t.Shift()
Expand All @@ -220,13 +222,13 @@ func (t *transactionsByPriceAndNonce) Forward(tx *types.Transaction) {
}
}
}
//get the sender address of tx
// get the sender address of tx
acc, _ := types.Sender(t.signer, tx)
//check whether target tx exists in t.txs
// check whether target tx exists in t.txs
if txs, ok := t.txs[acc]; ok {
for _, txLazyTmp := range txs {
if txLazyTmp != nil && txLazyTmp.Resolve() != nil {
//found the same pointer in t.txs as tx and then shift t to the position one after tx
// found the same pointer in t.txs as tx and then shift t to the position one after tx
if tx == txLazyTmp.Tx {
txTmp := t.PeekWithUnwrap()
for txTmp != tx {
Expand Down
4 changes: 2 additions & 2 deletions miner/worker_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ func (w *worker) fillTransactionsAndBundles(interruptCh chan int32, env *environ
// 4.interrupted resubmit timer, which is by default 10s.
// resubmit is for PoW only, can be deleted for PoS consensus later
if len(localPlainTxs) > 0 || len(localBlobTxs) > 0 {
log.Info("fill local transactions", "plain", len(localPlainTxs), "blob", len(localBlobTxs))
plainTxs := newTransactionsByPriceAndNonce(env.signer, localPlainTxs, env.header.BaseFee)
blobTxs := newTransactionsByPriceAndNonce(env.signer, localBlobTxs, env.header.BaseFee)

log.Info("fill local transactions", "plain", len(plainTxs.txs), "blob", len(blobTxs.txs))
if err := w.commitTransactions(env, plainTxs, blobTxs, interruptCh, stopTimer); err != nil {
return err
}
}
if len(remotePlainTxs) > 0 || len(remoteBlobTxs) > 0 {
log.Info("fill remote transactions", "plain", len(remotePlainTxs), "blob", len(remoteBlobTxs))
plainTxs := newTransactionsByPriceAndNonce(env.signer, remotePlainTxs, env.header.BaseFee)
blobTxs := newTransactionsByPriceAndNonce(env.signer, remoteBlobTxs, env.header.BaseFee)

log.Info("fill remote transactions", "plain", len(plainTxs.txs), "blob", len(blobTxs.txs))
if err := w.commitTransactions(env, plainTxs, blobTxs, interruptCh, stopTimer); err != nil {
return err
}
Expand Down

0 comments on commit 2b9c886

Please sign in to comment.