mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
lndclient: return node URIs from GetInfo call
This commit is contained in:
parent
bc07050da2
commit
162b2589e0
3 changed files with 17 additions and 2 deletions
|
|
@ -44,6 +44,7 @@ type Info struct {
|
|||
IdentityPubkey [33]byte
|
||||
Alias string
|
||||
Network string
|
||||
Uris []string
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -145,6 +146,7 @@ func (s *lightningClient) GetInfo(ctx context.Context) (*Info, error) {
|
|||
IdentityPubkey: pubKeyArray,
|
||||
Alias: resp.Alias,
|
||||
Network: resp.Chains[0].Network,
|
||||
Uris: resp.Uris,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package test
|
|||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -48,10 +49,16 @@ func (h *mockLightningClient) ConfirmedWalletBalance(ctx context.Context) (
|
|||
func (h *mockLightningClient) GetInfo(ctx context.Context) (*lndclient.Info,
|
||||
error) {
|
||||
|
||||
pubKeyBytes, err := hex.DecodeString(h.lnd.NodePubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var pubKey [33]byte
|
||||
copy(pubKey[:], pubKeyBytes)
|
||||
return &lndclient.Info{
|
||||
BlockHeight: 600,
|
||||
IdentityPubkey: pubKey,
|
||||
Uris: []string{h.lnd.NodePubkey + "@127.0.0.1:9735"},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ import (
|
|||
"github.com/lightningnetwork/lnd/zpay32"
|
||||
)
|
||||
|
||||
var testStartingHeight = int32(600)
|
||||
var (
|
||||
testStartingHeight = int32(600)
|
||||
testNodePubkey = "03f5374b16f0b1f1b49101de1b9d89e0b460bc57ce9c2f9" +
|
||||
"132b73dfc76d3704daa"
|
||||
)
|
||||
|
||||
// NewMockLnd returns a new instance of LndMockServices that can be used in unit
|
||||
// tests.
|
||||
|
|
@ -54,6 +58,7 @@ func NewMockLnd() *LndMockServices {
|
|||
FailInvoiceChannel: make(chan lntypes.Hash, 2),
|
||||
epochChannel: make(chan int32),
|
||||
Height: testStartingHeight,
|
||||
NodePubkey: testNodePubkey,
|
||||
}
|
||||
|
||||
lightningClient.lnd = &lnd
|
||||
|
|
@ -120,7 +125,8 @@ type LndMockServices struct {
|
|||
RouterSendPaymentChannel chan RouterPaymentChannelMessage
|
||||
TrackPaymentChannel chan TrackPaymentMessage
|
||||
|
||||
Height int32
|
||||
Height int32
|
||||
NodePubkey string
|
||||
|
||||
WaitForFinished func()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue