migration fix + removed some old incoming checking

This commit is contained in:
Josh Harvey 2015-01-08 23:11:03 -05:00
parent d9a9c9f4eb
commit 71aa425dd1
5 changed files with 20 additions and 53 deletions

View file

@ -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 ' +