forked from lightninglabs/lndmon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcln.go
543 lines (485 loc) · 19.8 KB
/
cln.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
package lndmon
import (
"context"
"encoding/binary"
"fmt"
"strconv"
"strings"
"time"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwallet/wtxmgr"
clngrpc "github.com/flitz-be/cln-grpc-go/cln"
"github.com/lightninglabs/lndclient"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
)
type CLN struct {
cln clngrpc.NodeClient
}
func (cln *CLN) PayInvoice(ctx context.Context, invoice string, maxFee btcutil.Amount, outgoingChannel *uint64) chan lndclient.PaymentResult {
return nil
}
func (cln *CLN) GetInfo(ctx context.Context) (*lndclient.Info, error) {
info, err := cln.cln.Getinfo(ctx, &clngrpc.GetinfoRequest{})
if err != nil {
return nil, err
}
return &lndclient.Info{
Version: info.Version,
BlockHeight: info.Blockheight,
IdentityPubkey: convertPubkey(info.Id),
Alias: info.Alias,
Network: info.Network,
Uris: []string{},
SyncedToChain: true, //todo: ?
SyncedToGraph: true, //todo: ?
BestHeaderTimeStamp: time.Time{}, //todo ?
ActiveChannels: info.NumActiveChannels,
InactiveChannels: info.NumInactiveChannels,
PendingChannels: info.NumPendingChannels,
}, nil
}
func (cln *CLN) EstimateFeeToP2WSH(ctx context.Context, amt btcutil.Amount, confTarget int32) (btcutil.Amount, error) {
return 0, fmt.Errorf("Not implemented")
}
// WalletBalance returns a summary of the node's wallet balance.
func (cln *CLN) WalletBalance(ctx context.Context) (*lndclient.WalletBalance, error) {
return nil, fmt.Errorf("Not implemented")
}
func (cln *CLN) AddInvoice(ctx context.Context, in *invoicesrpc.AddInvoiceData) (lntypes.Hash, string, error) {
return lntypes.Hash{}, "", fmt.Errorf("Not implemented")
}
// LookupInvoice looks up an invoice by hash.
func (cln *CLN) LookupInvoice(ctx context.Context, hash lntypes.Hash) (*lndclient.Invoice, error) {
return nil, fmt.Errorf("Not implemented")
}
// ListTransactions returns all known transactions of the backing lnd
// node. It takes a start and end block height which can be used to
// limit the block range that we query over. These values can be left
// as zero to include all blocks. To include unconfirmed transactions
// in the query, endHeight must be set to -1.
func (cln *CLN) ListTransactions(ctx context.Context, startHeight int32, endHeight int32) ([]lndclient.Transaction, error) {
return nil, fmt.Errorf("Not implemented")
}
// ListChannels retrieves all channels of the backing lnd node.
func (cln *CLN) ListChannels(ctx context.Context, activeOnly bool, publicOnly bool) ([]lndclient.ChannelInfo, error) {
peers, err := cln.cln.ListPeers(ctx, &clngrpc.ListpeersRequest{})
if err != nil {
return nil, err
}
channels := []lndclient.ChannelInfo{}
for _, p := range peers.Peers {
for _, ch := range p.Channels {
cap := btcutil.Amount(ch.TotalMsat.Msat / 1e3)
ours := btcutil.Amount(ch.ToUsMsat.Msat / 1e3)
receivable := btcutil.Amount(ch.ReceivableMsat.Msat / 1e3)
chanId, err := convertChanId(ch.ShortChannelId)
if err != nil {
return nil, err
}
htlcs, err := convertHtlcs(ch.Htlcs, lnwire.NewShortChanIDFromInt(chanId))
if err != nil {
return nil, err
}
channels = append(channels, lndclient.ChannelInfo{
ChannelPoint: fmt.Sprintf("%s:%d", string(ch.FundingTxid), *ch.FundingOutnum),
Active: p.Connected,
ChannelID: chanId,
PubKeyBytes: convertPubkey(p.Id),
Capacity: cap,
LocalBalance: ours,
RemoteBalance: receivable,
UnsettledBalance: 0,
Initiator: ch.Opener == clngrpc.ChannelSide_IN,
Private: *ch.Private,
LifeTime: 0,
Uptime: 0,
TotalSent: btcutil.Amount(ch.OutFulfilledMsat.Msat / 1e3), // Not accurate
TotalReceived: btcutil.Amount(ch.InFulfilledMsat.Msat / 1e3), // Not accurate
NumUpdates: 0,
NumPendingHtlcs: len(ch.Htlcs),
PendingHtlcs: htlcs,
CSVDelay: 0,
FeePerKw: 0,
CommitWeight: 0,
CommitFee: 0,
LocalConstraints: &lndclient.ChannelConstraints{},
RemoteConstraints: &lndclient.ChannelConstraints{},
CloseAddr: nil,
})
}
}
return channels, nil
}
// PendingChannels returns a list of lnd's pending channels.
//todo
func (cln *CLN) PendingChannels(ctx context.Context) (*lndclient.PendingChannels, error) {
result := &lndclient.PendingChannels{
PendingForceClose: []lndclient.ForceCloseChannel{},
PendingOpen: []lndclient.PendingChannel{},
WaitingClose: []lndclient.WaitingCloseChannel{},
}
return result, nil
}
// ClosedChannels returns all closed channels of the backing lnd node.
func (cln *CLN) ClosedChannels(ctx context.Context) ([]lndclient.ClosedChannel, error) {
return []lndclient.ClosedChannel{}, nil
}
// ForwardingHistory makes a paginated call to our forwarding history
// endpoint.
func (cln *CLN) ForwardingHistory(ctx context.Context, req lndclient.ForwardingHistoryRequest) (*lndclient.ForwardingHistoryResponse, error) {
return nil, fmt.Errorf("Not implemented")
}
// ListInvoices makes a paginated call to our list invoices endpoint.
func (cln *CLN) ListInvoices(ctx context.Context, req lndclient.ListInvoicesRequest) (*lndclient.ListInvoicesResponse, error) {
return nil, fmt.Errorf("Not implemented")
}
// ListPayments makes a paginated call to our list payments endpoint.
func (cln *CLN) ListPayments(ctx context.Context, req lndclient.ListPaymentsRequest) (*lndclient.ListPaymentsResponse, error) {
return nil, fmt.Errorf("Not implemented")
}
// ChannelBackup retrieves the backup for a particular channel. The
// backup is returned as an encrypted chanbackup.Single payload.
func (cln *CLN) ChannelBackup(_ context.Context, _ wire.OutPoint) ([]byte, error) {
return nil, fmt.Errorf("Not implemented")
}
// ChannelBackups retrieves backups for all existing pending open and
// open channels. The backups are returned as an encrypted
// chanbackup.Multi payload.
func (cln *CLN) ChannelBackups(ctx context.Context) ([]byte, error) {
return nil, fmt.Errorf("Not implemented")
}
// SubscribeChannelBackups allows a client to subscribe to the
// most up to date information concerning the state of all channel
// backups.
func (cln *CLN) SubscribeChannelBackups(ctx context.Context) (<-chan lnrpc.ChanBackupSnapshot, <-chan error, error) {
return nil, nil, fmt.Errorf("Not implemented")
}
// SubscribeChannelEvents allows a client to subscribe to updates
// relevant to the state of channels. Events include new active
// channels, inactive channels, and closed channels.
func (cln *CLN) SubscribeChannelEvents(ctx context.Context) (<-chan *lndclient.ChannelEventUpdate, <-chan error, error) {
return nil, nil, fmt.Errorf("Not implemented")
}
// DecodePaymentRequest decodes a payment request.
func (cln *CLN) DecodePaymentRequest(ctx context.Context, payReq string) (*lndclient.PaymentRequest, error) {
return nil, fmt.Errorf("Not implemented")
}
// OpenChannel opens a channel to the peer provided with the amounts
// specified.
func (cln *CLN) OpenChannel(ctx context.Context, peer route.Vertex, localSat btcutil.Amount, pushSat btcutil.Amount, private bool) (*wire.OutPoint, error) {
return nil, fmt.Errorf("Not implemented")
}
// CloseChannel closes the channel provided.
func (cln *CLN) CloseChannel(ctx context.Context, channel *wire.OutPoint, force bool, confTarget int32, deliveryAddr btcutil.Address) (chan lndclient.CloseChannelUpdate, chan error, error) {
return nil, nil, fmt.Errorf("Not implemented")
}
// UpdateChanPolicy updates the channel policy for the passed chanPoint.
// If the chanPoint is nil, then the policy is applied for all existing
// channels.
func (cln *CLN) UpdateChanPolicy(ctx context.Context, req lndclient.PolicyUpdateRequest, chanPoint *wire.OutPoint) error {
return fmt.Errorf("Not implemented")
}
// GetChanInfo returns the channel info for the passed channel,
// including the routing policy for both end.
func (cln *CLN) GetChanInfo(ctx context.Context, chanID uint64) (*lndclient.ChannelEdge, error) {
return nil, fmt.Errorf("Not implemented")
}
// ListPeers gets a list the peers we are currently connected to.
func (cln *CLN) ListPeers(ctx context.Context) ([]lndclient.Peer, error) {
resp, err := cln.cln.ListPeers(ctx, &clngrpc.ListpeersRequest{})
if err != nil {
return nil, err
}
peers := []lndclient.Peer{}
for _, p := range resp.Peers {
peers = append(peers, lndclient.Peer{
Pubkey: convertPubkey(p.Id),
Address: strings.Join(p.Netaddr, ""),
BytesSent: 0,
BytesReceived: 0,
Inbound: false,
PingTime: 0,
Sent: 0,
Received: 0,
})
}
return peers, nil
}
// Connect attempts to connect to a peer at the host specified. If
// permanent is true then we'll attempt to connect to the peer
// permanently, meaning that the connection is maintained even if no
// channels exist between us and the peer.
func (cln *CLN) Connect(ctx context.Context, peer route.Vertex, host string, permanent bool) error {
return fmt.Errorf("Not implemented")
}
// SendCoins sends the passed amount of (or all) coins to the passed
// address. Either amount or sendAll must be specified, while
// confTarget, satsPerByte are optional and may be set to zero in which
// case automatic conf target and fee will be used. Returns the tx id
// upon success.
func (cln *CLN) SendCoins(ctx context.Context, addr btcutil.Address, amount btcutil.Amount, sendAll bool, confTarget int32, satsPerByte int64, label string) (string, error) {
return "", fmt.Errorf("Not implemented")
}
// ChannelBalance returns a summary of our channel balances.
func (cln *CLN) ChannelBalance(ctx context.Context) (*lndclient.ChannelBalance, error) {
resp, err := cln.cln.ListFunds(ctx, &clngrpc.ListfundsRequest{})
balance := uint64(0)
pending := uint64(0)
for _, ch := range resp.Channels {
if ch.State == clngrpc.ChannelState_ChanneldNormal {
balance += ch.OurAmountMsat.Msat / 1e3
}
if ch.State == clngrpc.ChannelState_ChanneldAwaitingLockin {
pending += ch.OurAmountMsat.Msat / 1e3
}
}
if err != nil {
return nil, err
}
return &lndclient.ChannelBalance{
Balance: btcutil.Amount(balance),
PendingBalance: btcutil.Amount(pending),
}, nil
}
// GetNodeInfo looks up information for a specific node.
func (cln *CLN) GetNodeInfo(ctx context.Context, pubkey route.Vertex, includeChannels bool) (*lndclient.NodeInfo, error) {
nodes, err := cln.cln.ListNodes(ctx, &clngrpc.ListnodesRequest{
Id: []byte(pubkey.String()),
})
if err != nil {
return nil, err
}
if len(nodes.Nodes) != 1 {
return nil, fmt.Errorf("No or multiple nodes found for pubkey, len nodes: %d", len(nodes.Nodes))
}
node := nodes.Nodes[0]
lastTs := node.LastTimestamp
if lastTs == nil {
return nil, fmt.Errorf("No timestamp")
}
return &lndclient.NodeInfo{
Node: &lndclient.Node{
PubKey: pubkey,
LastUpdate: time.Unix(int64(*lastTs), 0),
Alias: *node.Alias,
Color: string(node.Color),
Features: []lnwire.FeatureBit{},
Addresses: []string{},
},
ChannelCount: 0,
TotalCapacity: 0,
Channels: []lndclient.ChannelEdge{},
}, nil
}
// DescribeGraph returns our view of the graph.
func (cln *CLN) DescribeGraph(ctx context.Context, includeUnannounced bool) (*lndclient.Graph, error) {
nodes := []lndclient.Node{}
edges := []lndclient.ChannelEdge{}
nodeResp, err := cln.cln.ListNodes(ctx, &clngrpc.ListnodesRequest{})
if err != nil {
return nil, err
}
for _, node := range nodeResp.Nodes {
nodes = append(nodes, lndclient.Node{
PubKey: convertPubkey(node.Nodeid),
LastUpdate: time.Unix(int64(*node.LastTimestamp), 0),
Alias: *node.Alias,
Color: string(node.Color),
Features: []lnwire.FeatureBit{},
Addresses: []string{},
})
}
channelResp, err := cln.cln.ListChannels(ctx, &clngrpc.ListchannelsRequest{})
if err != nil {
return nil, err
}
for _, ch := range channelResp.Channels {
id, err := convertChanId(&ch.ShortChannelId)
if err != nil {
return nil, err
}
edges = append(edges, lndclient.ChannelEdge{
ChannelID: id,
ChannelPoint: "0", //?
Capacity: btcutil.Amount(ch.GetAmountMsat().Msat) / 1e3,
Node1: convertPubkey(ch.Source),
Node2: convertPubkey(ch.Destination),
Node1Policy: &lndclient.RoutingPolicy{},
Node2Policy: &lndclient.RoutingPolicy{},
})
}
return &lndclient.Graph{
Nodes: nodes,
Edges: edges,
}, nil
}
// SubscribeGraph allows a client to subscribe to gaph topology updates.
func (cln *CLN) SubscribeGraph(ctx context.Context) (<-chan *lndclient.GraphTopologyUpdate, <-chan error, error) {
return nil, nil, fmt.Errorf("Not implemented")
}
// NetworkInfo returns stats regarding our view of the network.
func (cln *CLN) NetworkInfo(ctx context.Context) (*lndclient.NetworkInfo, error) {
//todo
return &lndclient.NetworkInfo{
GraphDiameter: 0,
AvgOutDegree: 0,
MaxOutDegree: 0,
NumNodes: 0,
NumChannels: 0,
TotalNetworkCapacity: 0,
AvgChannelSize: 0,
MinChannelSize: 0,
MaxChannelSize: 0,
MedianChannelSize: 0,
NumZombieChans: 0,
}, nil
}
// SubscribeInvoices allows a client to subscribe to updates
// of newly added/settled invoices.
func (cln *CLN) SubscribeInvoices(ctx context.Context, req lndclient.InvoiceSubscriptionRequest) (<-chan *lndclient.Invoice, <-chan error, error) {
return nil, nil, fmt.Errorf("Not implemented")
}
// ListPermissions returns a list of all RPC method URIs and the
// macaroon permissions that are required to access them.
func (cln *CLN) ListPermissions(ctx context.Context) (map[string][]lndclient.MacaroonPermission, error) {
return nil, fmt.Errorf("Not implemented")
}
// ChannelAcceptor create a channel acceptor using the accept function
// passed in. The timeout provided will be used to timeout the passed
// accept closure when it exceeds the amount of time we allow. Note that
// this amount should be strictly less than lnd's chanacceptor timeout
// parameter.
func (cln *CLN) ChannelAcceptor(ctx context.Context, timeout time.Duration, accept lndclient.AcceptorFunction) (chan error, error) {
return nil, fmt.Errorf("Not implemented")
}
// QueryRoutes can query LND to return a route (with fees) between two
// vertices.
func (cln *CLN) QueryRoutes(ctx context.Context, req lndclient.QueryRoutesRequest) (*lndclient.QueryRoutesResponse, error) {
return nil, fmt.Errorf("Not implemented")
}
// CheckMacaroonPermissions allows a client to check the validity of a
// macaroon.
func (cln *CLN) CheckMacaroonPermissions(ctx context.Context, macaroon []byte, permissions []lndclient.MacaroonPermission, fullMethod string) (bool, error) {
return false, fmt.Errorf("Not implemented")
}
// ListUnspent returns a list of all utxos spendable by the wallet with
// a number of confirmations between the specified minimum and maximum.
func (cln *CLN) ListUnspent(ctx context.Context, minConfs int32, maxConfs int32) ([]*lnwallet.Utxo, error) {
return nil, fmt.Errorf("Not implemented")
}
// LeaseOutput locks an output to the given ID for the lease time
// provided, preventing it from being available for any future coin
// selection attempts. The absolute time of the lock's expiration is
// returned. The expiration of the lock can be extended by successive
// invocations of this call. Outputs can be unlocked before their
// expiration through `ReleaseOutput`.
func (cln *CLN) LeaseOutput(ctx context.Context, lockID wtxmgr.LockID, op wire.OutPoint, leaseTime time.Duration) (time.Time, error) {
return time.Time{}, fmt.Errorf("Not implemented")
}
// ReleaseOutput unlocks an output, allowing it to be available for coin
// selection if it remains unspent. The ID should match the one used to
// originally lock the output.
func (cln *CLN) ReleaseOutput(ctx context.Context, lockID wtxmgr.LockID, op wire.OutPoint) error {
return fmt.Errorf("Not implemented")
}
func (cln *CLN) DeriveNextKey(ctx context.Context, family int32) (*keychain.KeyDescriptor, error) {
return nil, fmt.Errorf("Not implemented")
}
func (cln *CLN) DeriveKey(ctx context.Context, locator *keychain.KeyLocator) (*keychain.KeyDescriptor, error) {
return nil, fmt.Errorf("Not implemented")
}
func (cln *CLN) NextAddr(ctx context.Context) (btcutil.Address, error) {
return nil, fmt.Errorf("Not implemented")
}
func (cln *CLN) PublishTransaction(ctx context.Context, tx *wire.MsgTx, label string) error {
return fmt.Errorf("Not implemented")
}
func (cln *CLN) SendOutputs(ctx context.Context, outputs []*wire.TxOut, feeRate chainfee.SatPerKWeight, label string) (*wire.MsgTx, error) {
return nil, fmt.Errorf("Not implemented")
}
func (cln *CLN) EstimateFee(ctx context.Context, confTarget int32) (chainfee.SatPerKWeight, error) {
return 0, fmt.Errorf("Not implemented")
}
// ListSweeps returns a list of sweep transaction ids known to our node.
// Note that this function only looks up transaction ids, and does not
// query our wallet for the full set of transactions.
func (cln *CLN) ListSweeps(ctx context.Context) ([]string, error) {
return nil, fmt.Errorf("Not implemented")
}
// BumpFee attempts to bump the fee of a transaction by spending one of
// its outputs at the given fee rate. This essentially results in a
// child-pays-for-parent (CPFP) scenario. If the given output has been
// used in a previous BumpFee call, then a transaction replacing the
// previous is broadcast, resulting in a replace-by-fee (RBF) scenario.
func (cln *CLN) BumpFee(_ context.Context, _ wire.OutPoint, _ chainfee.SatPerKWeight) error {
return fmt.Errorf("Not implemented")
}
// ListAccounts retrieves all accounts belonging to the wallet by default.
// Optional name and addressType can be provided to filter through all of the
// wallet accounts and return only those matching.
func (cln *CLN) ListAccounts(ctx context.Context, name string, addressType walletrpc.AddressType) ([]*walletrpc.Account, error) {
return nil, fmt.Errorf("Not implemented")
}
//todo check if this function is actually correct??
//probably not
func convertChanId(clnChanId *string) (lndChanId uint64, err error) {
if clnChanId == nil {
return 0, fmt.Errorf("Chan id is nil")
}
parts := strings.Split(*clnChanId, "x")
if len(parts) != 3 {
return 0, fmt.Errorf("Short chan id should have 3 parts but got %d parts", len(parts))
}
array := []byte{}
blockHeight, err := strconv.Atoi(parts[0])
if err != nil {
return 0, err
}
binary.LittleEndian.PutUint64(array, uint64(blockHeight))
blockIndex, err := strconv.Atoi(parts[1])
if err != nil {
return 0, err
}
binary.LittleEndian.PutUint64(array, uint64(blockIndex))
outputIndex, err := strconv.Atoi(parts[2])
if err != nil {
return 0, err
}
binary.LittleEndian.PutUint64(array, uint64(outputIndex))
num := binary.LittleEndian.Uint64(array)
return num, nil
}
func convertHash(clnKey []byte) (lndKey [32]byte) {
pubkey := [32]byte{}
copy(pubkey[:], lndKey[:])
return pubkey
}
func convertPubkey(clnKey []byte) (lndKey [33]byte) {
pubkey := [33]byte{}
copy(pubkey[:], lndKey[:])
return pubkey
}
func convertHtlcs(in []*clngrpc.ListpeersPeersChannelsHtlcs, chanId lnwire.ShortChannelID) (htlcs []lndclient.PendingHtlc, err error) {
htlcs = make([]lndclient.PendingHtlc, len(in))
for i, htlc := range in {
htlcs[i] = lndclient.PendingHtlc{
Incoming: htlc.Direction == clngrpc.ListpeersPeersChannelsHtlcs_IN,
Amount: btcutil.Amount(htlc.AmountMsat.Msat) / 1e3,
Hash: convertHash(htlc.PaymentHash),
Expiry: htlc.Expiry,
HtlcIndex: htlc.Id,
ForwardingChannel: chanId,
ForwardingIndex: htlc.Id, //?
}
}
return nil, nil
}