From 3573f6ae951b8cc655ff6f44df56c4b6d775d99a Mon Sep 17 00:00:00 2001 From: Bernhard B Date: Wed, 20 Mar 2024 19:47:37 +0100 Subject: [PATCH] added json-rpc debug logging see #482 --- src/client/jsonrpc2.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/jsonrpc2.go b/src/client/jsonrpc2.go index 69c0413..46242d8 100644 --- a/src/client/jsonrpc2.go +++ b/src/client/jsonrpc2.go @@ -107,7 +107,7 @@ func (r *JsonRpc2Client) getRaw(command string, account *string, args interface{ } } - log.Debug("full command: ", string(fullCommandBytes)) + log.Debug("json-rpc command: ", string(fullCommandBytes)) _, err = r.conn.Write([]byte(string(fullCommandBytes) + "\n")) if err != nil { @@ -118,12 +118,16 @@ func (r *JsonRpc2Client) getRaw(command string, account *string, args interface{ r.receivedResponsesById[u.String()] = responseChan var resp JsonRpc2MessageResponse - resp = <-responseChan - delete(r.receivedResponsesById, u.String()) + resp = <-responseChan + delete(r.receivedResponsesById, u.String()) if resp.Err.Code != 0 { return "", errors.New(resp.Err.Message) } + + log.Debug("json-rpc command response message: ", string(resp.Result)) + log.Debug("json-rpc response error: ", string(resp.Err.Message)) + return string(resp.Result), nil }