diff --git a/lib/cash-out/cash-out-tx.js b/lib/cash-out/cash-out-tx.js index cf52bac9..4abf18ea 100644 --- a/lib/cash-out/cash-out-tx.js +++ b/lib/cash-out/cash-out-tx.js @@ -124,21 +124,12 @@ function getWalletScore (tx, pi) { if (_.includes(tx.status, statuses) && _.isNil(tx.walletScore)) { // Transaction shows up on the blockchain, we can request the sender address return pi.getTransactionHash(tx) - .catch(err => { - console.log(`** DEBUG ** getTransactionHash ERROR: ${err}`) - }) .then(txHashes => pi.getInputAddresses(tx, txHashes)) - .catch(err => { - console.log(`** DEBUG ** getInputAddresses ERROR: ${err.message}`) - }) .then(addresses => { const addressesPromise = [] _.forEach(it => addressesPromise.push(pi.rateWallet(tx.cryptoCode, it)), addresses) return Promise.all(addressesPromise) }) - .catch(err => { - console.log(`** DEBUG ** rateWallet ERROR: ${err.message}`) - }) .then(scores => { if (_.isNil(scores) || _.isEmpty(scores)) return tx const highestScore = _.maxBy(it => it.score, scores) diff --git a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js index 6fae11a1..b6416b82 100644 --- a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js +++ b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js @@ -34,6 +34,14 @@ function rateWallet (account, cryptoCode, address) { headers: authHeader }) .then(res => ({ address, score: res.data.risk, isValid: res.data.risk < threshold })) + .then(result => { + console.log(`** DEBUG ** rateWallet RETURN: ${result}`) + return result + }) + .catch(err => { + console.log(`** DEBUG ** rateWallet ERROR: ${err.message}`) + throw err + }) } function isValidWalletScore (account, score) { @@ -60,8 +68,13 @@ function getTransactionHash (account, cryptoCode, receivingAddress) { if (_.size(data.txHistory) > 1) { logger.warn('An address generated by this wallet was used in more than one transaction') } + console.log(`** DEBUG ** getTransactionHash RETURN: ${_.join(', ', _.map(it => it.txHash, data.txHistory))}`) return _.join(', ', _.map(it => it.txHash, data.txHistory)) }) + .catch(err => { + console.log(`** DEBUG ** getTransactionHash ERROR: ${err}`) + throw err + }) } function getInputAddresses (account, cryptoCode, txHashes) { @@ -84,8 +97,14 @@ function getInputAddresses (account, cryptoCode, txHashes) { const transactionInputs = _.flatMap(it => it.inputs, data.transactions) const inputAddresses = _.map(it => it.address, transactionInputs) + console.log(`** DEBUG ** getInputAddresses RETURN: ${inputAddresses}`) + return inputAddresses }) + .catch(err => { + console.log(`** DEBUG ** getInputAddresses ERROR: ${err.message}`) + throw err + }) } module.exports = {