Skip to content

Commit

Permalink
fix: eth: make tx hash immediately available in lookup db after submi…
Browse files Browse the repository at this point in the history
…ssion

Fixes: #12218
  • Loading branch information
rvagg committed Jul 15, 2024
1 parent 21abfc6 commit 9714670
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions node/impl/full/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,11 @@ func (a *EthModule) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.Et
return ethtypes.EmptyEthHash, err
}

txHash, err := txArgs.TxHash()
if err != nil {
return ethtypes.EmptyEthHash, err
}

smsg, err := ethtypes.ToSignedFilecoinMessage(txArgs)
if err != nil {
return ethtypes.EmptyEthHash, err
Expand All @@ -841,6 +846,12 @@ func (a *EthModule) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.Et
return ethtypes.EmptyEthHash, err
}

// make it immediately available in the transaction hash lookup db, even though it will also
// eventually get there via the mpool
if err := a.EthTxHashManager.TransactionHashLookup.UpsertHash(txHash, smsg.Cid()); err != nil {
log.Errorf("error inserting tx mapping to db: %s", err)
}

return ethtypes.EthHashFromTxBytes(rawTx), nil
}

Expand Down

0 comments on commit 9714670

Please sign in to comment.