Skip to content

Conversation

@guggero
Copy link
Collaborator

@guggero guggero commented Sep 2, 2024

Fixes #2224 and lightningnetwork/lnd#9053.

Depending on the version of Bitcoin Core, the "warnings" field in the response to getnetworkinfo is either a single string value or an array of strings.
We can easily parse those two variants with a custom type that implements an UnmarshalJSON method.

@guggero
Copy link
Collaborator Author

guggero commented Sep 2, 2024

cc @ziggie1984.

@coveralls
Copy link

coveralls commented Sep 2, 2024

Pull Request Test Coverage Report for Build 10668259914

Details

  • 14 of 25 (56.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.002%) to 57.23%

Changes Missing Coverage Covered Lines Changed/Added Lines %
btcjson/chainsvrresults.go 14 25 56.0%
Files with Coverage Reduction New Missed Lines %
connmgr/connmanager.go 1 86.27%
Totals Coverage Status
Change from base Build 10555907676: -0.002%
Covered Lines: 29858
Relevant Lines: 52172

💛 - Coveralls

Copy link
Contributor

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Cool Idea, LGTM.

Wondering when we update to make generics available as a default here, still using golang 1.17 ? Ready to bump the version ?

// of the chain backend.
type StringOrArray []string

// MarshalJSON implements the json.Marshaler interface
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: missing point at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, that's what I get for copy/pasting code... Fixed.

Fixes btcsuite#2224 and lightningnetwork/lnd#9053.

Depending on the version of Bitcoin Core, the "warnings" field in the
response to getnetworkinfo is either a single string value or an array
of strings.
We can easily parse those two variants with a custom type that
implements an UnmarshalJSON method.
@guggero guggero force-pushed the getnetworkinfo-warnings branch from 890e562 to ed879ea Compare September 2, 2024 13:38
@guggero
Copy link
Collaborator Author

guggero commented Sep 2, 2024

I think we can't just update to a newer Golang version without potentially breaking other projects. See discussion here: #2239 (comment)

@guggero
Copy link
Collaborator Author

guggero commented Sep 17, 2024

cc @Roasbeef would be nice to get this in. bitcoind v28.0 RC2 just dropped, so can't be too much longer until the final version drops and people will update, causing their lnd to not start anymore because of this.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🏦

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.

getnetworkinfo core RPC introduced new field in json object.

4 participants