Skip to content

Commit a25cd3b

Browse files
committed
RPC doc generating script: always connect to regtest
The recommended network for generating RPC docs is regtest, as stated in the script's file header comments: "// (2) install bitcoin core, set it up to use regtest" To achieve this, the user previosly needed to manually put `regtest=1` into `~/.bitcoin/bitcoin.conf` -- the script didn't specify a concrete network, so without config file setting, mainnet was used. With the change in this commit, we will always connect to regtest by passing the `-regtest` option to the `bitcoin-cli` invokation.
1 parent 8c3b777 commit a25cd3b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/doc-gen/generate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
)
2121

2222
const BITCOIN_COMMAND = "bitcoin-cli"
23+
const BITCOIN_CHAINOPTION = "-regtest"
2324

2425
type Command struct {
2526
Name string
@@ -158,9 +159,10 @@ func open(path string) io.Writer {
158159
}
159160

160161
func run(args ...string) string {
162+
args = append([]string{BITCOIN_CHAINOPTION}, args...)
161163
out, err := exec.Command(BITCOIN_COMMAND, args...).CombinedOutput()
162164
if err != nil {
163-
log.Fatalf("Cannot run bitcoin-cli: %s, is bitcoind running?", err.Error())
165+
log.Fatalf("Cannot run bitcoin-cli: %s, is bitcoind (regtest) running?", err.Error())
164166
}
165167

166168
return string(out)

0 commit comments

Comments
 (0)