From c25c9b25bddbf409c6a28957fb9facc599b6e55e Mon Sep 17 00:00:00 2001 From: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com> Date: Sun, 15 Dec 2019 14:49:22 +0200 Subject: [PATCH] [NOD-502] Remove RPCQuirks. (#540) --- config/config.go | 1 - doc.go | 3 --- server/rpc/rpcserver.go | 11 +++-------- server/rpc/rpcwebsocket.go | 11 +++-------- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/config/config.go b/config/config.go index 6a55b7e0f..d1077d472 100644 --- a/config/config.go +++ b/config/config.go @@ -118,7 +118,6 @@ type Flags struct { RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"` RPCMaxWebsockets int `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"` RPCMaxConcurrentReqs int `long:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"` - RPCQuirks bool `long:"rpcquirks" description:"Mirror some JSON-RPC quirks of Bitcoin Core -- NOTE: Discouraged unless interoperability issues need to be worked around"` DisableRPC bool `long:"norpc" description:"Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass or rpclimituser/rpclimitpass is specified"` DisableTLS bool `long:"notls" description:"Disable TLS for the RPC server -- NOTE: This is only allowed if the RPC server is bound to localhost"` DisableDNSSeed bool `long:"nodnsseed" description:"Disable DNS seeding for peers"` diff --git a/doc.go b/doc.go index c142f300a..e4b86bd8f 100644 --- a/doc.go +++ b/doc.go @@ -52,9 +52,6 @@ Application Options: --rpcmaxclients= Max number of RPC clients for standard connections (10) --rpcmaxwebsockets= Max number of RPC websocket connections (25) - --rpcquirks Mirror some JSON-RPC quirks of Bitcoin Core -- NOTE: - Discouraged unless interoperability issues need to - be worked around --norpc Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass or rpclimituser/rpclimitpass is specified diff --git a/server/rpc/rpcserver.go b/server/rpc/rpcserver.go index 0fca2db7e..27b5d29ab 100644 --- a/server/rpc/rpcserver.go +++ b/server/rpc/rpcserver.go @@ -494,14 +494,9 @@ func (s *Server) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin boo // must not be responded to. JSON-RPC 2.0 permits the null value as a // valid request id, therefore such requests are not notifications. // - // Kaspad does not respond to any request without and "id" or "id":null, - // regardless the indicated JSON-RPC protocol version unless RPC quirks - // are enabled. With RPC quirks enabled, such requests will be responded - // to if the reqeust does not indicate JSON-RPC version. - // - // RPC quirks can be enabled by the user to avoid compatibility issues - // with software relying on Core's behavior. - if request.ID == nil && !(config.ActiveConfig().RPCQuirks && request.JSONRPC == "") { + // Kaspad does not respond to any request without an "id" or "id":null, + // regardless the indicated JSON-RPC protocol version. + if request.ID == nil { return } diff --git a/server/rpc/rpcwebsocket.go b/server/rpc/rpcwebsocket.go index 9b4ac4b94..f058ce5bf 100644 --- a/server/rpc/rpcwebsocket.go +++ b/server/rpc/rpcwebsocket.go @@ -990,14 +990,9 @@ out: // must not be responded to. JSON-RPC 2.0 permits the null value as a // valid request id, therefore such requests are not notifications. // - // Kaspad does not respond to any request without and "id" or "id":null, - // regardless the indicated JSON-RPC protocol version unless RPC quirks - // are enabled. With RPC quirks enabled, such requests will be responded - // to if the reqeust does not indicate JSON-RPC version. - // - // RPC quirks can be enabled by the user to avoid compatibility issues - // with software relying on Core's behavior. - if request.ID == nil && !(config.ActiveConfig().RPCQuirks && request.JSONRPC == "") { + // Kaspad does not respond to any request without an "id" or "id":null, + // regardless the indicated JSON-RPC protocol version. + if request.ID == nil { if !c.authenticated { break out }