refactor(tx): transaction(s) changed to tx(s)

This commit is contained in:
Damian Mee 2014-09-20 18:52:29 +02:00
parent 55abaa1bb9
commit 5a78376ad5
3 changed files with 16 additions and 14 deletions

View file

@ -90,7 +90,7 @@ exports.recordDeviceEvent = function recordDeviceEvent(deviceFingerprint, event,
cb);
};
function _getTransactions(txId, onlyPending, cb) {
function _getTxs(txId, onlyPending, cb) {
var query = 'SELECT * FROM transactions WHERE id=$1';
var values = [txId];
@ -110,8 +110,8 @@ function _getTransactions(txId, onlyPending, cb) {
}
// returns complete [txs]
exports.getTransactions = function getTransactions(txId, cb) {
_getTransactions(txId, false, cb);
exports.getTxs = function getTxs(txId, cb) {
_getTxs(txId, false, cb);
};
exports.getPendingAmount = function getPendingAmount(txId, cb) {
@ -162,14 +162,16 @@ exports.getPendingAmount = function getPendingAmount(txId, cb) {
}
// Nothing to send == nothing to do
if (newTx.satoshis <= 0)
if (newTx.satoshis <= 0) {
logger.error('Negative tx amount (%d) for txId: %s', newTx.satoshis, txId);
return cb();
}
cb(null, newTx);
});
};
exports.summonTransaction = function summonTransaction(deviceFingerprint, tx, cb) {
exports.summonTx = function summonTx(deviceFingerprint, tx, cb) {
var fields = [
'id',
'status',
@ -202,7 +204,7 @@ exports.summonTransaction = function summonTransaction(deviceFingerprint, tx, cb
function(err) {
if (err) {
if (PG_ERRORS[err.code] === 'uniqueViolation')
return _getTransactions(tx.txId, false, cb);
return _getTxs(tx.txId, false, cb);
return cb(err);
}