parent
bf91825495
commit
142ef12bd6
1 changed files with 22 additions and 6 deletions
|
|
@ -121,7 +121,7 @@ function loadOrConfigPlugin(pluginHandle, pluginType, currency,
|
||||||
pluginHandle = loadPlugin(currentName, pluginConfig);
|
pluginHandle = loadPlugin(currentName, pluginConfig);
|
||||||
currentlyUsedPlugins[pluginType] = currentName
|
currentlyUsedPlugins[pluginType] = currentName
|
||||||
logger.debug('plugin(%s) loaded: %s', pluginType, pluginHandle.NAME ||
|
logger.debug('plugin(%s) loaded: %s', pluginType, pluginHandle.NAME ||
|
||||||
currentName);
|
currentName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,7 +286,7 @@ function reapTxs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Run these in parallel and return success
|
// TODO: Run these in parallel and return success
|
||||||
exports.trade = function trade (session, rawTrade, cb) {
|
exports.trade = function trade(session, rawTrade, cb) {
|
||||||
|
|
||||||
// TODO: move this to DB, too
|
// TODO: move this to DB, too
|
||||||
// add bill to trader queue (if trader is enabled)
|
// add bill to trader queue (if trader is enabled)
|
||||||
|
|
@ -294,12 +294,28 @@ exports.trade = function trade (session, rawTrade, cb) {
|
||||||
tradesQueue.push({
|
tradesQueue.push({
|
||||||
currency: rawTrade.currency,
|
currency: rawTrade.currency,
|
||||||
satoshis: rawTrade.satoshis
|
satoshis: rawTrade.satoshis
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rawTrade.toAddress) rawTrade.toAddress = 'remit'
|
if (!rawTrade.toAddress) {
|
||||||
return db.recordBill(session, rawTrade, cb)
|
var newRawTrade = _.cloneDeep(rawTrade);
|
||||||
}
|
newRawTrade.toAddress = 'remit';
|
||||||
|
return db.recordBill(session, newRawTrade, cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
var tx = {
|
||||||
|
txId: rawTrade.txId,
|
||||||
|
fiat: 0,
|
||||||
|
satoshis: 0,
|
||||||
|
toAddress: rawTrade.toAddress,
|
||||||
|
currencyCode: rawTrade.currency
|
||||||
|
};
|
||||||
|
|
||||||
|
async.parallel([
|
||||||
|
async.apply(db.addOutgoingPending, session, tx.currencyCode, tx.toAddress),
|
||||||
|
async.apply(db.recordBill, session, rawTrade)
|
||||||
|
], cb);
|
||||||
|
};
|
||||||
|
|
||||||
exports.sendBitcoins = function sendBitcoins(session, rawTx, cb) {
|
exports.sendBitcoins = function sendBitcoins(session, rawTx, cb) {
|
||||||
executeTx(session, rawTx, 'machine', cb);
|
executeTx(session, rawTx, 'machine', cb);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue