added json-rpc debug logging

see #482
This commit is contained in:
Bernhard B
2024-03-20 19:47:37 +01:00
parent efee49e792
commit 3573f6ae95

View File

@@ -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")) _, err = r.conn.Write([]byte(string(fullCommandBytes) + "\n"))
if err != nil { if err != nil {
@@ -118,12 +118,16 @@ func (r *JsonRpc2Client) getRaw(command string, account *string, args interface{
r.receivedResponsesById[u.String()] = responseChan r.receivedResponsesById[u.String()] = responseChan
var resp JsonRpc2MessageResponse var resp JsonRpc2MessageResponse
resp = <-responseChan resp = <-responseChan
delete(r.receivedResponsesById, u.String()) delete(r.receivedResponsesById, u.String())
if resp.Err.Code != 0 { if resp.Err.Code != 0 {
return "", errors.New(resp.Err.Message) 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 return string(resp.Result), nil
} }