lndclient: return node URIs from GetInfo call

pull/123/head
Oliver Gugger 4 years ago
parent bc07050da2
commit 162b2589e0
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -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…
Cancel
Save