Commit 240340b0 authored by Ethen Pociask's avatar Ethen Pociask

[indexer.api.add_withdrawal_hash] verify message hash not nil

parent 6bace497
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "go",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/indexer/cmd/indexer",
"mode": "debug",
"env": {
"INDEXER_CONFIG": "/Users/ethen.pociask@coinbase.com/coinbase/indexer.sepolia.toml",
},
"args": [
"index"
]
}
]
}
package models
import "github.com/ethereum-optimism/optimism/indexer/database"
import (
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum/go-ethereum/common"
)
// DepositItem ... Deposit item model for API responses
type DepositItem struct {
......@@ -51,6 +54,12 @@ type WithdrawalResponse struct {
func CreateWithdrawalResponse(withdrawals *database.L2BridgeWithdrawalsResponse) WithdrawalResponse {
items := make([]WithdrawalItem, len(withdrawals.Withdrawals))
for i, withdrawal := range withdrawals.Withdrawals {
msg := withdrawal.L2BridgeWithdrawal.CrossDomainMessageHash
if msg == nil {
msg = &common.Hash{}
}
item := WithdrawalItem{
Guid: withdrawal.L2BridgeWithdrawal.TransactionWithdrawalHash.String(),
L2BlockHash: withdrawal.L2BlockHash.String(),
......@@ -59,7 +68,7 @@ func CreateWithdrawalResponse(withdrawals *database.L2BridgeWithdrawalsResponse)
To: withdrawal.L2BridgeWithdrawal.Tx.ToAddress.String(),
TransactionHash: withdrawal.L2TransactionHash.String(),
Amount: withdrawal.L2BridgeWithdrawal.Tx.Amount.String(),
MessageHash: withdrawal.L2BridgeWithdrawal.CrossDomainMessageHash.String(),
MessageHash: msg.String(),
ProofTransactionHash: withdrawal.ProvenL1TransactionHash.String(),
ClaimTransactionHash: withdrawal.FinalizedL1TransactionHash.String(),
L1TokenAddress: withdrawal.L2BridgeWithdrawal.TokenPair.RemoteTokenAddress.String(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment