migration fix + removed some old incoming checking
This commit is contained in:
parent
d9a9c9f4eb
commit
71aa425dd1
5 changed files with 20 additions and 53 deletions
|
|
@ -403,40 +403,6 @@ exports.sentCoins = function sentCoins(session, tx, authority, toSend, fee,
|
|||
});
|
||||
};
|
||||
|
||||
function maybeRemovePending(client, session, insufficientFunds, authority, cb) {
|
||||
|
||||
// Keep waiting for authorization, unless deposit is insufficient
|
||||
if (authority === 'published' && !insufficientFunds) return cb();
|
||||
|
||||
removePendingTx(client, session, cb);
|
||||
}
|
||||
|
||||
exports.addIncomingTx = function addIncomingTx(session, tx, authority,
|
||||
satoshisReceived, cb) {
|
||||
|
||||
connect(function(cerr, client, done) {
|
||||
if (cerr) return cb(cerr);
|
||||
var satoshisRequested = tx.satoshis;
|
||||
var insufficientFunds = satoshisReceived < satoshisRequested;
|
||||
async.series([
|
||||
async.apply(silentQuery, client, 'BEGIN', null),
|
||||
async.apply(maybeRemovePending, client, session, insufficientFunds,
|
||||
authority),
|
||||
async.apply(insertIncoming, client, session, tx, satoshisReceived, 0,
|
||||
'deposit', authority)
|
||||
], function(err) {
|
||||
if (err) {
|
||||
rollback(client, done);
|
||||
return cb(err);
|
||||
}
|
||||
silentQuery(client, 'COMMIT', null, function() {
|
||||
done();
|
||||
cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function ensureNotFinal(client, session, cb) {
|
||||
var sql = 'SELECT id FROM transactions ' +
|
||||
'WHERE device_fingerprint=$1 AND session_id=$2 AND incoming=$3 ' +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue