mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-28 01:32:27 +02:00
Merge pull request #1661 from cfromknecht/restore-linter
Makefile: Restore linter
This commit is contained in:
commit
f0f5e11b82
2
Makefile
2
Makefile
@ -199,7 +199,7 @@ fmt:
|
|||||||
lint: $(LINT_BIN)
|
lint: $(LINT_BIN)
|
||||||
@$(call print, "Linting source.")
|
@$(call print, "Linting source.")
|
||||||
$(LINT_BIN) --install 1> /dev/null
|
$(LINT_BIN) --install 1> /dev/null
|
||||||
test -z "$($(LINT))"
|
test -z "$$($(LINT))"
|
||||||
|
|
||||||
list:
|
list:
|
||||||
@$(call print, "Listing commands.")
|
@$(call print, "Listing commands.")
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/davecgh/go-spew/spew"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config couples all the items that an autopilot agent needs to function.
|
// Config couples all the items that an autopilot agent needs to function.
|
||||||
|
@ -7,11 +7,11 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,10 +3,10 @@ package autopilot
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Node node is an interface which represents n abstract vertex within the
|
// Node node is an interface which represents n abstract vertex within the
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
|
|
||||||
prand "math/rand"
|
prand "math/rand"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConstrainedPrefAttachmentNeedMoreChan(t *testing.T) {
|
func TestConstrainedPrefAttachmentNeedMoreChan(t *testing.T) {
|
||||||
|
@ -1259,7 +1259,7 @@ func TestBreachSecondLevelTransfer(t *testing.T) {
|
|||||||
// output is spent by a second level tx.
|
// output is spent by a second level tx.
|
||||||
secondLvlTx := &wire.MsgTx{
|
secondLvlTx := &wire.MsgTx{
|
||||||
TxOut: []*wire.TxOut{
|
TxOut: []*wire.TxOut{
|
||||||
&wire.TxOut{Value: 1},
|
{Value: 1},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
notifier.Spend(htlcOutpoint, 2, secondLvlTx)
|
notifier.Spend(htlcOutpoint, 2, secondLvlTx)
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conn is an implementation of net.Conn which enforces an authenticated key
|
// Conn is an implementation of net.Conn which enforces an authenticated key
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
type maybeNetConn struct {
|
type maybeNetConn struct {
|
||||||
|
@ -3,9 +3,9 @@ package bitcoindnotify
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/rpcclient"
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// createNewNotifier creates a new instance of the ChainNotifier interface
|
// createNewNotifier creates a new instance of the ChainNotifier interface
|
||||||
|
@ -3,8 +3,8 @@ package btcdnotify
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
|
||||||
"github.com/btcsuite/btcd/rpcclient"
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// createNewNotifier creates a new instance of the ChainNotifier interface
|
// createNewNotifier creates a new instance of the ChainNotifier interface
|
||||||
|
@ -3,11 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/discovery"
|
"github.com/lightningnetwork/lnd/discovery"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/routing"
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// chanSeries is an implementation of the discovery.ChannelGraphTimeSeries
|
// chanSeries is an implementation of the discovery.ChannelGraphTimeSeries
|
||||||
|
@ -3,13 +3,13 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
|
|
||||||
type unknownAddrType struct{}
|
type unknownAddrType struct{}
|
||||||
|
|
||||||
func (_ unknownAddrType) Network() string { return "unknown" }
|
func (t unknownAddrType) Network() string { return "unknown" }
|
||||||
func (_ unknownAddrType) String() string { return "unknown" }
|
func (t unknownAddrType) String() string { return "unknown" }
|
||||||
|
|
||||||
var addrTests = []struct {
|
var addrTests = []struct {
|
||||||
expAddr net.Addr
|
expAddr net.Addr
|
||||||
|
@ -299,7 +299,7 @@ type ChannelStatus uint8
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// Default is the normal state of an open channel.
|
// Default is the normal state of an open channel.
|
||||||
Default ChannelStatus = 0
|
Default ChannelStatus
|
||||||
|
|
||||||
// Borked indicates that the channel has entered an irreconcilable
|
// Borked indicates that the channel has entered an irreconcilable
|
||||||
// state, triggered by a state desynchronization or channel breach.
|
// state, triggered by a state desynchronization or channel breach.
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/shachain"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/shachain"
|
||||||
)
|
)
|
||||||
|
|
||||||
// outPointSize is the size of a serialized outpoint on disk.
|
// outPointSize is the size of a serialized outpoint on disk.
|
||||||
|
@ -613,8 +613,8 @@ func (d *DB) MarkChanFullyClosed(chanPoint *wire.OutPoint) error {
|
|||||||
// pruneLinkNode determines whether we should garbage collect a link node from
|
// pruneLinkNode determines whether we should garbage collect a link node from
|
||||||
// the database due to no longer having any open channels with it. If there are
|
// the database due to no longer having any open channels with it. If there are
|
||||||
// any left, then this acts as a no-op.
|
// any left, then this acts as a no-op.
|
||||||
func (db *DB) pruneLinkNode(tx *bolt.Tx, remotePub *btcec.PublicKey) error {
|
func (d *DB) pruneLinkNode(tx *bolt.Tx, remotePub *btcec.PublicKey) error {
|
||||||
openChannels, err := db.fetchOpenChannels(tx, remotePub)
|
openChannels, err := d.fetchOpenChannels(tx, remotePub)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to fetch open channels for peer %x: "+
|
return fmt.Errorf("unable to fetch open channels for peer %x: "+
|
||||||
"%v", remotePub.SerializeCompressed(), err)
|
"%v", remotePub.SerializeCompressed(), err)
|
||||||
@ -627,20 +627,20 @@ func (db *DB) pruneLinkNode(tx *bolt.Tx, remotePub *btcec.PublicKey) error {
|
|||||||
log.Infof("Pruning link node %x with zero open channels from database",
|
log.Infof("Pruning link node %x with zero open channels from database",
|
||||||
remotePub.SerializeCompressed())
|
remotePub.SerializeCompressed())
|
||||||
|
|
||||||
return db.deleteLinkNode(tx, remotePub)
|
return d.deleteLinkNode(tx, remotePub)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PruneLinkNodes attempts to prune all link nodes found within the databse with
|
// PruneLinkNodes attempts to prune all link nodes found within the databse with
|
||||||
// whom we no longer have any open channels with.
|
// whom we no longer have any open channels with.
|
||||||
func (db *DB) PruneLinkNodes() error {
|
func (d *DB) PruneLinkNodes() error {
|
||||||
return db.Update(func(tx *bolt.Tx) error {
|
return d.Update(func(tx *bolt.Tx) error {
|
||||||
linkNodes, err := db.fetchAllLinkNodes(tx)
|
linkNodes, err := d.fetchAllLinkNodes(tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, linkNode := range linkNodes {
|
for _, linkNode := range linkNodes {
|
||||||
err := db.pruneLinkNode(tx, linkNode.IdentityPub)
|
err := d.pruneLinkNode(tx, linkNode.IdentityPub)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,10 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestPkgFilterBruteForce tests the behavior of a pkg filter up to size 1000,
|
// TestPkgFilterBruteForce tests the behavior of a pkg filter up to size 1000,
|
||||||
|
@ -809,8 +809,8 @@ func (c *ChannelGraph) pruneGraphNodes(tx *bolt.Tx, nodes *bolt.Bucket,
|
|||||||
|
|
||||||
// With the nodes extracted, we'll increase the ref count of
|
// With the nodes extracted, we'll increase the ref count of
|
||||||
// each of the nodes.
|
// each of the nodes.
|
||||||
nodeRefCounts[node1] += 1
|
nodeRefCounts[node1]++
|
||||||
nodeRefCounts[node2] += 1
|
nodeRefCounts[node2]++
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -129,13 +129,13 @@ func putLinkNode(nodeMetaBucket *bolt.Bucket, l *LinkNode) error {
|
|||||||
|
|
||||||
// DeleteLinkNode removes the link node with the given identity from the
|
// DeleteLinkNode removes the link node with the given identity from the
|
||||||
// database.
|
// database.
|
||||||
func (d *DB) DeleteLinkNode(identity *btcec.PublicKey) error {
|
func (db *DB) DeleteLinkNode(identity *btcec.PublicKey) error {
|
||||||
return d.Update(func(tx *bolt.Tx) error {
|
return db.Update(func(tx *bolt.Tx) error {
|
||||||
return d.deleteLinkNode(tx, identity)
|
return db.deleteLinkNode(tx, identity)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DB) deleteLinkNode(tx *bolt.Tx, identity *btcec.PublicKey) error {
|
func (db *DB) deleteLinkNode(tx *bolt.Tx, identity *btcec.PublicKey) error {
|
||||||
nodeMetaBucket := tx.Bucket(nodeInfoBucket)
|
nodeMetaBucket := tx.Bucket(nodeInfoBucket)
|
||||||
if nodeMetaBucket == nil {
|
if nodeMetaBucket == nil {
|
||||||
return ErrLinkNodesNotFound
|
return ErrLinkNodesNotFound
|
||||||
|
@ -18,11 +18,11 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/awalterschulze/gographviz"
|
"github.com/awalterschulze/gographviz"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
@ -14,10 +14,10 @@ import (
|
|||||||
|
|
||||||
macaroon "gopkg.in/macaroon.v2"
|
macaroon "gopkg.in/macaroon.v2"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/lightningnetwork/lnd/lncfg"
|
"github.com/lightningnetwork/lnd/lncfg"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/macaroons"
|
"github.com/lightningnetwork/lnd/macaroons"
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -27,8 +27,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
defaultTLSCertFilename = "tls.cert"
|
defaultTLSCertFilename = "tls.cert"
|
||||||
defaultMacaroonFilename = "admin.macaroon"
|
defaultMacaroonFilename = "admin.macaroon"
|
||||||
defaultRpcPort = "10009"
|
defaultRPCPort = "10009"
|
||||||
defaultRpcHostPort = "localhost:" + defaultRpcPort
|
defaultRPCHostPort = "localhost:" + defaultRPCPort
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -150,7 +150,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
|
|||||||
// and not just TCP addresses.
|
// and not just TCP addresses.
|
||||||
opts = append(
|
opts = append(
|
||||||
opts, grpc.WithDialer(
|
opts, grpc.WithDialer(
|
||||||
lncfg.ClientAddressDialer(defaultRpcPort),
|
lncfg.ClientAddressDialer(defaultRPCPort),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
conn, err := grpc.Dial(ctx.GlobalString("rpcserver"), opts...)
|
conn, err := grpc.Dial(ctx.GlobalString("rpcserver"), opts...)
|
||||||
@ -169,7 +169,7 @@ func main() {
|
|||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "rpcserver",
|
Name: "rpcserver",
|
||||||
Value: defaultRpcHostPort,
|
Value: defaultRPCHostPort,
|
||||||
Usage: "host:port of ln daemon",
|
Usage: "host:port of ln daemon",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
|
@ -6,11 +6,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContractResolutions is a wrapper struct around the two forms of resolutions
|
// ContractResolutions is a wrapper struct around the two forms of resolutions
|
||||||
|
@ -10,15 +10,15 @@ import (
|
|||||||
|
|
||||||
prand "math/rand"
|
prand "math/rand"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/btcsuite/btcd/txscript"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,11 +3,11 @@ package discovery
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ValidateChannelAnn validates the channel announcement message and checks
|
// ValidateChannelAnn validates the channel announcement message and checks
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcutil/bech32"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/lightningnetwork/lnd/autopilot"
|
"github.com/lightningnetwork/lnd/autopilot"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/tor"
|
"github.com/lightningnetwork/lnd/tor"
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcutil/bech32"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -1225,9 +1225,9 @@ func (d *AuthenticatedGossiper) networkHandler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(roasbeef): d/c peers that send uupdates not on our chain
|
// TODO(roasbeef): d/c peers that send updates not on our chain
|
||||||
|
|
||||||
// InitPeerSyncState is called by outside sub-systems when a connection is
|
// InitSyncState is called by outside sub-systems when a connection is
|
||||||
// established to a new peer that understands how to perform channel range
|
// established to a new peer that understands how to perform channel range
|
||||||
// queries. We'll allocate a new gossip syncer for it, and start any goroutines
|
// queries. We'll allocate a new gossip syncer for it, and start any goroutines
|
||||||
// needed to handle new queries. The recvUpdates bool indicates if we should
|
// needed to handle new queries. The recvUpdates bool indicates if we should
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package discovery
|
package discovery
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateChanAnnouncement is a helper function which creates all channel
|
// CreateChanAnnouncement is a helper function which creates all channel
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
bitcoinCfg "github.com/btcsuite/btcd/chaincfg"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/lightningnetwork/lightning-onion"
|
"github.com/lightningnetwork/lightning-onion"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
bitcoinCfg "github.com/btcsuite/btcd/chaincfg"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/lightningnetwork/lightning-onion"
|
"github.com/lightningnetwork/lightning-onion"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ForwardingError wraps an lnwire.FailureMessage in a struct that also
|
// ForwardingError wraps an lnwire.FailureMessage in a struct that also
|
||||||
|
@ -4,9 +4,9 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/lightningnetwork/lightning-onion"
|
"github.com/lightningnetwork/lightning-onion"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetworkHop indicates the blockchain network that is intended to be the next
|
// NetworkHop indicates the blockchain network that is intended to be the next
|
||||||
|
@ -40,10 +40,12 @@ const (
|
|||||||
// and accepting updates.
|
// and accepting updates.
|
||||||
minCommitFeePerKw = 253
|
minCommitFeePerKw = 253
|
||||||
|
|
||||||
// DefaultMinLinkFeeUpdateTimeout and DefaultMaxLinkFeeUpdateTimeout
|
// DefaultMinLinkFeeUpdateTimeout represents the minimum interval in
|
||||||
// represent the default timeout bounds in which a link should propose
|
// which a link should propose to update its commitment fee rate.
|
||||||
// to update its commitment fee rate.
|
|
||||||
DefaultMinLinkFeeUpdateTimeout = 10 * time.Minute
|
DefaultMinLinkFeeUpdateTimeout = 10 * time.Minute
|
||||||
|
|
||||||
|
// DefaultMaxLinkFeeUpdateTimeout represents the maximum interval in
|
||||||
|
// which a link should propose to update its commitment fee rate.
|
||||||
DefaultMaxLinkFeeUpdateTimeout = 60 * time.Minute
|
DefaultMaxLinkFeeUpdateTimeout = 60 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/fastsha256"
|
"github.com/btcsuite/fastsha256"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func genPreimage() ([32]byte, error) {
|
func genPreimage() ([32]byte, error) {
|
||||||
|
@ -14,6 +14,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/fastsha256"
|
"github.com/btcsuite/fastsha256"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
@ -24,10 +28,6 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/shachain"
|
"github.com/lightningnetwork/lnd/shachain"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -72,8 +72,8 @@ func ListenOnAddress(addr net.Addr) (net.Listener, error) {
|
|||||||
return net.Listen(addr.Network(), addr.String())
|
return net.Listen(addr.Network(), addr.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// TlsListenOnAddress creates a TLS listener that listens on the given address.
|
// TLSListenOnAddress creates a TLS listener that listens on the given address.
|
||||||
func TlsListenOnAddress(addr net.Addr,
|
func TLSListenOnAddress(addr net.Addr,
|
||||||
config *tls.Config) (net.Listener, error) {
|
config *tls.Config) (net.Listener, error) {
|
||||||
return tls.Listen(addr.Network(), addr.String(), config)
|
return tls.Listen(addr.Network(), addr.String(), config)
|
||||||
}
|
}
|
||||||
|
4
lnd.go
4
lnd.go
@ -360,7 +360,7 @@ func lndMain() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, restEndpoint := range cfg.RESTListeners {
|
for _, restEndpoint := range cfg.RESTListeners {
|
||||||
lis, err := lncfg.TlsListenOnAddress(restEndpoint, tlsConf)
|
lis, err := lncfg.TLSListenOnAddress(restEndpoint, tlsConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ltndLog.Errorf(
|
ltndLog.Errorf(
|
||||||
"gRPC proxy unable to listen on %s",
|
"gRPC proxy unable to listen on %s",
|
||||||
@ -761,7 +761,7 @@ func waitForWalletPassword(grpcEndpoints, restEndpoints []net.Addr,
|
|||||||
srv := &http.Server{Handler: mux}
|
srv := &http.Server{Handler: mux}
|
||||||
|
|
||||||
for _, restEndpoint := range restEndpoints {
|
for _, restEndpoint := range restEndpoints {
|
||||||
lis, err := lncfg.TlsListenOnAddress(restEndpoint, tlsConf)
|
lis, err := lncfg.TLSListenOnAddress(restEndpoint, tlsConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ltndLog.Errorf(
|
ltndLog.Errorf(
|
||||||
"password gRPC proxy unable to listen on %s",
|
"password gRPC proxy unable to listen on %s",
|
||||||
|
@ -3995,7 +3995,9 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// We'll decode the invoice's payment request to determine which
|
// We'll decode the invoice's payment request to determine which
|
||||||
// channels were used as routing hints.
|
// channels were used as routing hints.
|
||||||
payReq := &lnrpc.PayReqString{resp.PaymentRequest}
|
payReq := &lnrpc.PayReqString{
|
||||||
|
PayReq: resp.PaymentRequest,
|
||||||
|
}
|
||||||
decoded, err = net.Alice.DecodePayReq(ctxb, payReq)
|
decoded, err = net.Alice.DecodePayReq(ctxb, payReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
predErr = fmt.Errorf("unable to decode payment "+
|
predErr = fmt.Errorf("unable to decode payment "+
|
||||||
@ -10784,7 +10786,7 @@ func testRouteFeeCutoff(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
for i, hop := range route.Hops {
|
for i, hop := range route.Hops {
|
||||||
if hop.ChanId != hopChanIDs[i] {
|
if hop.ChanId != hopChanIDs[i] {
|
||||||
t.Fatalf("expected chan id %d, got %d",
|
t.Fatalf("expected chan id %d, got %d",
|
||||||
hop.ChanId)
|
hopChanIDs[i], hop.ChanId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/integration/rpctest"
|
"github.com/btcsuite/btcd/integration/rpctest"
|
||||||
@ -19,6 +18,7 @@ import (
|
|||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetworkHarness is an integration testing harness for the lightning network.
|
// NetworkHarness is an integration testing harness for the lightning network.
|
||||||
|
@ -20,13 +20,13 @@ import (
|
|||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
macaroon "gopkg.in/macaroon.v2"
|
macaroon "gopkg.in/macaroon.v2"
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
|
||||||
"github.com/lightningnetwork/lnd/macaroons"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/rpcclient"
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/go-errors/errors"
|
||||||
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
|
"github.com/lightningnetwork/lnd/macaroons"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -302,8 +302,10 @@ func (hn *HarnessNode) start(lndError chan<- error) error {
|
|||||||
hex.EncodeToString(hn.PubKey[:logPubKeyBytes]))
|
hex.EncodeToString(hn.PubKey[:logPubKeyBytes]))
|
||||||
err := os.Rename(fileName, newFileName)
|
err := os.Rename(fileName, newFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("could not rename %s to %s: %v",
|
fmt.Printf("could not rename "+
|
||||||
fileName, newFileName, err)
|
"%s to %s: %v\n",
|
||||||
|
fileName, newFileName,
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +483,7 @@ func (hn *HarnessNode) writePidFile() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// connectRPC uses the TLS certificate and admin macaroon files written by the
|
// ConnectRPC uses the TLS certificate and admin macaroon files written by the
|
||||||
// lnd node to create a gRPC client connection.
|
// lnd node to create a gRPC client connection.
|
||||||
func (hn *HarnessNode) ConnectRPC(useMacs bool) (*grpc.ClientConn, error) {
|
func (hn *HarnessNode) ConnectRPC(useMacs bool) (*grpc.ClientConn, error) {
|
||||||
// Wait until TLS certificate and admin macaroon are created before
|
// Wait until TLS certificate and admin macaroon are created before
|
||||||
|
@ -3,8 +3,8 @@ package btcwallet
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
|
||||||
"github.com/btcsuite/btcwallet/chain"
|
"github.com/btcsuite/btcwallet/chain"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package btcwallet
|
package btcwallet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-errors/errors"
|
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
@ -12,6 +9,9 @@ import (
|
|||||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||||
base "github.com/btcsuite/btcwallet/wallet"
|
base "github.com/btcsuite/btcwallet/wallet"
|
||||||
"github.com/btcsuite/btcwallet/walletdb"
|
"github.com/btcsuite/btcwallet/walletdb"
|
||||||
|
"github.com/go-errors/errors"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FetchInputInfo queries for the WalletController's knowledge of the passed
|
// FetchInputInfo queries for the WalletController's knowledge of the passed
|
||||||
|
@ -3924,7 +3924,7 @@ func (i *InvalidCommitSigError) Error() string {
|
|||||||
// error interface.
|
// error interface.
|
||||||
var _ error = (*InvalidCommitSigError)(nil)
|
var _ error = (*InvalidCommitSigError)(nil)
|
||||||
|
|
||||||
// InvalidCommitSigError is a struc that implements the error interface to
|
// InvalidHtlcSigError is a struct that implements the error interface to
|
||||||
// report a failure to validate an htlc signature from a remote peer. We'll use
|
// report a failure to validate an htlc signature from a remote peer. We'll use
|
||||||
// the items in this struct to generate a rich error message for the remote
|
// the items in this struct to generate a rich error message for the remote
|
||||||
// peer when we receive an invalid signature from it. Doing so can greatly aide
|
// peer when we receive an invalid signature from it. Doing so can greatly aide
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package lnwallet
|
package lnwallet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is a struct which houses configuration parameters which modify the
|
// Config is a struct which houses configuration parameters which modify the
|
||||||
|
@ -4,9 +4,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReservationError wraps certain errors returned during channel reservation
|
// ReservationError wraps certain errors returned during channel reservation
|
||||||
|
@ -3,8 +3,8 @@ package lnwallet_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestFeeRateTypes checks that converting fee rates between the
|
// TestFeeRateTypes checks that converting fee rates between the
|
||||||
|
@ -2190,7 +2190,6 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
|
|||||||
t.Fatalf("couldn't start bob client: %v", err)
|
t.Fatalf("couldn't start bob client: %v", err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return
|
|
||||||
t.Fatalf("unknown chain driver: %v", backEnd)
|
t.Fatalf("unknown chain driver: %v", backEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChannelContribution is the primary constituent of the funding workflow
|
// ChannelContribution is the primary constituent of the funding workflow
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSignDescriptorSerialization(t *testing.T) {
|
func TestSignDescriptorSerialization(t *testing.T) {
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -3,12 +3,12 @@ package lnwallet_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
|
||||||
"github.com/btcsuite/btcd/blockchain"
|
"github.com/btcsuite/btcd/blockchain"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTxWeightEstimator tests that transaction weight estimates are calculated
|
// TestTxWeightEstimator tests that transaction weight estimates are calculated
|
||||||
|
@ -12,16 +12,16 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/shachain"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/shachain"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -6,16 +6,16 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/shachain"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/davecgh/go-spew/spew"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/shachain"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,7 @@ func (g *GossipTimestampRange) MsgType() MessageType {
|
|||||||
// version.
|
// version.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *GossipTimestampRange) MaxPayloadLength(uint32) uint32 {
|
func (g *GossipTimestampRange) MaxPayloadLength(uint32) uint32 {
|
||||||
// 32 + 4 + 4
|
// 32 + 4 + 4
|
||||||
//
|
//
|
||||||
// TODO(roasbeef): update to 8 byte timestmaps?
|
// TODO(roasbeef): update to 8 byte timestmaps?
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package macaroons_test
|
package macaroons_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/lightningnetwork/lnd/macaroons"
|
"github.com/lightningnetwork/lnd/macaroons"
|
||||||
"gopkg.in/macaroon.v2"
|
"gopkg.in/macaroon.v2"
|
||||||
"time"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -99,7 +99,7 @@ func TestIpLockConstraint(t *testing.T) {
|
|||||||
// TestIPLockBadIP tests that an IP constraint cannot be added if the
|
// TestIPLockBadIP tests that an IP constraint cannot be added if the
|
||||||
// provided string is not a valid IP address.
|
// provided string is not a valid IP address.
|
||||||
func TestIPLockBadIP(t *testing.T) {
|
func TestIPLockBadIP(t *testing.T) {
|
||||||
constraintFunc := macaroons.IPLockConstraint("127.0.0/800");
|
constraintFunc := macaroons.IPLockConstraint("127.0.0/800")
|
||||||
testMacaroon := createDummyMacaroon(t)
|
testMacaroon := createDummyMacaroon(t)
|
||||||
err := constraintFunc(testMacaroon)
|
err := constraintFunc(testMacaroon)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
package macaroons_test
|
package macaroons_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"path"
|
|
||||||
"os"
|
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/lightningnetwork/lnd/macaroons"
|
"github.com/lightningnetwork/lnd/macaroons"
|
||||||
"gopkg.in/macaroon-bakery.v2/bakery/checkers"
|
|
||||||
"gopkg.in/macaroon-bakery.v2/bakery"
|
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
"gopkg.in/macaroon-bakery.v2/bakery"
|
||||||
|
"gopkg.in/macaroon-bakery.v2/bakery/checkers"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,9 +3,9 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nodeSigner is an implementation of the MessageSigner interface backed by the
|
// nodeSigner is an implementation of the MessageSigner interface backed by the
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/coreos/bbolt"
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/coreos/bbolt"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Overview of Nursery Store Storage Hierarchy
|
// Overview of Nursery Store Storage Hierarchy
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btclog"
|
"github.com/btcsuite/btclog"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -6,7 +6,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btclog"
|
"github.com/btcsuite/btclog"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/contractcourt"
|
"github.com/lightningnetwork/lnd/contractcourt"
|
||||||
@ -14,8 +16,6 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TopologyClient represents an intent to receive notifications from the
|
// TopologyClient represents an intent to receive notifications from the
|
||||||
|
@ -8,13 +8,13 @@ import (
|
|||||||
|
|
||||||
"container/heap"
|
"container/heap"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/lightningnetwork/lightning-onion"
|
"github.com/lightningnetwork/lightning-onion"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -358,7 +358,7 @@ func newRoute(amtToSend, feeLimit lnwire.MilliSatoshi, sourceVertex Vertex,
|
|||||||
// enough capacity to carry the required amount which
|
// enough capacity to carry the required amount which
|
||||||
// includes the fee dictated at each hop. Make the comparison
|
// includes the fee dictated at each hop. Make the comparison
|
||||||
// in msat to prevent rounding errors.
|
// in msat to prevent rounding errors.
|
||||||
if currentHop.AmtToForward + fee > lnwire.NewMSatFromSatoshis(
|
if currentHop.AmtToForward+fee > lnwire.NewMSatFromSatoshis(
|
||||||
currentHop.Channel.Capacity) {
|
currentHop.Channel.Capacity) {
|
||||||
|
|
||||||
err := fmt.Sprintf("channel graph has insufficient "+
|
err := fmt.Sprintf("channel graph has insufficient "+
|
||||||
|
@ -16,12 +16,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
|
||||||
prand "math/rand"
|
prand "math/rand"
|
||||||
)
|
)
|
||||||
@ -901,14 +901,14 @@ func TestNewRoute(t *testing.T) {
|
|||||||
createHop := func(baseFee lnwire.MilliSatoshi,
|
createHop := func(baseFee lnwire.MilliSatoshi,
|
||||||
feeRate lnwire.MilliSatoshi,
|
feeRate lnwire.MilliSatoshi,
|
||||||
capacity btcutil.Amount,
|
capacity btcutil.Amount,
|
||||||
timeLockDelta uint16) (*ChannelHop) {
|
timeLockDelta uint16) *ChannelHop {
|
||||||
|
|
||||||
return &ChannelHop {
|
return &ChannelHop{
|
||||||
ChannelEdgePolicy: &channeldb.ChannelEdgePolicy {
|
ChannelEdgePolicy: &channeldb.ChannelEdgePolicy{
|
||||||
Node: &channeldb.LightningNode{},
|
Node: &channeldb.LightningNode{},
|
||||||
FeeProportionalMillionths: feeRate,
|
FeeProportionalMillionths: feeRate,
|
||||||
FeeBaseMSat: baseFee,
|
FeeBaseMSat: baseFee,
|
||||||
TimeLockDelta: timeLockDelta,
|
TimeLockDelta: timeLockDelta,
|
||||||
},
|
},
|
||||||
Capacity: capacity,
|
Capacity: capacity,
|
||||||
}
|
}
|
||||||
@ -916,30 +916,30 @@ func TestNewRoute(t *testing.T) {
|
|||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
// name identifies the test case in the test output.
|
// name identifies the test case in the test output.
|
||||||
name string
|
name string
|
||||||
|
|
||||||
// hops is the list of hops (the route) that gets passed into
|
// hops is the list of hops (the route) that gets passed into
|
||||||
// the call to newRoute.
|
// the call to newRoute.
|
||||||
hops []*ChannelHop
|
hops []*ChannelHop
|
||||||
|
|
||||||
// paymentAmount is the amount that is send into the route
|
// paymentAmount is the amount that is send into the route
|
||||||
// indicated by hops.
|
// indicated by hops.
|
||||||
paymentAmount lnwire.MilliSatoshi
|
paymentAmount lnwire.MilliSatoshi
|
||||||
|
|
||||||
// expectedFees is a list of fees that every hop is expected
|
// expectedFees is a list of fees that every hop is expected
|
||||||
// to charge for forwarding.
|
// to charge for forwarding.
|
||||||
expectedFees []lnwire.MilliSatoshi
|
expectedFees []lnwire.MilliSatoshi
|
||||||
|
|
||||||
// expectedTimeLocks is a list of time lock values that every
|
// expectedTimeLocks is a list of time lock values that every
|
||||||
// hop is expected to specify in its outgoing HTLC. The time
|
// hop is expected to specify in its outgoing HTLC. The time
|
||||||
// lock values in this list are relative to the current block
|
// lock values in this list are relative to the current block
|
||||||
// height.
|
// height.
|
||||||
expectedTimeLocks []uint32
|
expectedTimeLocks []uint32
|
||||||
|
|
||||||
// expectedTotalAmount is the total amount that is expected to
|
// expectedTotalAmount is the total amount that is expected to
|
||||||
// be returned from newRoute. This amount should include all
|
// be returned from newRoute. This amount should include all
|
||||||
// the fees to be paid to intermediate hops.
|
// the fees to be paid to intermediate hops.
|
||||||
expectedTotalAmount lnwire.MilliSatoshi
|
expectedTotalAmount lnwire.MilliSatoshi
|
||||||
|
|
||||||
// expectedTotalTimeLock is the time lock that is expected to
|
// expectedTotalTimeLock is the time lock that is expected to
|
||||||
// be returned from newRoute. This is the time lock that should
|
// be returned from newRoute. This is the time lock that should
|
||||||
@ -949,106 +949,106 @@ func TestNewRoute(t *testing.T) {
|
|||||||
|
|
||||||
// expectError indicates whether the newRoute call is expected
|
// expectError indicates whether the newRoute call is expected
|
||||||
// to fail or succeed.
|
// to fail or succeed.
|
||||||
expectError bool
|
expectError bool
|
||||||
|
|
||||||
// expectedErrorCode indicates the expected error code when
|
// expectedErrorCode indicates the expected error code when
|
||||||
// expectError is true.
|
// expectError is true.
|
||||||
expectedErrorCode errorCode
|
expectedErrorCode errorCode
|
||||||
} {
|
}{
|
||||||
{
|
{
|
||||||
// For a single hop payment, no fees are expected to be paid.
|
// For a single hop payment, no fees are expected to be paid.
|
||||||
name: "single hop",
|
name: "single hop",
|
||||||
paymentAmount: 100000,
|
paymentAmount: 100000,
|
||||||
hops: []*ChannelHop {
|
hops: []*ChannelHop{
|
||||||
createHop(100, 1000, 1000, 10),
|
createHop(100, 1000, 1000, 10),
|
||||||
},
|
},
|
||||||
expectedFees: []lnwire.MilliSatoshi {0},
|
expectedFees: []lnwire.MilliSatoshi{0},
|
||||||
expectedTimeLocks: []uint32 {1},
|
expectedTimeLocks: []uint32{1},
|
||||||
expectedTotalAmount: 100000,
|
expectedTotalAmount: 100000,
|
||||||
expectedTotalTimeLock: 1,
|
expectedTotalTimeLock: 1,
|
||||||
}, {
|
}, {
|
||||||
// For a two hop payment, only the fee for the first hop
|
// For a two hop payment, only the fee for the first hop
|
||||||
// needs to be paid. The destination hop does not require
|
// needs to be paid. The destination hop does not require
|
||||||
// a fee to receive the payment.
|
// a fee to receive the payment.
|
||||||
name: "two hop",
|
name: "two hop",
|
||||||
paymentAmount: 100000,
|
paymentAmount: 100000,
|
||||||
hops: []*ChannelHop {
|
hops: []*ChannelHop{
|
||||||
createHop(0, 1000, 1000, 10),
|
createHop(0, 1000, 1000, 10),
|
||||||
createHop(30, 1000, 1000, 5),
|
createHop(30, 1000, 1000, 5),
|
||||||
},
|
},
|
||||||
expectedFees: []lnwire.MilliSatoshi {130, 0},
|
expectedFees: []lnwire.MilliSatoshi{130, 0},
|
||||||
expectedTimeLocks: []uint32 {1, 1},
|
expectedTimeLocks: []uint32{1, 1},
|
||||||
expectedTotalAmount: 100130,
|
expectedTotalAmount: 100130,
|
||||||
expectedTotalTimeLock: 6,
|
expectedTotalTimeLock: 6,
|
||||||
}, {
|
}, {
|
||||||
// Insufficient capacity in first channel when fees are added.
|
// Insufficient capacity in first channel when fees are added.
|
||||||
name: "two hop insufficient",
|
name: "two hop insufficient",
|
||||||
paymentAmount: 100000,
|
paymentAmount: 100000,
|
||||||
hops: []*ChannelHop {
|
hops: []*ChannelHop{
|
||||||
createHop(0, 1000, 100, 10),
|
createHop(0, 1000, 100, 10),
|
||||||
createHop(0, 1000, 1000, 5),
|
createHop(0, 1000, 1000, 5),
|
||||||
},
|
},
|
||||||
expectError: true,
|
expectError: true,
|
||||||
expectedErrorCode: ErrInsufficientCapacity,
|
expectedErrorCode: ErrInsufficientCapacity,
|
||||||
}, {
|
}, {
|
||||||
// A three hop payment where the first and second hop
|
// A three hop payment where the first and second hop
|
||||||
// will both charge 1 msat. The fee for the first hop
|
// will both charge 1 msat. The fee for the first hop
|
||||||
// is actually slightly higher than 1, because the amount
|
// is actually slightly higher than 1, because the amount
|
||||||
// to forward also includes the fee for the second hop. This
|
// to forward also includes the fee for the second hop. This
|
||||||
// gets rounded down to 1.
|
// gets rounded down to 1.
|
||||||
name: "three hop",
|
name: "three hop",
|
||||||
paymentAmount: 100000,
|
paymentAmount: 100000,
|
||||||
hops: []*ChannelHop {
|
hops: []*ChannelHop{
|
||||||
createHop(0, 10, 1000, 10),
|
createHop(0, 10, 1000, 10),
|
||||||
createHop(0, 10, 1000, 5),
|
createHop(0, 10, 1000, 5),
|
||||||
createHop(0, 10, 1000, 3),
|
createHop(0, 10, 1000, 3),
|
||||||
},
|
},
|
||||||
expectedFees: []lnwire.MilliSatoshi {1, 1, 0},
|
expectedFees: []lnwire.MilliSatoshi{1, 1, 0},
|
||||||
expectedTotalAmount: 100002,
|
expectedTotalAmount: 100002,
|
||||||
expectedTimeLocks: []uint32 {4, 1, 1},
|
expectedTimeLocks: []uint32{4, 1, 1},
|
||||||
expectedTotalTimeLock: 9,
|
expectedTotalTimeLock: 9,
|
||||||
}, {
|
}, {
|
||||||
// A three hop payment where the fee of the first hop
|
// A three hop payment where the fee of the first hop
|
||||||
// is slightly higher (11) than the fee at the second hop,
|
// is slightly higher (11) than the fee at the second hop,
|
||||||
// because of the increase amount to forward.
|
// because of the increase amount to forward.
|
||||||
name: "three hop with fee carry over",
|
name: "three hop with fee carry over",
|
||||||
paymentAmount: 100000,
|
paymentAmount: 100000,
|
||||||
hops: []*ChannelHop {
|
hops: []*ChannelHop{
|
||||||
createHop(0, 10000, 1000, 10),
|
createHop(0, 10000, 1000, 10),
|
||||||
createHop(0, 10000, 1000, 5),
|
createHop(0, 10000, 1000, 5),
|
||||||
createHop(0, 10000, 1000, 3),
|
createHop(0, 10000, 1000, 3),
|
||||||
},
|
},
|
||||||
expectedFees: []lnwire.MilliSatoshi {1010, 1000, 0},
|
expectedFees: []lnwire.MilliSatoshi{1010, 1000, 0},
|
||||||
expectedTotalAmount: 102010,
|
expectedTotalAmount: 102010,
|
||||||
expectedTimeLocks: []uint32 {4, 1, 1},
|
expectedTimeLocks: []uint32{4, 1, 1},
|
||||||
expectedTotalTimeLock: 9,
|
expectedTotalTimeLock: 9,
|
||||||
}, {
|
}, {
|
||||||
// A three hop payment where the fee policies of the first and
|
// A three hop payment where the fee policies of the first and
|
||||||
// second hop are just high enough to show the fee carry over
|
// second hop are just high enough to show the fee carry over
|
||||||
// effect.
|
// effect.
|
||||||
name: "three hop with minimal fees for carry over",
|
name: "three hop with minimal fees for carry over",
|
||||||
paymentAmount: 100000,
|
paymentAmount: 100000,
|
||||||
hops: []*ChannelHop {
|
hops: []*ChannelHop{
|
||||||
createHop(0, 10000, 1000, 10),
|
createHop(0, 10000, 1000, 10),
|
||||||
|
|
||||||
// First hop charges 0.1% so the second hop fee
|
// First hop charges 0.1% so the second hop fee
|
||||||
// should show up in the first hop fee as 1 msat
|
// should show up in the first hop fee as 1 msat
|
||||||
// extra.
|
// extra.
|
||||||
createHop(0, 1000, 1000, 5),
|
createHop(0, 1000, 1000, 5),
|
||||||
|
|
||||||
// Second hop charges a fixed 1000 msat.
|
// Second hop charges a fixed 1000 msat.
|
||||||
createHop(1000, 0, 1000, 3),
|
createHop(1000, 0, 1000, 3),
|
||||||
},
|
},
|
||||||
expectedFees: []lnwire.MilliSatoshi {101, 1000, 0},
|
expectedFees: []lnwire.MilliSatoshi{101, 1000, 0},
|
||||||
expectedTotalAmount: 101101,
|
expectedTotalAmount: 101101,
|
||||||
expectedTimeLocks: []uint32 {4, 1, 1},
|
expectedTimeLocks: []uint32{4, 1, 1},
|
||||||
expectedTotalTimeLock: 9,
|
expectedTotalTimeLock: 9,
|
||||||
} }
|
}}
|
||||||
|
|
||||||
for _, testCase := range testCases {
|
for _, testCase := range testCases {
|
||||||
assertRoute := func(t *testing.T, route *Route) {
|
assertRoute := func(t *testing.T, route *Route) {
|
||||||
if route.TotalAmount != testCase.expectedTotalAmount {
|
if route.TotalAmount != testCase.expectedTotalAmount {
|
||||||
t.Errorf("Expected total amount is be %v" +
|
t.Errorf("Expected total amount is be %v"+
|
||||||
", but got %v instead",
|
", but got %v instead",
|
||||||
testCase.expectedTotalAmount,
|
testCase.expectedTotalAmount,
|
||||||
route.TotalAmount)
|
route.TotalAmount)
|
||||||
@ -1058,10 +1058,10 @@ func TestNewRoute(t *testing.T) {
|
|||||||
if testCase.expectedFees[i] !=
|
if testCase.expectedFees[i] !=
|
||||||
route.Hops[i].Fee {
|
route.Hops[i].Fee {
|
||||||
|
|
||||||
t.Errorf("Expected fee for hop %v to " +
|
t.Errorf("Expected fee for hop %v to "+
|
||||||
"be %v, but got %v instead",
|
"be %v, but got %v instead",
|
||||||
i, testCase.expectedFees[i],
|
i, testCase.expectedFees[i],
|
||||||
route.Hops[i].Fee)
|
route.Hops[i].Fee)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,7 +1070,7 @@ func TestNewRoute(t *testing.T) {
|
|||||||
|
|
||||||
if route.TotalTimeLock != expectedTimeLockHeight {
|
if route.TotalTimeLock != expectedTimeLockHeight {
|
||||||
|
|
||||||
t.Errorf("Expected total time lock to be %v" +
|
t.Errorf("Expected total time lock to be %v"+
|
||||||
", but got %v instead",
|
", but got %v instead",
|
||||||
expectedTimeLockHeight,
|
expectedTimeLockHeight,
|
||||||
route.TotalTimeLock)
|
route.TotalTimeLock)
|
||||||
@ -1083,10 +1083,10 @@ func TestNewRoute(t *testing.T) {
|
|||||||
if expectedTimeLockHeight !=
|
if expectedTimeLockHeight !=
|
||||||
route.Hops[i].OutgoingTimeLock {
|
route.Hops[i].OutgoingTimeLock {
|
||||||
|
|
||||||
t.Errorf("Expected time lock for hop " +
|
t.Errorf("Expected time lock for hop "+
|
||||||
"%v to be %v, but got %v instead",
|
"%v to be %v, but got %v instead",
|
||||||
i, expectedTimeLockHeight,
|
i, expectedTimeLockHeight,
|
||||||
route.Hops[i].OutgoingTimeLock)
|
route.Hops[i].OutgoingTimeLock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1100,10 +1100,10 @@ func TestNewRoute(t *testing.T) {
|
|||||||
if testCase.expectError {
|
if testCase.expectError {
|
||||||
expectedCode := testCase.expectedErrorCode
|
expectedCode := testCase.expectedErrorCode
|
||||||
if err == nil || !IsError(err, expectedCode) {
|
if err == nil || !IsError(err, expectedCode) {
|
||||||
t.Errorf("expected newRoute to fail " +
|
t.Errorf("expected newRoute to fail "+
|
||||||
"with error code %v, but got" +
|
"with error code %v, but got"+
|
||||||
"%v instead",
|
"%v instead",
|
||||||
expectedCode, err)
|
expectedCode, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
84
rpcserver.go
84
rpcserver.go
@ -18,6 +18,13 @@ import (
|
|||||||
|
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/blockchain"
|
||||||
|
"github.com/btcsuite/btcd/btcec"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||||
"github.com/coreos/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
@ -28,13 +35,6 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/routing"
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
"github.com/lightningnetwork/lnd/signal"
|
"github.com/lightningnetwork/lnd/signal"
|
||||||
"github.com/lightningnetwork/lnd/zpay32"
|
"github.com/lightningnetwork/lnd/zpay32"
|
||||||
"github.com/btcsuite/btcd/blockchain"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/btcsuite/btcd/txscript"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
"github.com/btcsuite/btcutil"
|
|
||||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
|
||||||
"github.com/tv42/zbase32"
|
"github.com/tv42/zbase32"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
@ -2101,12 +2101,20 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
|
|||||||
return payIntent, nil
|
return payIntent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type paymentIntentResponse struct {
|
||||||
|
Route *routing.Route
|
||||||
|
Preimage [32]byte
|
||||||
|
Err error
|
||||||
|
}
|
||||||
|
|
||||||
// dispatchPaymentIntent attempts to fully dispatch an RPC payment intent.
|
// dispatchPaymentIntent attempts to fully dispatch an RPC payment intent.
|
||||||
// We'll either pass the payment as a whole to the channel router, or give it a
|
// We'll either pass the payment as a whole to the channel router, or give it a
|
||||||
// pre-built route. The first error this method returns denotes if we were
|
// pre-built route. The first error this method returns denotes if we were
|
||||||
// unable to save the payment. The second error returned denotes if the payment
|
// unable to save the payment. The second error returned denotes if the payment
|
||||||
// didn't succeed.
|
// didn't succeed.
|
||||||
func (r *rpcServer) dispatchPaymentIntent(payIntent *rpcPaymentIntent) (*routing.Route, [32]byte, error, error) {
|
func (r *rpcServer) dispatchPaymentIntent(
|
||||||
|
payIntent *rpcPaymentIntent) (*paymentIntentResponse, error) {
|
||||||
|
|
||||||
// Construct a payment request to send to the channel router. If the
|
// Construct a payment request to send to the channel router. If the
|
||||||
// payment is successful, the route chosen will be returned. Otherwise,
|
// payment is successful, the route chosen will be returned. Otherwise,
|
||||||
// we'll get a non-nil error.
|
// we'll get a non-nil error.
|
||||||
@ -2149,7 +2157,9 @@ func (r *rpcServer) dispatchPaymentIntent(payIntent *rpcPaymentIntent) (*routing
|
|||||||
// If the route failed, then we'll return a nil save err, but a non-nil
|
// If the route failed, then we'll return a nil save err, but a non-nil
|
||||||
// routing err.
|
// routing err.
|
||||||
if routerErr != nil {
|
if routerErr != nil {
|
||||||
return nil, preImage, nil, routerErr
|
return &paymentIntentResponse{
|
||||||
|
Err: routerErr,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a route was used to complete this payment, then we'll need to
|
// If a route was used to complete this payment, then we'll need to
|
||||||
@ -2167,10 +2177,13 @@ func (r *rpcServer) dispatchPaymentIntent(payIntent *rpcPaymentIntent) (*routing
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// We weren't able to save the payment, so we return the save
|
// We weren't able to save the payment, so we return the save
|
||||||
// err, but a nil routing err.
|
// err, but a nil routing err.
|
||||||
return nil, preImage, err, nil
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return route, preImage, nil, nil
|
return &paymentIntentResponse{
|
||||||
|
Route: route,
|
||||||
|
Preimage: preImage,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendPayment takes a paymentStream (a source of pre-built routes or payment
|
// sendPayment takes a paymentStream (a source of pre-built routes or payment
|
||||||
@ -2283,34 +2296,35 @@ func (r *rpcServer) sendPayment(stream *paymentStream) error {
|
|||||||
htlcSema <- struct{}{}
|
htlcSema <- struct{}{}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
route, preImage, saveErr, routeErr := r.dispatchPaymentIntent(
|
resp, saveErr := r.dispatchPaymentIntent(
|
||||||
payIntent,
|
payIntent,
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
// If we receive payment error than, instead of
|
|
||||||
// terminating the stream, send error response
|
|
||||||
// to the user.
|
|
||||||
case routeErr != nil:
|
|
||||||
err := stream.send(&lnrpc.SendResponse{
|
|
||||||
PaymentError: routeErr.Error(),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
errChan <- err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
|
|
||||||
// If we were unable to save the state of the
|
// If we were unable to save the state of the
|
||||||
// payment, then we'll return the error to the
|
// payment, then we'll return the error to the
|
||||||
// user, and terminate.
|
// user, and terminate.
|
||||||
case saveErr != nil:
|
case saveErr != nil:
|
||||||
errChan <- saveErr
|
errChan <- saveErr
|
||||||
return
|
return
|
||||||
|
|
||||||
|
// If we receive payment error than, instead of
|
||||||
|
// terminating the stream, send error response
|
||||||
|
// to the user.
|
||||||
|
case resp.Err != nil:
|
||||||
|
err := stream.send(&lnrpc.SendResponse{
|
||||||
|
PaymentError: resp.Err.Error(),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
errChan <- err
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
marshalledRouted := marshallRoute(resp.Route)
|
||||||
err := stream.send(&lnrpc.SendResponse{
|
err := stream.send(&lnrpc.SendResponse{
|
||||||
PaymentPreimage: preImage[:],
|
PaymentPreimage: resp.Preimage[:],
|
||||||
PaymentRoute: marshallRoute(route),
|
PaymentRoute: marshalledRouted,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
errChan <- err
|
||||||
@ -2385,20 +2399,20 @@ func (r *rpcServer) sendPaymentSync(ctx context.Context,
|
|||||||
|
|
||||||
// With the payment validated, we'll now attempt to dispatch the
|
// With the payment validated, we'll now attempt to dispatch the
|
||||||
// payment.
|
// payment.
|
||||||
route, preImage, saveErr, routeErr := r.dispatchPaymentIntent(&payIntent)
|
resp, saveErr := r.dispatchPaymentIntent(&payIntent)
|
||||||
switch {
|
switch {
|
||||||
case routeErr != nil:
|
|
||||||
return &lnrpc.SendResponse{
|
|
||||||
PaymentError: routeErr.Error(),
|
|
||||||
}, nil
|
|
||||||
|
|
||||||
case saveErr != nil:
|
case saveErr != nil:
|
||||||
return nil, err
|
return nil, saveErr
|
||||||
|
|
||||||
|
case resp.Err != nil:
|
||||||
|
return &lnrpc.SendResponse{
|
||||||
|
PaymentError: resp.Err.Error(),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.SendResponse{
|
return &lnrpc.SendResponse{
|
||||||
PaymentPreimage: preImage[:],
|
PaymentPreimage: resp.Preimage[:],
|
||||||
PaymentRoute: marshallRoute(route),
|
PaymentRoute: marshallRoute(resp.Route),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
server.go
10
server.go
@ -366,9 +366,9 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
|
|
||||||
// If we were requested to automatically configure port forwarding,
|
// If we were requested to automatically configure port forwarding,
|
||||||
// we'll use the ports that the server will be listening on.
|
// we'll use the ports that the server will be listening on.
|
||||||
externalIpStrings := make([]string, len(cfg.ExternalIPs))
|
externalIPStrings := make([]string, len(cfg.ExternalIPs))
|
||||||
for idx, ip := range cfg.ExternalIPs {
|
for idx, ip := range cfg.ExternalIPs {
|
||||||
externalIpStrings[idx] = ip.String()
|
externalIPStrings[idx] = ip.String()
|
||||||
}
|
}
|
||||||
if s.natTraversal != nil {
|
if s.natTraversal != nil {
|
||||||
listenPorts := make([]uint16, 0, len(listenAddrs))
|
listenPorts := make([]uint16, 0, len(listenAddrs))
|
||||||
@ -391,14 +391,14 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
srvrLog.Infof("Automatically set up port forwarding "+
|
srvrLog.Infof("Automatically set up port forwarding "+
|
||||||
"using %s to advertise external IP",
|
"using %s to advertise external IP",
|
||||||
s.natTraversal.Name())
|
s.natTraversal.Name())
|
||||||
externalIpStrings = append(externalIpStrings, ips...)
|
externalIPStrings = append(externalIPStrings, ips...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If external IP addresses have been specified, add those to the list
|
// If external IP addresses have been specified, add those to the list
|
||||||
// of this server's addresses.
|
// of this server's addresses.
|
||||||
externalIPs, err := lncfg.NormalizeAddresses(
|
externalIPs, err := lncfg.NormalizeAddresses(
|
||||||
externalIpStrings, strconv.Itoa(defaultPeerPort),
|
externalIPStrings, strconv.Itoa(defaultPeerPort),
|
||||||
cfg.net.ResolveTCPAddr,
|
cfg.net.ResolveTCPAddr,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2593,8 +2593,6 @@ func (s *server) ConnectToPeer(addr *lnwire.NetAddress, perm bool) error {
|
|||||||
case <-s.quit:
|
case <-s.quit:
|
||||||
return ErrServerShuttingDown
|
return ErrServerShuttingDown
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// connectToPeer establishes a connection to a remote peer. errChan is used to
|
// connectToPeer establishes a connection to a remote peer. errChan is used to
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/go-errors/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Store is an interface which serves as an abstraction over data structure
|
// Store is an interface which serves as an abstraction over data structure
|
||||||
|
@ -8,12 +8,12 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -7,14 +7,14 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
|
"github.com/btcsuite/btcwallet/wallet"
|
||||||
"github.com/lightningnetwork/lnd/aezeed"
|
"github.com/lightningnetwork/lnd/aezeed"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
|
||||||
"github.com/btcsuite/btcwallet/wallet"
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// WalletInitMsg is a message sent by the UnlockerService when a user wishes to
|
// WalletInitMsg is a message sent by the UnlockerService when a user wishes to
|
||||||
|
@ -8,14 +8,14 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
|
"github.com/btcsuite/btcwallet/wallet"
|
||||||
"github.com/lightningnetwork/lnd/aezeed"
|
"github.com/lightningnetwork/lnd/aezeed"
|
||||||
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||||
"github.com/lightningnetwork/lnd/walletunlocker"
|
"github.com/lightningnetwork/lnd/walletunlocker"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
|
||||||
"github.com/btcsuite/btcwallet/wallet"
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -3,10 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/contractcourt"
|
"github.com/lightningnetwork/lnd/contractcourt"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// preimageSubscriber reprints an active subscription to be notified once the
|
// preimageSubscriber reprints an active subscription to be notified once the
|
||||||
|
@ -7,13 +7,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/routing"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcutil/bech32"
|
"github.com/btcsuite/btcutil/bech32"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/routing"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcutil/bech32"
|
"github.com/btcsuite/btcutil/bech32"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestDecodeAmount ensures that the amount string in the hrp of the Invoice
|
// TestDecodeAmount ensures that the amount string in the hrp of the Invoice
|
||||||
|
@ -11,13 +11,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/routing"
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
|
|
||||||
litecoinCfg "github.com/ltcsuite/ltcd/chaincfg"
|
litecoinCfg "github.com/ltcsuite/ltcd/chaincfg"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user