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

full policy customisation #3

Merged
merged 2 commits into from
Aug 27, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/buildService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_dispatch:
pull_request:
paths-ignore: ['*.md']
branches: ['main', 'master', 'knots', 'knots-for-community']
branches: ['main', 'master', 'knots', 'knots-for-community', 'new-config']
push:
paths-ignore: ['*.md']
branches: ['main', 'master', 'knots', 'knots-for-community']
branches: ['main', 'master', 'knots', 'knots-for-community', 'new-config']

jobs:
BuildPackage:
Expand Down
66 changes: 57 additions & 9 deletions assets/compat/bitcoin.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
## RPC
{{#IF rpc.enable
{{#IF advanced.pruning.mode = "automatic"
{{#IF !advanced.testnet
rpcbind=127.0.0.1:18332
rpcallowip=127.0.0.1/32
}}
}}
{{#IF advanced.pruning.mode != "automatic"
{{#IF !advanced.testnet
rpcbind=0.0.0.0:8332
rpcallowip=0.0.0.0/0
}}
}}
}}
rpcuser={{rpc.username}}
rpcpassword={{rpc.password}}
{{#FOREACH rpc.advanced.auth
Expand Down Expand Up @@ -41,8 +45,10 @@ mempoolexpiry={{advanced.mempool.mempoolexpiry}}
## PEERS
{{#IF advanced.peers.listen
listen=1
{{#IF !advanced.testnet
bind=0.0.0.0:8333
}}
}}
{{#IF !advanced.peers.listen
listen=0
}}
Expand Down Expand Up @@ -121,36 +127,36 @@ txindex=1
}}

