From 50b0376954d3d46606904fbd487e08ed362b774a Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 11 Jul 2018 08:47:12 -0400 Subject: [PATCH] check for receipt address before calling back --- lib/contracts/blockchain.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index fe04ff9e..ffb88cd9 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -245,15 +245,18 @@ class Blockchain { let hash; let calledBacked = false; - function callback() { + function callback(err, receipt) { if (calledBacked) { return; } + if (!err && !receipt.contractAddress) { + return; // Not deployed yet. Need to wait + } if (interval) { clearInterval(interval); } calledBacked = true; - cb(...arguments); + cb(err, receipt); } // This interval is there to compensate for the event that sometimes doesn't get triggered when using WebSocket