From 0b7b5530722901ce7f252fee086b18bb0ff73425 Mon Sep 17 00:00:00 2001 From: maskpp Date: Thu, 27 Jun 2024 15:06:49 +0800 Subject: [PATCH] change to use hash --- accounts/abi/bind/util.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/accounts/abi/bind/util.go b/accounts/abi/bind/util.go index b931fbb04d..0d298eed3f 100644 --- a/accounts/abi/bind/util.go +++ b/accounts/abi/bind/util.go @@ -29,13 +29,13 @@ import ( // WaitMined waits for tx to be mined on the blockchain. // It stops waiting when the context is canceled. -func WaitMined(ctx context.Context, b DeployBackend, tx *types.Transaction) (*types.Receipt, error) { +func WaitMined(ctx context.Context, b DeployBackend, hash common.Hash) (*types.Receipt, error) { queryTicker := time.NewTicker(time.Second) defer queryTicker.Stop() - logger := log.New("hash", tx.Hash()) + logger := log.New("hash", hash) for { - receipt, err := b.TransactionReceipt(ctx, tx.Hash()) + receipt, err := b.TransactionReceipt(ctx, hash) if err == nil { return receipt, nil } @@ -61,7 +61,7 @@ func WaitDeployed(ctx context.Context, b DeployBackend, tx *types.Transaction) ( if tx.To() != nil { return common.Address{}, errors.New("tx is not contract creation") } - receipt, err := WaitMined(ctx, b, tx) + receipt, err := WaitMined(ctx, b, tx.Hash()) if err != nil { return common.Address{}, err }