Skip to content

Commit

Permalink
Default to JSONRPC 1.0 if the rpcVersion empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfour authored and jcvernaleo committed Apr 9, 2022
1 parent 0742662 commit 71c8443
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions btcjson/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ func (request *Request) UnmarshalJSON(b []byte) error {
// request.
func NewRequest(rpcVersion RPCVersion, id interface{}, method string, params []interface{}) (*Request, error) {
// default to JSON-RPC 1.0 if RPC type is not specified
if rpcVersion == "" {
rpcVersion = RpcVersion1
}
if !rpcVersion.IsValid() {
str := fmt.Sprintf("rpcversion '%s' is invalid", rpcVersion)
return nil, makeError(ErrInvalidType, str)
Expand Down

0 comments on commit 71c8443

Please sign in to comment.