add digitalTx
This commit is contained in:
parent
8cf5f2a453
commit
408e4b59d5
1 changed files with 13 additions and 6 deletions
|
|
@ -258,9 +258,17 @@ exports.addTx = function addTx(deviceFingerprint, tx, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.addDigitalTx = function addDigitalTx(dbTxId, err, txHash, fee) {
|
exports.addDigitalTx = function addDigitalTx(dbTxId, err, txHash) {
|
||||||
console.log('DEBUG: adding digitaltx');
|
var keys = ['transaction_id', 'tx_hash', 'error'];
|
||||||
console.dir([dbTxId, err, txHash, fee]);
|
var values = [dbTxId, txHash, err && err.message];
|
||||||
|
var sql = getInsertQuery('digital_transactions', keys);
|
||||||
|
|
||||||
|
connect(function(err, client, done) {
|
||||||
|
query(client, sql, values, function(_err) {
|
||||||
|
done(_err);
|
||||||
|
if (_err) logger.error(_err);
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -280,12 +288,11 @@ exports.fillCartridges =
|
||||||
client.query(query, [cartridge1, cartridge2, fingerprint], cb);
|
client.query(query, [cartridge1, cartridge2, fingerprint], cb);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
/* DEBUG
|
|
||||||
exports.init('psql://lamassu:lamassu@localhost/lamassu');
|
exports.init('psql://lamassu:lamassu@localhost/lamassu');
|
||||||
|
|
||||||
var fp = 'AB:9C:09:AA:7B:48:51:9A:0E:13:59:4E:5E:69:D0:74:E5:0F:4A:66';
|
var fp = 'AB:9C:09:AA:7B:48:51:9A:0E:13:59:4E:5E:69:D0:74:E5:0F:4A:66';
|
||||||
var txId = '5ef9c631-d948-4f0f-bf22-d2a563f5cd26';
|
var txId = '5ef9c631-d948-4f0f-bf22-d2a563f5cd26';
|
||||||
var tx = {txId: txId, currencyCode: 'USD', toAddress: '1xxx'};
|
var tx = {txId: txId, currencyCode: 'USD', toAddress: '1xxx'};
|
||||||
exports.addTx(fp, tx, function(err, result) { pg.end(); console.dir(result); });
|
exports.addDigitalTx(198, new Error('insufficient funds'), null, function(err, result) { pg.end(); console.dir(result); });
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue