Skip to content

Commit

Permalink
floBlockchainAPI v3.0.1b - bug fix
Browse files Browse the repository at this point in the history
- Fixed: vin address at .addresses[0] not .scriptSig.addresses[0]
  • Loading branch information
sairajzero committed Jul 5, 2023
1 parent e120b65 commit 904deaa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions floBlockchainAPI.js
@@ -1,4 +1,4 @@
(function (EXPORTS) { //floBlockchainAPI v3.0.1a
(function (EXPORTS) { //floBlockchainAPI v3.0.1b
/* FLO Blockchain Operator to send/receive data from blockchain using API calls via FLO Blockbook*/
'use strict';
const floBlockchainAPI = EXPORTS;
Expand Down Expand Up @@ -910,9 +910,9 @@
if (!tx.confirmations) //unconfirmed transactions: this should not happen as we send mempool=false in API query
return false;

if (options.sentOnly && !tx.vin.some(vin => vin.scriptSig.addresses[0] === addr))
if (options.sentOnly && !tx.vin.some(vin => vin.addresses[0] === addr))
return false;
else if (Array.isArray(options.senders) && !tx.vin.some(vin => options.senders.includes(vin.scriptSig.addresses[0])))
else if (Array.isArray(options.senders) && !tx.vin.some(vin => options.senders.includes(vin.addresses[0])))
return false;

if (options.receivedOnly && !tx.vout.some(vout => vout.scriptPubKey.addresses[0] === addr))
Expand All @@ -938,7 +938,7 @@
txid: tx.txid,
time: tx.time,
blockheight: tx.blockheight,
senders: new Set(tx.vin.map(v => v.scriptSig.addresses[0])),
senders: new Set(tx.vin.map(v => v.addresses[0])),
receivers: new Set(tx.vout.map(v => v.scriptPubKey.addresses[0])),
data: tx.floData
} : tx.floData);
Expand Down Expand Up @@ -996,9 +996,9 @@
if (!tx.confirmations) //unconfirmed transactions: this should not happen as we send mempool=false in API query
return false;

if (options.sentOnly && !tx.vin.some(vin => vin.scriptSig.addresses[0] === addr))
if (options.sentOnly && !tx.vin.some(vin => vin.addresses[0] === addr))
return false;
else if (Array.isArray(options.senders) && !tx.vin.some(vin => options.senders.includes(vin.scriptSig.addresses[0])))
else if (Array.isArray(options.senders) && !tx.vin.some(vin => options.senders.includes(vin.addresses[0])))
return false;

if (options.receivedOnly && !tx.vout.some(vout => vout.scriptPubKey.addresses[0] === addr))
Expand All @@ -1017,7 +1017,7 @@
txid: item.txid,
time: item.time,
blockheight: item.blockheight,
senders: new Set(item.vin.map(v => v.scriptSig.addresses[0])),
senders: new Set(item.vin.map(v => v.addresses[0])),
receivers: new Set(item.vout.map(v => v.scriptPubKey.addresses[0])),
data: item.floData
}
Expand Down

0 comments on commit 904deaa

Please sign in to comment.