mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-16 19:26:39 +02:00
lnrpc: add BatchOpenChannel RPC
This commit is contained in:
committed by
Oliver Gugger
parent
37d0d651c4
commit
c5c956bbef
@@ -666,6 +666,31 @@ func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context
|
||||
}()
|
||||
}
|
||||
|
||||
registry["lnrpc.Lightning.BatchOpenChannel"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
req := &BatchOpenChannelRequest{}
|
||||
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := NewLightningClient(conn)
|
||||
resp, err := client.BatchOpenChannel(ctx, req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
respBytes, err := marshaler.Marshal(resp)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
|
||||
registry["lnrpc.Lightning.FundingStateStep"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
|
Reference in New Issue
Block a user