feat(dualWay): WIP; new plugin type and initial sell structure chunks added

This commit is contained in:
Damian Mee 2014-11-09 04:33:01 +01:00
parent 54e7565d3f
commit 0c0fb74dcd
3 changed files with 92 additions and 28 deletions

View file

@ -156,6 +156,7 @@ exports.insertTx = function insertTx(deviceFingerprint, tx, cb) {
var fields = [
'id',
'status',
'tx_type',
'device_fingerprint',
'to_address',
'satoshis',
@ -166,6 +167,7 @@ exports.insertTx = function insertTx(deviceFingerprint, tx, cb) {
var values = [
tx.txId,
tx.status || 'pending',
tx.tx_type || 'buy',
deviceFingerprint,
tx.toAddress,
tx.satoshis,
@ -219,20 +221,19 @@ exports.changeTxStatus = function changeTxStatus(txId, newStatus, data, cb) {
values.push(data.error);
}
if (newStatus === 'completed') {
// set tx_hash (if available)
if (typeof data.hash !== 'undefined') {
query += ', tx_hash=$' + n++;
values.push(data.hash);
}
// indicates if tx was finished by a `/send` call (and not timeout)
if (typeof data.is_completed !== 'undefined') {
query += ', is_completed=$' + n++;
values.push(data.is_completed);
}
// set tx_hash (if available)
if (typeof data.hash !== 'undefined') {
query += ', tx_hash=$' + n++;
values.push(data.hash);
}
// indicates if tx was finished by a `/send` call (and not timeout)
if (typeof data.is_completed !== 'undefined') {
query += ', is_completed=$' + n++;
values.push(data.is_completed);
}
query += ' WHERE id=$' + n++;
values.push(txId);