diff --git a/dev/double-spend-scenario.js b/dev/double-spend-scenario.js index 73e112c3..eef96ccb 100644 --- a/dev/double-spend-scenario.js +++ b/dev/double-spend-scenario.js @@ -28,13 +28,21 @@ db.addOutgoingTx(session, tx, function (err, res) { console.log(res) }) +db.addOutgoingTx(session, tx2, function (err, res) { + console.log('DEBUG2') + console.log(err) + console.log(res) +}) + +/* setTimeout(function () { db.addOutgoingTx(session, tx2, function (err, res) { console.log('DEBUG2') console.log(err) console.log(res) }) -}, 1000) +}, 0) +*/ var bills = { uuid: 'c630338c-cd03-11e5-a9df-dbc9be2e9fbb', diff --git a/lib/postgresql_interface.js b/lib/postgresql_interface.js index 86935f2b..ca58093d 100644 --- a/lib/postgresql_interface.js +++ b/lib/postgresql_interface.js @@ -181,7 +181,6 @@ function billsAndTxs(client, session, cb) { } function computeSendAmount(tx, totals) { - console.log('DEBUG10') var fiatRemaining = (tx.fiat || totals.billsFiat) - totals.txFiat; var satoshisRemaining = (tx.satoshis || totals.billsSatoshis) - totals.txSatoshis; @@ -304,8 +303,6 @@ function insertTx(client, session, incoming, tx, satoshis, fiat, stage, tx.error ]; - console.log('DEBUG11') - query(client, getInsertQuery('transactions', fields, true), values, function(err, results) { if (err) return cb(err); @@ -350,7 +347,7 @@ exports.addOutgoingTx = function addOutgoingTx(session, tx, cb) { if (cerr) return cb(cerr); async.series([ async.apply(silentQuery, client, 'BEGIN'), - async.apply(silentQuery, client, 'LOCK TABLE transactions NOWAIT'), + async.apply(silentQuery, client, 'LOCK TABLE transactions'), async.apply(insertOutgoingCompleteTx, client, session, tx), async.apply(removePendingTx, client, session), async.apply(buildOutgoingTx, client, session, tx)