Skip to content
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

RPCS: Failed to marshal reply: rpcversion '' is invalid #1711

Closed
regata opened this issue Apr 16, 2021 · 4 comments · Fixed by #1837
Closed

RPCS: Failed to marshal reply: rpcversion '' is invalid #1711

regata opened this issue Apr 16, 2021 · 4 comments · Fixed by #1837
Milestone

Comments

@regata
Copy link

regata commented Apr 16, 2021

Seeing this error when calling getinfo using https://github.com/petertodd/python-bitcoinlib:

RPCS: Failed to marshal reply: rpcversion '' is invalid

I'm using the master@2d7825c. I believe it happens because btcd expects jsonrpc field to be provided

btcd/btcjson/jsonrpc.go

Lines 96 to 101 in 2d7825c

type Request struct {
Jsonrpc RPCVersion `json:"jsonrpc"`
Method string `json:"method"`
Params []json.RawMessage `json:"params"`
ID interface{} `json:"id"`
}

when processing RPC requests:

btcd/rpcserver.go

Lines 4152 to 4155 in 2d7825c

if !batchedRequest {
var req btcjson.Request
var resp json.RawMessage
err = json.Unmarshal(body, &req)

However, bitcoinlib does not send it
https://github.com/petertodd/python-bitcoinlib/blob/0ea83c4fd499c63823754627c69ebdd79dc0d62c/bitcoin/rpc.py#L217-L220

What is the "ground truth" for the rpc spec? is the field expected to be set by clients?

@onyb
Copy link
Contributor

onyb commented Apr 16, 2021

I think this is a regression due to the recently merged JSON-RPC Batch implementation. cc: @jakesyl

We should try to include a fix in 0.22.0 (#1706) - should be quite simple to implement from the look of it. @jcvernaleo

@onyb onyb added this to the 0.22.0 milestone Apr 16, 2021
@jcvernaleo jcvernaleo modified the milestones: 0.22.0, 0.22.1 May 25, 2021
@jcvernaleo
Copy link
Member

I was under the impression that the rpcversion was supposed to be there. @jakesyl care to look at this?

@Sjors
Copy link

Sjors commented Aug 20, 2021

I'm seeing this error too with 0.22 beta... (makes sense, because it's still open)

Changing this line to true was enough to get ForkMonitor to poll it again, but that's a bit of a hack :-)
https://github.com/xplorfin/btcd/blob/master/btcjson/jsonrpc.go#L31

@nikicat
Copy link
Contributor

nikicat commented Jun 19, 2023

I still get this error, but it's easy to fix with this commit nikicat@eaac8c9

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 a pull request may close this issue.

5 participants