testing/fixing
This commit is contained in:
parent
59e93445ec
commit
1df6fe6ed1
5 changed files with 77 additions and 67 deletions
|
|
@ -338,9 +338,8 @@ function reapTxs () {
|
|||
|
||||
// NOTE: No harm in processing old pending tx, we don't need to wait for
|
||||
// removeOldPending to complete.
|
||||
db.pendingTxs(PENDING_TIMEOUT, function (err, results) {
|
||||
db.pendingTxs(PENDING_TIMEOUT, function (err, rows) {
|
||||
if (err) return logger.warn(err)
|
||||
var rows = results.rows
|
||||
var rowCount = rows.length
|
||||
for (var i = 0; i < rowCount; i++) {
|
||||
var row = rows[i]
|
||||
|
|
@ -446,8 +445,11 @@ function processTxStatus (tx) {
|
|||
const cryptoCode = tx.cryptoCode
|
||||
const walletPlugin = walletPlugins[cryptoCode]
|
||||
|
||||
walletPlugin.getStatus(tx, function (err, status) {
|
||||
walletPlugin.getStatus(tx.toAddress, tx.cryptoAtoms, function (err, res) {
|
||||
if (err) return logger.error(err)
|
||||
console.log('DEBUG5')
|
||||
console.log(res)
|
||||
var status = res.status
|
||||
if (tx.status === status) return
|
||||
db.updateTxStatus(tx, status, function (_err) {
|
||||
if (_err) return logger.error(err)
|
||||
|
|
@ -464,7 +466,7 @@ function monitorLiveIncoming () {
|
|||
}
|
||||
|
||||
function monitorIncoming () {
|
||||
const statuses = ['notSeen', 'published', 'zeroConf', 'authorized', 'rejected']
|
||||
const statuses = ['notSeen', 'published', 'authorized', 'instant', 'rejected']
|
||||
db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE, function (err, txs) {
|
||||
if (err) return
|
||||
txs.forEach(processTxStatus)
|
||||
|
|
@ -758,10 +760,7 @@ exports.getPhoneCode = function getPhoneCode (phone) {
|
|||
}
|
||||
|
||||
exports.updatePhone = function updatePhone (session, tx) {
|
||||
db.addIncomingPhone(session, tx, err => {
|
||||
if (err) return Promise.reject(err)
|
||||
return Promise.resolve()
|
||||
})
|
||||
return db.addIncomingPhone(session, tx)
|
||||
}
|
||||
|
||||
exports.fetchPhoneTx = function fetchPhoneTx (phone) {
|
||||
|
|
@ -781,16 +780,8 @@ exports.fetchPhoneTx = function fetchPhoneTx (phone) {
|
|||
})
|
||||
}
|
||||
|
||||
exports.fetchTx = function fetchTx (session, status) {
|
||||
exports.fetchTx = function fetchTx (session) {
|
||||
return db.fetchTx(session)
|
||||
.then(txRecs => {
|
||||
const deposits = txRecs.filter(t => t.stage === 'deposit')
|
||||
const deposit = R.last(deposits)
|
||||
const status = deposit ? deposit.authority : 'notSeen'
|
||||
const tx = txRecs.find(t => t.stage === 'initial_request')
|
||||
if (!tx) return null
|
||||
return R.assoc('status', status, tx)
|
||||
})
|
||||
}
|
||||
|
||||
exports.requestDispense = function requestDispense (session, tx) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue