Skip to content

Commit

Permalink
Also add depositTxWithNonce cases to Transaction.SourceHash and Trans…
Browse files Browse the repository at this point in the history
…action.Mint functions
  • Loading branch information
mdehoog committed Oct 4, 2024
1 parent bb64146 commit 8d0632e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,23 @@ func (tx *Transaction) To() *common.Address {
// e.g. a user deposit event, or a L1 info deposit included in a specific L2 block height.
// Non-deposit transactions return a zeroed hash.
func (tx *Transaction) SourceHash() common.Hash {
if dep, ok := tx.inner.(*DepositTx); ok {
return dep.SourceHash
switch tx.inner.(type) {
case *DepositTx:
return tx.inner.(*DepositTx).SourceHash
case *depositTxWithNonce:
return tx.inner.(*depositTxWithNonce).SourceHash
}
return common.Hash{}
}

// Mint returns the ETH to mint in the deposit tx.
// This returns nil if there is nothing to mint, or if this is not a deposit tx.
func (tx *Transaction) Mint() *big.Int {
if dep, ok := tx.inner.(*DepositTx); ok {
return dep.Mint
switch tx.inner.(type) {
case *DepositTx:
return tx.inner.(*DepositTx).Mint
case *depositTxWithNonce:
return tx.inner.(*depositTxWithNonce).Mint
}
return nil
}
Expand Down

0 comments on commit 8d0632e

Please sign in to comment.