diff --git a/README.md b/README.md index 9176cb5..1cf4b78 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ See [CHANGELOG.md](/CHANGELOG.md). ### Note about pruning and indexing configurations -This tool is designed to work best with full transaction indexing enabled (`txindex=1`) and pruning **disabled**. Running Bitcoin Core *without* `txindex` enabled and/or *with* `pruning` enabled works, but some data will be incomplete or missing. Also note that such Bitcoin Core configurations receive less thorough testing. +This tool is designed to work best with full transaction indexing enabled (`txindex=1`) and pruning **disabled**. +However, if you're running Bitcoin Core v0.21+ you can run *without* `txindex` enabled and/or *with* `pruning` enabled and this tool will continue to function, but some data will be incomplete or missing. Also note that such Bitcoin Core configurations receive less thorough testing. In particular, with `pruning` enabled and/or `txindex` disabled, the following functionality is altered: diff --git a/app.js b/app.js index 5e06c5d..bdf03ab 100755 --- a/app.js +++ b/app.js @@ -276,6 +276,11 @@ function onRpcConnectionVerified(getnetworkinfo, getblockchaininfo, getindexinfo if (getindexinfo.txindex) { global.txindexAvailable = true; + + } else if (getindexinfo.minRpcVersionNeeded) { + // here we ASSUME that txindex is available because we're targeting pre-v0.21 + // and docs specify that txindex is necessary for pre-v0.21 nodes + global.txindexAvailable = true; } if (getblockchaininfo.pruned) { diff --git a/app/api/rpcApi.js b/app/api/rpcApi.js index 68e51a5..5e29e4c 100644 --- a/app/api/rpcApi.js +++ b/app/api/rpcApi.js @@ -26,7 +26,10 @@ const rpcQueue = async.queue(function(task, callback) { }, config.rpcConcurrency); -const minRpcVersions = {getblockstats:"0.17.0"}; +const minRpcVersions = { + getblockstats: "0.17.0", + getindexinfo: "0.21.0" +}; global.rpcStats = {}; @@ -64,7 +67,13 @@ function getMiningInfo() { } function getIndexInfo() { - return getRpcData("getindexinfo"); + if (semver.gte(global.btcNodeSemver, minRpcVersions.getindexinfo)) { + return getRpcData("getindexinfo"); + + } else { + // unsupported + return unsupportedPromise(minRpcVersions.getindexinfo); + } } function getUptimeSeconds() { @@ -282,7 +291,7 @@ async function noTxIndexTransactionLookup(txid, walletOnly) { var blockhash = await electrumAddressApi.lookupTxBlockHash(txid); return await getRawTransaction(txid, blockhash); - + } catch (err) { debugLog(`Electrs blockhash lookup failed for ${txid}:`, err); }