Skip to content

lightningd: Check bitcoind version when setup_topology - #2859

Merged
ZmnSCPxj merged 3 commits into
ElementsProject:masterfrom
trueptolemy:check-bitcoind-version
Jul 30, 2019
Merged

lightningd: Check bitcoind version when setup_topology#2859
ZmnSCPxj merged 3 commits into
ElementsProject:masterfrom
trueptolemy:check-bitcoind-version

Conversation

@trueptolemy

Copy link
Copy Markdown
Contributor

Fix #2697 .
Corresponding to the comment, this PR add the
check that the bitcoind version must be at least v0.15.0, and any older version will let lightningd down.
Related changes include:

  • Add the cli_min_supported_version field in chainparams:
    it's numeric version for bitcoind, now set all cli_min_supported_version as 150000;
  • Call getnetworkinfor (call getinfor for the version older than v0.16.0) to get the numeric version and check if the version is supported.

Set the min supported numeric version of cli as 150000.
Comment thread lightningd/bitcoind.c Outdated
@trueptolemy
trueptolemy force-pushed the check-bitcoind-version branch 3 times, most recently from 9dfc67f to df8770c Compare July 29, 2019 09:17
@cdecker

cdecker commented Jul 29, 2019

Copy link
Copy Markdown
Member

Looks good to me, I think we can just fail with versions <0.14.0, since we don't support them anyway. The error message makes sense so that should work like it is.

ACK df8770c

Comment thread lightningd/bitcoind.c Outdated

@ZmnSCPxj ZmnSCPxj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b00ad8c

@ZmnSCPxj
ZmnSCPxj merged commit 0ae2039 into ElementsProject:master Jul 30, 2019
Comment thread bitcoin/chainparams.c
.rpc_port = 9332,
.cli = "litecoin-cli",
.cli_args = NULL,
.cli_min_supported_version = 150000,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

litecoin seems not release 0.15 version.

Comment thread lightningd/bitcoind.c

if (tokens[0].type != JSMN_OBJECT) {
log_unusual(bcli->bitcoind->log,
"%s: gave non-object (%.*s)?",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"(%.*s)?" wrong format?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct format. %.*s means get two arguments: first is length of string, second is string (which might not be null terminated).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, glad to known new tricks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check bitcoind version atstartup

5 participants