rpcserver: Add dcrd version info to getversion RPC.#1097
rpcserver: Add dcrd version info to getversion RPC.#1097davecgh merged 2 commits intodecred:masterfrom
Conversation
7d21ece to
aeccc12
Compare
rpcserver.go
Outdated
| @@ -5659,13 +5660,25 @@ func handleVerifyMessage(s *rpcServer, cmd interface{}, closeChan <-chan struct{ | |||
|
|
|||
| // handleVersion implements the version command. | |||
| func handleVersion(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) { | |||
| buildMeta := normalizeBuildString(runtime.Version()) | |||
There was a problem hiding this comment.
would this cause a runtime version e.g. go1.10 to enter the build metadata, when build metadata should be separated by periods? This would result in two additional metadata identifiers, go1 and 10, which is not what we intend here.
There was a problem hiding this comment.
Yeah, that's what I was going for. I suppose I could replace the period with a -.
There was a problem hiding this comment.
I'm open to other suggestions here too. Basically, I want to be able to see the runtime information as part of the build metadata. Showing it as go110 doesn't work. Given the alphabet only allows [0-9a-zA-Z-] the only other option is go1-10. Currently it shows up as:
{
"dcrd": {
"versionstring": "1.1.2+blockchainremovemainchainindex",
"major": 1,
"minor": 1,
"patch": 2,
"prerelease": "",
"buildmetadata": "blockchainremovemainchainindex.go1.10"
},
"dcrdjsonrpcapi": {
"versionstring": "3.2.0",
"major": 3,
"minor": 2,
"patch": 0,
"prerelease": "",
"buildmetadata": ""
}
}
There was a problem hiding this comment.
Update to replace . with - then pass it through the semver build normalizer.
The result is now:
$ dcrctl --testnet version
{
"dcrd": {
"versionstring": "1.1.2+tempintegration",
"major": 1,
"minor": 1,
"patch": 2,
"prerelease": "",
"buildmetadata": "tempintegration.go1-10"
},
"dcrdjsonrpcapi": {
"versionstring": "3.3.0",
"major": 3,
"minor": 3,
"patch": 0,
"prerelease": "",
"buildmetadata": ""
}
}aeccc12 to
abb9e6b
Compare
The semver spec allow the build portion to contain multiple identifiers separated by periods, however, the current code is stripping periods.
This adds the dcrd version info as an additional key to the JSON-RPC getversion response to accompany the existing RPC API version information and bumps the JSON-RPC minor version to account for the backwards-compatible change.
abb9e6b to
f92d363
Compare
This adds the dcrd version info as an additional key to the JSON-RPC getversion response to accompany the existing RPC API version information and bumps the JSON-RPC minor version to account for the backwards-compatible change.
Also, it corrects the semver build handling. The semver spec allow the build portion to contain multiple identifiers separated by periods, however, the current code is stripping periods.