diff --git a/assets/compat/bitcoin.conf.template b/assets/compat/bitcoin.conf.template index ce15655..3bbf6be 100644 --- a/assets/compat/bitcoin.conf.template +++ b/assets/compat/bitcoin.conf.template @@ -120,6 +120,11 @@ zmqpubsequence=tcp://0.0.0.0:28333 txindex=1 }} +## COINSTATSINDEX +{{#IF coinstatsindex +coinstatsindex=1 +}} + ## BIP37 {{#IF advanced.bloomfilters.peerbloomfilters peerbloomfilters=1 diff --git a/manifest.yaml b/manifest.yaml index db0408b..24f4e59 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -157,6 +157,14 @@ actions: - stopped implementation: type: script + delete-coinstatsindex: + name: "Delete Coinstats Index" + description: "Deletes the Coinstats Index (coinstatsindex) in case it gets corrupted." + warning: The Coinstats Index will be rebuilt once Bitcoin Core is started again, unless you deactivate it in the config settings. Please don't do this unless instructed to by Start9 support staff. + allowed-statuses: + - stopped + implementation: + type: script delete-peers: name: "Delete Peer List" description: "Deletes the Peer List (peers.dat) in case it gets corrupted." diff --git a/scripts/services/action.ts b/scripts/services/action.ts index 2459b12..1697ee7 100644 --- a/scripts/services/action.ts +++ b/scripts/services/action.ts @@ -57,4 +57,32 @@ export const action = { }, }; }, + async "delete-coinstatsindex"( + effect: T.Effects, + _input?: T.Config, + ): Promise> { + const coinstatsinfoLocation = { + path: "indexes/coinstats", + volumeId: "main", + }; + if (await util.exists(effect, coinstatsinfoLocation) === false) { + return { + result: { + copyable: false, + message: "coinstatsindex doesn't exist", + version: "0", + qr: false, + }, + }; + } + await effect.removeDir(coinstatsinfoLocation); + return { + result: { + copyable: false, + message: "Deleted coinstatsindex", + version: "0", + qr: false, + }, + }; + }, }; diff --git a/scripts/services/getConfig.ts b/scripts/services/getConfig.ts index 29a79e6..62cb919 100644 --- a/scripts/services/getConfig.ts +++ b/scripts/services/getConfig.ts @@ -130,6 +130,12 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => { description: "Enable the Transaction Index (txindex)", default: allowUnpruned, }, + coinstatsindex: { + type: "boolean", + name: "Coinstats Index", + description: "Enable the Coinstats Index (coinstatsindex)", + default: false, + }, wallet: { type: "object", name: "Wallet", diff --git a/scripts/services/setConfig.ts b/scripts/services/setConfig.ts index 5917c61..ced7808 100644 --- a/scripts/services/setConfig.ts +++ b/scripts/services/setConfig.ts @@ -23,6 +23,13 @@ export const setConfig: types.ExpectedExports.setConfig = async ( error: "Txindex not allowed on pruned nodes.", }; } + if ( + !(!newConfig.coinstatsindex || (newConfig.advanced?.pruning?.mode === "disabled")) + ) { + return { + error: "Coinstats index not allowed on pruned nodes.", + }; + } // true, false only fail case if ( !(!newConfig.advanced.blockfilters.peerblockfilters || @@ -81,7 +88,7 @@ export const setConfig: types.ExpectedExports.setConfig = async ( } else { effects.debug("No reindex required"); } - + await effects.writeFile({ path: "start9/config.yaml", toWrite: YAML.stringify(newConfig),