Skip to content

Commit 466313d

Browse files
authored
Merge pull request #3 from base/fix-crash
fix: don't crash when receipt isn't found
2 parents 60bf4a3 + f70e287 commit 466313d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func main() {
129129
// wait for it to be mined -- sleep a random amount between 600ms and 1s
130130
time.Sleep(time.Duration(rand.Int63n(600)+600) * time.Millisecond)
131131
} else {
132-
time.Sleep(time.Duration(rand.Int63n(200)+100) * time.Millisecond)
132+
time.Sleep(time.Duration(rand.Int63n(200)+200) * time.Millisecond)
133133
}
134134
}
135135

@@ -256,6 +256,10 @@ func sendTransactionSync(client *ethclient.Client, signedTx *types.Transaction)
256256
return stats{}, fmt.Errorf("unable to send sync transaction: %v", err)
257257
}
258258

259+
if receipt == nil {
260+
return stats{}, fmt.Errorf("unable to send sync transaction: receipt not found")
261+
}
262+
259263
log.Println("Transaction sent sync: ", signedTx.Hash().Hex())
260264
now := time.Now()
261265
return stats{

0 commit comments

Comments
 (0)