make cln client recoverable after cln connection loss

This commit is contained in:
Jesse de Wit
2023-12-11 22:16:06 +01:00
parent 8585eff280
commit d8bee41243
5 changed files with 168 additions and 14 deletions

View File

@@ -161,7 +161,11 @@ func (c *CustomMsgClient) Send(msg *lightning.CustomMessage) error {
binary.BigEndian.PutUint16(t[:], uint16(msg.Type))
m := hex.EncodeToString(t[:]) + hex.EncodeToString(msg.Data)
_, err := c.client.client.SendCustomMessage(msg.PeerId, m)
client, err := c.client.getClient()
if err != nil {
return err
}
_, err = client.SendCustomMessage(msg.PeerId, m)
return err
}