WIP lots of fixes
This commit is contained in:
parent
e4a4e556a2
commit
ad65869229
4 changed files with 89 additions and 49 deletions
|
|
@ -7,7 +7,7 @@ var logger = require('./logger');
|
|||
|
||||
var SATOSHI_FACTOR = 1e8;
|
||||
var POLLING_RATE = 60 * 1000; // poll each minute
|
||||
var REAP_RATE = 5 * 1000;
|
||||
var REAP_RATE = 2 * 1000;
|
||||
var PENDING_TIMEOUT = 70 * 1000;
|
||||
|
||||
// TODO: might have to update this if user is allowed to extend monitoring time
|
||||
|
|
@ -53,7 +53,7 @@ function loadPlugin(name, config) {
|
|||
trader: ['balance', 'purchase', 'sell'],
|
||||
wallet: ['balance', 'sendBitcoins', 'newAddress'],
|
||||
idVerifier: ['verifyUser', 'verifyTransaction'],
|
||||
info: ['getAddressLastTx', 'getTx']
|
||||
info: ['checkAddress']
|
||||
};
|
||||
|
||||
var plugin = null;
|
||||
|
|
@ -223,8 +223,9 @@ function reapOutgoingTx(session, tx) {
|
|||
}
|
||||
|
||||
function reapIncomingTx(session, tx) {
|
||||
infoPlugin.checkAddress(tx.toAddress, function(err, status,
|
||||
infoPlugin.checkAddress(tx.toAddress, tx.satoshis, function(err, status,
|
||||
satoshisReceived, txHash) {
|
||||
if (err) return logger.error(err);
|
||||
if (status === 'notSeen') return;
|
||||
var newTx = _.clone(tx);
|
||||
newTx.txHash = txHash;
|
||||
|
|
@ -237,6 +238,7 @@ function reapIncomingTx(session, tx) {
|
|||
function reapTx(row) {
|
||||
var session = {fingerprint: row.device_fingerprint, id: row.session_id};
|
||||
var tx = {
|
||||
satoshis: row.satoshis,
|
||||
toAddress: row.to_address,
|
||||
currencyCode: row.currency_code,
|
||||
incoming: row.incoming
|
||||
|
|
@ -282,7 +284,8 @@ exports.trade = function trade(session, rawTrade, cb) {
|
|||
};
|
||||
|
||||
async.parallel([
|
||||
async.apply(db.addPendingTx, session, tx),
|
||||
async.apply(db.addOutgoingPending, session, tx.currencyCode, tx.toAddress,
|
||||
tx.satoshis),
|
||||
async.apply(db.recordBill, session, rawTrade)
|
||||
], cb);
|
||||
};
|
||||
|
|
@ -308,7 +311,6 @@ exports.cashOut = function cashOut(session, tx, cb) {
|
|||
};
|
||||
|
||||
exports.dispenseStatus = function dispenseStatus(session, cb) {
|
||||
console.log('DEBUG1');
|
||||
db.dispenseStatus(session, cb);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue