lnrpc: send custom message

This commit is contained in:
Joost Jager committed 2021-10-15 17:08:53 +02:00
1 parent 5d7e814ea8
commit ae959b16ae
14 files changed
+4451 -3825

No files matched your search

+25
View File
@@ -1633,4 +1633,29 @@ func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context
}
callback(string(respBytes), nil)
}
registry["lnrpc.Lightning.SendCustomMessage"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &SendCustomMessageRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewLightningClient(conn)
resp, err := client.SendCustomMessage(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
}