Skip to content

Commit

Permalink
wait for async msg indexing (filecoin-project#12200)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 authored and ribasushi committed Aug 20, 2024
1 parent 5ed80f7 commit 853b17a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions itests/kit/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,23 @@ func (e *EVM) InvokeContractByFuncNameExpectExit(ctx context.Context, fromAddr a
}

func (e *EVM) WaitTransaction(ctx context.Context, hash ethtypes.EthHash) (*api.EthTxReceipt, error) {
if mcid, err := e.EthGetMessageCidByTransactionHash(ctx, &hash); err != nil {
return nil, err
} else if mcid == nil {
return nil, xerrors.Errorf("couldn't find message CID for txn hash: %s", hash)
} else {
retries := 3
var mcid *cid.Cid
var err error

for retries > 0 {
if mcid, err = e.EthGetMessageCidByTransactionHash(ctx, &hash); err != nil {
return nil, err
} else if mcid == nil {
retries--
time.Sleep(100 * time.Millisecond)
continue
}

e.WaitMsg(ctx, *mcid)
return e.EthGetTransactionReceipt(ctx, hash)
}
return nil, xerrors.Errorf("couldn't find message CID for txn hash: %s", hash)
}

// function signatures are the first 4 bytes of the hash of the function name and types
Expand Down

0 comments on commit 853b17a

Please sign in to comment.