Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeShimizu committed Jun 18, 2024
1 parent cd24c35 commit fd00a84
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions clightning/clightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func NewClightningClient(ctx context.Context) (*ClightningClient, <-chan interfa
cl.Plugin = glightning.NewPlugin(cl.onInit)
err := cl.Plugin.RegisterHooks(&glightning.Hooks{
CustomMsgReceived: cl.OnCustomMsg,
RpcCommand: cl.OnRPCCommand,
})
if err != nil {
return nil, nil, err
Expand All @@ -150,6 +151,25 @@ func NewClightningClient(ctx context.Context) (*ClightningClient, <-chan interfa
return cl, cl.initChan, nil
}

func (cl *ClightningClient) OnRPCCommand(event *glightning.RpcCommandEvent) (*jrpc2.RpcCommandResponse, error) {

Check failure on line 154 in clightning/clightning.go

View workflow job for this annotation

GitHub Actions / unit-tests

undefined: jrpc2.RpcCommandResponse
if cl.gbitcoin != nil {
ok, err := cl.gbitcoin.Ping()
if err != nil || !ok {
log.Infof("trying to send command %s, but failed to connect: %v", event.Cmd.MethodName, err)
return event.ReturnError("bitcoin_unavailable", -1)
}
}

if cl.liquidWallet != nil {
ok, err := cl.liquidWallet.Ping()
if err != nil || !ok {
log.Infof("trying to send command %s, but failed to connect: %v", event.Cmd.MethodName, err)
return event.ReturnError("liquid_unavailable", -1)
}
}
return event.Continue(), nil
}

// CanSpend checks if an `amtMsat` can be spend. It returns an error if the
// amount is larger than the `ClnMaxPaymentSizeMsat` if the option
// `--large-channels` is missing or set to false.
Expand Down

0 comments on commit fd00a84

Please sign in to comment.