Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Coinstatsindex functionality #19

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion assets/compat/bitcoin.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ zmqpubsequence=tcp://0.0.0.0:28333
txindex=1
}}

## COINSTATSINDEX
{{#IF coinstatsindex
coinstatsindex=1
}}

## DATACARRIER
{{#IF blkconstr.datacarrier
datacarrier=1
Expand Down Expand Up @@ -219,4 +224,4 @@ blockmaxsize={{advanced.templateconstruction.blockmaxsize}}

{{#IF advanced.templateconstruction.blockmaxweight
blockmaxweight={{advanced.templateconstruction.blockmaxweight}}
}}
}}
8 changes: 8 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,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."
Expand Down
28 changes: 28 additions & 0 deletions scripts/services/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,32 @@ export const action = {
},
};
},
async "delete-coinstatsindex"(
effect: T.Effects,
_input?: T.Config,
): Promise<T.ResultType<T.ActionResult>> {
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,
},
};
},
};
6 changes: 6 additions & 0 deletions scripts/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => {
description: "Enable the Transaction Index (txindex)",
default: allowUnpruned,
},
coinstatsindex: {
type: "boolean",
name: "Coinstats Index",
description: "Enabling Coinstats Index reduces the time for the gettxoutsetinfo RPC to complete at the cost of using additional disk space",
default: false,
},
wallet: {
type: "object",
name: "Wallet",
Expand Down
9 changes: 9 additions & 0 deletions scripts/services/setConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ 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 ||
Expand Down