|
|
@ -260,19 +260,21 @@ class RemoteImporter { |
|
|
|
|
|
|
|
Logger.info(` Got ${scanTx.length} transactions`) |
|
|
|
|
|
|
|
await util.seriesCall(scanTx, async txid => { |
|
|
|
try { |
|
|
|
const tx = await rpcTxns.getTransaction(txid, false) |
|
|
|
if (tx == null) { |
|
|
|
Logger.info(` got null for ${txid}`) |
|
|
|
return null |
|
|
|
// Retrieve the transactions by batches of 100 transactions
|
|
|
|
const txsChunks = util.splitList(scanTx, 100) |
|
|
|
try { |
|
|
|
for (let txsChunk of txsChunks) { |
|
|
|
const txs = await rpcTxns.getTransactions(txsChunk, false) |
|
|
|
for (let tx of txs) { |
|
|
|
if (tx != null) { |
|
|
|
ret.transactions.push(tx) |
|
|
|
txids[tx.txid] = true |
|
|
|
} |
|
|
|
} |
|
|
|
ret.transactions.push(tx) |
|
|
|
txids[tx.txid] = true |
|
|
|
} catch(e) { |
|
|
|
Logger.error(e, `RemoteImporter.xpubScan() : rawTransaction error, txid ${txid}`) |
|
|
|
} |
|
|
|
}) |
|
|
|
} catch(e) { |
|
|
|
Logger.error(e, `RemoteImporter.xpubScan() : getTransactions error`) |
|
|
|
} |
|
|
|
|
|
|
|
if (gotTransactions) { |
|
|
|
// We must go deeper
|
|
|
@ -335,15 +337,14 @@ class RemoteImporter { |
|
|
|
|
|
|
|
Logger.info(` Got ${scanTx.length} transactions`) |
|
|
|
|
|
|
|
// Get transaction s data from bitcoind
|
|
|
|
await util.seriesCall(scanTx, async txid => { |
|
|
|
const tx = await rpcTxns.getTransaction(txid, false) |
|
|
|
if (tx == null) { |
|
|
|
Logger.info(` got null for ${txid}`) |
|
|
|
return null |
|
|
|
} |
|
|
|
txns.push(tx) |
|
|
|
}) |
|
|
|
// Retrieve the transactions by batches of 100 transactions
|
|
|
|
const txsChunks = util.splitList(scanTx, 100) |
|
|
|
for (let txsChunk of txsChunks) { |
|
|
|
const txs = await rpcTxns.getTransactions(txsChunk, false) |
|
|
|
for (let tx of txs) |
|
|
|
if (tx != null) |
|
|
|
txns.push(tx) |
|
|
|
} |
|
|
|
|
|
|
|
// Import addresses and transactions into the database
|
|
|
|
await db.addAddresses(imported) |
|
|
|