Skip to content

Commit

Permalink
Fix reading blob transaction from PoolTransaction (#9632)
Browse files Browse the repository at this point in the history
In `PoolTransaction` txn RLP is prefixed with the sender.
  • Loading branch information
yperbasis authored Mar 8, 2024
1 parent e6ecb82 commit a734681
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 0 additions & 4 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ func (t BinaryTransactions) EncodeIndex(i int, w *bytes.Buffer) {
w.Write(t[i])
}

func (tm TransactionMisc) From() *atomic.Value {
return &tm.from
}

func DecodeRLPTransaction(s *rlp.Stream, blobTxnsAreWrappedWithBlobs bool) (Transaction, error) {
kind, size, err := s.Kind()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/kv/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ var ChaindataTables = []string{

const (
RecentLocalTransaction = "RecentLocalTransaction" // sequence_u64 -> tx_hash
PoolTransaction = "PoolTransaction" // txHash -> sender_id_u64+tx_rlp
PoolTransaction = "PoolTransaction" // txHash -> sender+tx_rlp
PoolInfo = "PoolInfo" // option_key -> option_value
)

Expand Down
7 changes: 4 additions & 3 deletions erigon-lib/txpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,14 +682,15 @@ func (p *TxPool) getCachedBlobTxnLocked(tx kv.Tx, hash []byte) (*metaTx, error)
return nil, nil
}

txn, err := tx.GetOne(kv.PoolTransaction, hash)
v, err := tx.GetOne(kv.PoolTransaction, hash)
if err != nil {
return nil, err
}
txRlp := common.Copy(v[20:])
parseCtx := types.NewTxParseContext(p.chainID)
parseCtx.WithSender(false)
txSlot := &types.TxSlot{}
parseCtx.ParseTransaction(txn, 0, txSlot, nil, false, true, nil)
parseCtx.ParseTransaction(txRlp, 0, txSlot, nil, false, true, nil)
return newMetaTx(txSlot, false, 0), nil
}

Expand Down Expand Up @@ -2065,7 +2066,7 @@ func (p *TxPool) fromDB(ctx context.Context, tx kv.Tx, coreTx kv.Tx) error {
p.lastSeenBlock.Store(lastSeenBlock)
}

// this is neccessary as otherwise best - which waits for sync events
// this is necessary as otherwise best - which waits for sync events
// may wait for ever if blocks have been process before the txpool
// starts with an empty db
lastSeenProgress, err := getExecutionProgress(coreTx)
Expand Down

0 comments on commit a734681

Please sign in to comment.