fix partial_send reporting for timeout

This commit is contained in:
Josh Harvey 2014-11-28 00:03:12 -05:00
parent ad65869229
commit cb11552c11
2 changed files with 35 additions and 31 deletions

View file

@ -194,17 +194,18 @@ function _sendBitcoins(toAddress, satoshis, cb) {
}
function executeTx(session, tx, authority, cb) {
db.addOutgoingTx(session, tx, function(err, satoshisToSend) {
db.addOutgoingTx(session, tx, function(err, toSend) {
if (err) return cb(err);
var satoshisToSend = toSend.satoshis;
if (satoshisToSend === 0)
return cb(null, {statusCode: 204, txId: tx.txId, txHash: null});
_sendBitcoins(tx.toAddress, satoshisToSend, function(_err, txHash) {
var fee = null; // Need to fill this out in plugins
db.sentCoins(session, tx, authority, satoshisToSend, fee, _err, txHash);
if (_err) toSend = {satoshis: 0, fiat: 0};
db.sentCoins(session, tx, authority, toSend, fee, _err, txHash);
if (_err) return cb(err);
if (_err) return cb(_err);
pollBalance();
cb(null, {
@ -238,6 +239,7 @@ function reapIncomingTx(session, tx) {
function reapTx(row) {
var session = {fingerprint: row.device_fingerprint, id: row.session_id};
var tx = {
fiat: 0,
satoshis: row.satoshis,
toAddress: row.to_address,
currencyCode: row.currency_code,