-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
btcjson: turn warnings into StringOrArray type #2245
Conversation
cc @ziggie1984. |
Pull Request Test Coverage Report for Build 10668259914Details
💛 - Coveralls |
There was a problem hiding this 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 ?
btcjson/chainsvrresults.go
Outdated
// of the chain backend. | ||
type StringOrArray []string | ||
|
||
// MarshalJSON implements the json.Marshaler interface |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
890e562
to
ed879ea
Compare
I think we can't just update to a newer Golang version without potentially breaking other projects. See discussion here: #2239 (comment) |
cc @Roasbeef would be nice to get this in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🏦
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.