Skip to content

Commit

Permalink
updated const and added transaction hash decode handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash4dev committed Jan 27, 2024
1 parent 7b74751 commit 22578b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ const BlockDelay = 5
const ExecutionClientRPC = "http://127.0.0.1:8545/"
const SettlementClientRPC = "http://127.0.0.1:8080"
const KeyringDirectory = "./account/keys"

// var DaClientRPC = os.Getenv("DA_CLIENT_RPC")
const DaClientRPC = "http://127.0.0.1:5050/celestia"
23 changes: 17 additions & 6 deletions handlers/txns.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,21 @@ func SaveTxns(client *ethclient.Client, ctx context.Context, ldt *leveldb.DB, tr
}

txHash := common.HexToHash(transactionHash)
tx, isPending, err := client.TransactionByHash(ctx, txHash)
if err != nil {
logs.Log.Error(fmt.Sprintf("Failed to get transaction by hash: %s", err))
os.Exit(0)

fmt.Println("txHash", txHash)

var tx *types.Transaction
var isPending bool
for {
tx, isPending, err = client.TransactionByHash(ctx, txHash)
if err == nil {
break
} else {
logs.Log.Error(fmt.Sprintf("Failed to get transaction by hash: %s", err))
logs.Log.Error(fmt.Sprintf("Retrying in 2 seconds: %s", err))
time.Sleep(2 * time.Second)
continue
}
}

if isPending {
Expand Down Expand Up @@ -88,8 +99,8 @@ func SaveTxns(client *ethclient.Client, ctx context.Context, ldt *leveldb.DB, tr
}

var toValue string
//

//

if tx.To() == nil {
// Contract creation
Expand Down

0 comments on commit 22578b6

Please sign in to comment.