Added setImmediate to the tests instead of the code since this seems to be where the issue is.

This commit is contained in:
Chris Kleeschulte 2015-09-02 10:45:44 -04:00
parent 0ac83098e9
commit ec720c2443

View File

@ -93,54 +93,53 @@ describe('Daemon Binding Functionality', function() {
// Generate enough blocks so that the initial coinbase transactions // Generate enough blocks so that the initial coinbase transactions
// can be spent. // can be spent.
client.generate(150, function(err, response) { setImmediate(function() {
client.generate(150, function(err, response) {
if (err) {
throw err;
}
blockHashes = response.result;
if (err) { log.info('Preparing test data...');
throw err;
}
blockHashes = response.result;
log.info('Preparing test data...'); // Get all of the unspent outputs
client.listUnspent(0, 150, function(err, response) {
utxos = response.result;
// Get all of the unspent outputs async.mapSeries(utxos, function(utxo, next) {
client.listUnspent(0, 150, function(err, response) { async.series([
utxos = response.result; function(finished) {
// Load all of the transactions for later testing
async.mapSeries(utxos, function(utxo, next) { client.getTransaction(utxo.txid, function(err, txresponse) {
async.series([ if (err) {
function(finished) { throw err;
// Load all of the transactions for later testing }
client.getTransaction(utxo.txid, function(err, txresponse) { // add to the list of transactions for testing later
if (err) { transactionData.push(txresponse.result.hex);
throw err; finished();
} });
// add to the list of transactions for testing later },
transactionData.push(txresponse.result.hex); function(finished) {
finished(); // Get the private key for each utxo
}); client.dumpPrivKey(utxo.address, function(err, privresponse) {
}, if (err) {
function(finished) { throw err;
// Get the private key for each utxo }
client.dumpPrivKey(utxo.address, function(err, privresponse) { utxo.privateKeyWIF = privresponse.result;
if (err) { finished();
throw err; });
} }
utxo.privateKeyWIF = privresponse.result; ], next);
finished(); }, function(err) {
}); if (err) {
throw err;
} }
], next); done();
}, function(err) { });
if (err) {
throw err;
}
done();
}); });
}); });
}); });
}); });
}); });
}); });