## DATACARRIER
{{#IF datacarrier
{{#IF blkconstr.datacarrier
datacarrier=1
}}
{{#IF !datacarrier
{{#IF !blkconstr.datacarrier
datacarrier=0
}}

datacarriersize={{datacarriersize}}
datacarriersize={{blkconstr.datacarriersize}}

## PERMITBAREMULTISIG
{{#IF permitbaremultisig
{{#IF blkconstr.permitbaremultisig
permitbaremultisig=1
}}
{{#IF !permitbaremultisig
{{#IF !blkconstr.permitbaremultisig
permitbaremultisig=0
}}

## REJECTPARASITES
{{#IF rejectparasites
{{#IF blkconstr.rejectparasites
rejectparasites=1
}}
{{#IF !rejectparasites
{{#IF !blkconstr.rejectparasites
rejectparasites=0
}}

## REJECTTOKENS
{{#IF rejecttokens
{{#IF blkconstr.rejecttokens
rejecttokens=1
}}
{{#IF !rejecttokens
{{#IF !blkconstr.rejecttokens
rejecttokens=0
}}

Expand All @@ -166,3 +172,45 @@ blockfilterindex=basic
{{#IF advanced.blockfilters.peerblockfilters
peerblockfilters=1
}}

## BLKCONSTR

minrelaytxfee={{blkconstr.minrelaytxfee}}

bytespersigop={{blkconstr.bytespersigop}}

bytespersigopstrict={{blkconstr.bytespersigopstrict}}

limitancestorcount={{blkconstr.limitancestorcount}}

limitancestorsize={{blkconstr.limitancestorsize}}

limitdescendantcount={{blkconstr.limitdescendantcount}}

limitdescendantsize={{blkconstr.limitdescendantsize}}

maxscriptsize={{blkconstr.maxscriptsize}}

datacarriercost={{blkconstr.datacarriercost}}

dustrelayfee={{blkconstr.dustrelayfee}}

## BAREPUBKEY
{{#IF blkconstr.permitbarepubkey
permitbarepubkey=1
}}
{{#IF !blkconstr.permitbarepubkey
permitbarepubkey=0
}}

## ACCEPTNONSTDDATACARRIER
{{#IF blkconstr.acceptnonstddatacarrier
acceptnonstddatacarrier=1
}}
{{#IF !blkconstr.acceptnonstddatacarrier
acceptnonstddatacarrier=0
}}

{{#IF advanced.testnet
testnet=1
}}
205 changes: 170 additions & 35 deletions scripts/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,170 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => {
target: "tor-address",
interface: "rpc",
},
blkconstr: {
type: "object",
name: "Template Construction",
description: "Options about standard policies and mining block templates",
spec: {
datacarrier: {
type: "boolean",
name: "Datacarrier",
description: "Relay and mine data carrier transactions",
default: true,
},
datacarriersize: {
type: "number",
nullable: false,
name: "Datacarrier Size",
description:
"Maximum size of arbitrary data to relay and mine",
range: "[0,10000]",
integral: true,
units: "bytes",
default: 42,
},
permitbaremultisig: {
type: "boolean",
name: "Permit Bare Multisig",
description: "Relay non-P2SH multisig",
default: false,
},
rejectparasites: {
type: "boolean",
name: "Reject Parasites",
description: "Reject parasite transactions",
default: true,
},
rejecttokens: {
type: "boolean",
name: "Reject Tokens",
description: "Reject tokens transactions (runes)",
default: false,
},
minrelaytxfee: {
type: "number",
nullable: false,
name: "Min Transaction Relay Fee",
description:
"Fee rates (in BTC/kB) smaller than this are considered zero fee for relaying, mining and transaction creation",
range: "[0,21000000]",
integral: true,
units: "BTC/kvB",
default: 1000,
},
bytespersigop: {
type: "number",
nullable: false,
name: "Bytes Per Sigop",
description:
"Equivalent bytes per sigop in transactions for relay and mining",
range: "[0,*)",
integral: true,
units: "bytes",
default: 20,
},
bytespersigopstrict: {
type: "number",
nullable: false,
name: "Bytes Per Sigop Strict",
description:
"Minimum bytes per sigop in transactions we relay and mine",
range: "[0,*)",
integral: true,
units: "bytes",
default: 20,
},
limitancestorcount: {
type: "number",
nullable: false,
name: "Max Ancestor Count",
description:
"Do not accept transactions if number of in-mempool ancestors is <n> or more",
range: "[0,*)",
integral: true,
units: undefined,
default: 25,
},
limitancestorsize: {
type: "number",
nullable: false,
name: "Max Ancestor Size",
description:
"Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes",
range: "[0,*)",
integral: true,
units: "kB",
default: 101,
},
limitdescendantcount: {
type: "number",
nullable: false,
name: "Max descendants count",
description:
"Do not accept transactions if any ancestor would have <n> or more in-mempool descendants",
range: "[0,*)",
integral: true,
units: undefined,
default: 25,
},
limitdescendantsize: {
type: "number",
nullable: false,
name: "Max descendants size",
description:
"Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants",
range: "[0,*)",
integral: true,
units: "kB",
default: 101,
},
permitbarepubkey: {
type: "boolean",
name: "Permit Bare Pubkey",
description: "Relay legacy pubkey outputs",
default: false,
},
maxscriptsize: {
type: "number",
nullable: false,
name: "Max Script Size",
description:
"Maximum size of scripts we relay and mine, in bytes",
range: "[0,*)",
integral: true,
units: "Bytes",
default: 1650,
},
datacarriercost: {
type: "number",
nullable: false,
name: "Datacarrier cost",
description:
"Treat extra data in transactions as at least N vbytes per actual byte",
range: "[0,*)",
integral: true,
units: undefined,
default: 1,
},
acceptnonstddatacarrier: {
type: "boolean",
name: "Accept non standard datacarrier",
description: "Relay and mine non-OP_RETURN datacarrier injection",
default: false,
},
dustrelayfee: {
type: "number",
nullable: false,
name: "Dust Relay Fee",
description:
"Fee rate (in BTC/kvB) used to define dust, the value of an output such that it will cost more than its value in fees at this fee rate to spend it.",
range: "[0,*)",
integral: true,
units: "BTC/kvB",
default: 3000,
},
}
},
rpc: {
type: "object",
name: "RPC Settings",
Expand Down Expand Up @@ -124,41 +288,6 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => {
description: "Enable the ZeroMQ interface",
default: true,
},
datacarrier: {
type: "boolean",
name: "Datacarrier",
description: "Relay and mine data carrier transactions",
default: true,
},
datacarriersize: {
type: "number",
nullable: false,
name: "Datacarrier size",
description:
"Maximum size of arbitrary data to relay and mine.",
range: "[0,10000]",
integral: true,
units: "bytes",
default: 42,
},
permitbaremultisig: {
type: "boolean",
name: "Permitbaremultisig",
description: "Relay non-P2SH multisig",
default: false,
},
rejectparasites: {
type: "boolean",
name: "Reject Parasites",
description: "Reject parasites transactions",
default: true,
},
rejecttokens: {
type: "boolean",
name: "Reject Tokens",
description: "Reject tokens transactions (runes)",
default: false,
},
txindex: {
type: "boolean",
name: "Transaction Index",
Expand Down Expand Up @@ -389,6 +518,12 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => {
},
},
},
testnet: {
type: "boolean",
name: "Testnet (EXPERIMENTAL)",
description: "Use testnet instead of mainnet",
default: false,
},
},
},
})(effects);
Expand Down
Loading