check for receipt address before calling back

This commit is contained in:
Jonathan Rainville 2018-07-11 08:47:12 -04:00
parent d3366197b3
commit cc3839382c
1 changed files with 5 additions and 2 deletions

View File

@ -244,15 +244,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