From fa58a0764c3dc85e67fbdaaa52381af7dc3bd238 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 21 Oct 2021 21:04:11 -0700 Subject: [PATCH] fix(Transaction.get()): Validating SLP inputs --- src/transaction.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/transaction.js b/src/transaction.js index 8200e76..edc1372 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -112,7 +112,16 @@ class Transaction { // ) let tokenQty = 0 - if (inTokenData.txType === 'SEND') { + + // Validate the input. Mark qty as null if not valid. + const vinIsValid = await this.slpUtils.waterfallValidateTxid( + thisVin.txid + ) + + if (!vinIsValid) { + // If the input is not a valid, then set qty as null. + tokenQty = null + } else if (inTokenData.txType === 'SEND') { // Get the appropriate vout token amount. This may throw an error, // which means this Vin is not actually a token UTXO, it was just // associated with a previous token TX.