Merge branch 'release-8.6' into feat-add-aveiro-admin-ui-8.5
This commit is contained in:
commit
189aff31d7
25 changed files with 134 additions and 44 deletions
|
|
@ -117,22 +117,23 @@ function processTxStatus (tx, settings) {
|
|||
}
|
||||
|
||||
function getWalletScore (tx, pi) {
|
||||
const rejectEmpty = message => x => _.isNil(x) || _.isEmpty(x) ? Promise.reject({ message }) : x
|
||||
const statuses = ['published', 'authorized', 'confirmed']
|
||||
const rejectEmpty = message => x => _.isNil(x) || _.isEmpty(x) ? Promise.reject(new Error(message)) : x
|
||||
const statuses = ['published', 'authorized', 'confirmed', 'insufficientFunds']
|
||||
|
||||
if (_.includes(tx.status, statuses) && _.isNil(tx.walletScore))
|
||||
if (!_.includes(tx.status, statuses) || !_.isNil(tx.walletScore)) {
|
||||
return tx
|
||||
}
|
||||
|
||||
// Transaction shows up on the blockchain, we can request the sender address
|
||||
// Transaction shows up on the blockchain, we can request the sender address
|
||||
return pi.isWalletScoringEnabled(tx)
|
||||
.then(isEnabled => {
|
||||
if (!isEnabled) return tx
|
||||
return pi.getTransactionHash(tx)
|
||||
.then(rejectEmpty("No transaction hashes"))
|
||||
.then(rejectEmpty('No transaction hashes'))
|
||||
.then(txHashes => pi.getInputAddresses(tx, txHashes))
|
||||
.then(rejectEmpty("No input addresses"))
|
||||
.then(rejectEmpty('No input addresses'))
|
||||
.then(addresses => Promise.all(_.map(it => pi.rateWallet(tx.cryptoCode, it), addresses)))
|
||||
.then(rejectEmpty("No score ratings"))
|
||||
.then(rejectEmpty('No score ratings'))
|
||||
.then(_.maxBy(_.get(['score'])))
|
||||
.then(highestScore =>
|
||||
// Conservatively assign the highest risk of all input addresses to the risk of this transaction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue