lnd: fix latest goclean.sh lint warning
This commit is contained in:
parent
730c0b8cb1
commit
61991a1c89
@ -11,7 +11,7 @@
|
|||||||
[![Godoc](https://godoc.org/github.com/lightningnetwork/lnd?status.svg)]
|
[![Godoc](https://godoc.org/github.com/lightningnetwork/lnd?status.svg)]
|
||||||
(https://godoc.org/github.com/lightningnetwork/lnd)
|
(https://godoc.org/github.com/lightningnetwork/lnd)
|
||||||
|
|
||||||
[![Coverage Status](https://coveralls.io/repos/github/AndrewSamokhvalov/lnd/badge.svg?branch=master)](https://coveralls.io/github/AndrewSamokhvalov/lnd?branch=master)
|
[![Coverage Status](https://coveralls.io/repos/github/lightningnetwork/lnd/badge.svg?branch=master)](https://coveralls.io/github/lightningnetwork/lnd?branch=master)
|
||||||
|
|
||||||
The Lightning Network Daemon (`lnd`) - is a complete implementation of a
|
The Lightning Network Daemon (`lnd`) - is a complete implementation of a
|
||||||
[Lightning Network](https://lightning.network) node and currently
|
[Lightning Network](https://lightning.network) node and currently
|
||||||
|
@ -1453,7 +1453,7 @@ func putChanFundingInfo(nodeChanBucket *bolt.Bucket, channel *OpenChannel) error
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
byteOrder.PutUint16(scratch[:2], uint16(channel.NumConfsRequired))
|
byteOrder.PutUint16(scratch[:2], channel.NumConfsRequired)
|
||||||
if _, err := b.Write(scratch[:2]); err != nil {
|
if _, err := b.Write(scratch[:2]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ func fetchChannels(d *DB, pendingOnly bool) ([]*OpenChannel, error) {
|
|||||||
}
|
}
|
||||||
if pendingOnly {
|
if pendingOnly {
|
||||||
for _, channel := range nodeChannels {
|
for _, channel := range nodeChannels {
|
||||||
if channel.IsPending == true {
|
if channel.IsPending {
|
||||||
channels = append(channels, channel)
|
channels = append(channels, channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +363,7 @@ func fetchChannels(d *DB, pendingOnly bool) ([]*OpenChannel, error) {
|
|||||||
// MarkChannelAsOpen records the finalization of the funding process and marks
|
// MarkChannelAsOpen records the finalization of the funding process and marks
|
||||||
// a channel as available for use.
|
// a channel as available for use.
|
||||||
func (d *DB) MarkChannelAsOpen(outpoint *wire.OutPoint) error {
|
func (d *DB) MarkChannelAsOpen(outpoint *wire.OutPoint) error {
|
||||||
err := d.Update(func(tx *bolt.Tx) error {
|
return d.Update(func(tx *bolt.Tx) error {
|
||||||
openChanBucket := tx.Bucket(openChannelBucket)
|
openChanBucket := tx.Bucket(openChannelBucket)
|
||||||
if openChanBucket == nil {
|
if openChanBucket == nil {
|
||||||
return ErrNoActiveChannels
|
return ErrNoActiveChannels
|
||||||
@ -385,11 +385,6 @@ func (d *DB) MarkChannelAsOpen(outpoint *wire.OutPoint) error {
|
|||||||
byteOrder.PutUint16(scratch, uint16(0))
|
byteOrder.PutUint16(scratch, uint16(0))
|
||||||
return openChanBucket.Put(keyPrefix, scratch)
|
return openChanBucket.Put(keyPrefix, scratch)
|
||||||
})
|
})
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// syncVersions function is used for safe db version synchronization. It applies
|
// syncVersions function is used for safe db version synchronization. It applies
|
||||||
|
@ -751,8 +751,8 @@ func delChannelByEdge(edges *bolt.Bucket, edgeIndex *bolt.Bucket,
|
|||||||
// updated, otherwise it's the second node's information. The node ordering is
|
// updated, otherwise it's the second node's information. The node ordering is
|
||||||
// determined tby the lexicographical ordering of the identity public keys of
|
// determined tby the lexicographical ordering of the identity public keys of
|
||||||
// the nodes on either side of the channel.
|
// the nodes on either side of the channel.
|
||||||
func (r *ChannelGraph) UpdateEdgePolicy(edge *ChannelEdgePolicy) error {
|
func (c *ChannelGraph) UpdateEdgePolicy(edge *ChannelEdgePolicy) error {
|
||||||
return r.db.Update(func(tx *bolt.Tx) error {
|
return c.db.Update(func(tx *bolt.Tx) error {
|
||||||
edges, err := tx.CreateBucketIfNotExists(edgeBucket)
|
edges, err := tx.CreateBucketIfNotExists(edgeBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1096,7 +1096,7 @@ func normalizeFunc(edges []*lnrpc.ChannelEdge, scaleFactor float64) func(int64)
|
|||||||
y := math.Log2(float64(x))
|
y := math.Log2(float64(x))
|
||||||
|
|
||||||
// TODO(roasbeef): results in min being zero
|
// TODO(roasbeef): results in min being zero
|
||||||
return y - min/max - min*scaleFactor
|
return (y - min) / (max - min) * scaleFactor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1259,21 +1259,21 @@ func getChanInfo(ctx *cli.Context) error {
|
|||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
chan_id int64
|
chanID int64
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case ctx.IsSet("chan_id"):
|
case ctx.IsSet("chan_id"):
|
||||||
chan_id = ctx.Int64("chan_id")
|
chanID = ctx.Int64("chan_id")
|
||||||
case ctx.Args().Present():
|
case ctx.Args().Present():
|
||||||
chan_id, err = strconv.ParseInt(ctx.Args().First(), 10, 64)
|
chanID, err = strconv.ParseInt(ctx.Args().First(), 10, 64)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("chan_id argument missing")
|
return fmt.Errorf("chan_id argument missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.ChanInfoRequest{
|
req := &lnrpc.ChanInfoRequest{
|
||||||
ChanId: uint64(chan_id),
|
ChanId: uint64(chanID),
|
||||||
}
|
}
|
||||||
|
|
||||||
chanInfo, err := client.GetChanInfo(ctxb, req)
|
chanInfo, err := client.GetChanInfo(ctxb, req)
|
||||||
@ -1491,11 +1491,11 @@ func decodePayReq(ctx *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var ListChainTxns = cli.Command{
|
var listChainTxnsCommand = cli.Command{
|
||||||
Name: "listchaintxns",
|
Name: "listchaintxns",
|
||||||
Usage: "List transactions from the wallet.",
|
Usage: "List transactions from the wallet.",
|
||||||
Description: "List all transactions an address of the wallet was involved in.",
|
Description: "List all transactions an address of the wallet was involved in.",
|
||||||
Action: listChainTxns,
|
Action: listChainTxns,
|
||||||
}
|
}
|
||||||
|
|
||||||
func listChainTxns(ctx *cli.Context) error {
|
func listChainTxns(ctx *cli.Context) error {
|
||||||
@ -1509,6 +1509,6 @@ func listChainTxns(ctx *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
printRespJson(resp)
|
printRespJSON(resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ func main() {
|
|||||||
getNetworkInfoCommand,
|
getNetworkInfoCommand,
|
||||||
debugLevelCommand,
|
debugLevelCommand,
|
||||||
decodePayReqComamnd,
|
decodePayReqComamnd,
|
||||||
ListChainTxns,
|
listChainTxnsCommand,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
@ -1097,13 +1097,13 @@ func newChanAnnouncement(localIdentity, remotePub *btcec.PublicKey,
|
|||||||
// network to recognize the legitimacy of the channel. The crafted
|
// network to recognize the legitimacy of the channel. The crafted
|
||||||
// announcements are then send to the channel router to handle broadcasting to
|
// announcements are then send to the channel router to handle broadcasting to
|
||||||
// the network during its next trickle.
|
// the network during its next trickle.
|
||||||
func (f *fundingManager) announceChannel(idKey, remoteIdKey *btcec.PublicKey,
|
func (f *fundingManager) announceChannel(idKey, remoteIDKey *btcec.PublicKey,
|
||||||
channel *lnwallet.LightningChannel, chanID lnwire.ChannelID, localProof,
|
channel *lnwallet.LightningChannel, chanID lnwire.ChannelID, localProof,
|
||||||
remoteProof *channelProof) {
|
remoteProof *channelProof) {
|
||||||
|
|
||||||
// TODO(roasbeef): need a Signer.SignMessage method to finalize
|
// TODO(roasbeef): need a Signer.SignMessage method to finalize
|
||||||
// advertisements
|
// advertisements
|
||||||
chanAnnouncement := newChanAnnouncement(idKey, remoteIdKey, channel, chanID,
|
chanAnnouncement := newChanAnnouncement(idKey, remoteIDKey, channel, chanID,
|
||||||
localProof, remoteProof)
|
localProof, remoteProof)
|
||||||
|
|
||||||
f.cfg.SendToRouter(chanAnnouncement.chanAnn)
|
f.cfg.SendToRouter(chanAnnouncement.chanAnn)
|
||||||
|
16
lnd_test.go
16
lnd_test.go
@ -200,7 +200,7 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest, net *networkHarn
|
|||||||
// numChannelsPending sends an RPC request to a node to get a count of the
|
// numChannelsPending sends an RPC request to a node to get a count of the
|
||||||
// node's channels that are currently in a pending state (with a broadcast,
|
// node's channels that are currently in a pending state (with a broadcast,
|
||||||
// but not confirmed funding transaction).
|
// but not confirmed funding transaction).
|
||||||
func numChannelsPending(node *lightningNode, ctxt context.Context) (int, error) {
|
func numChannelsPending(ctxt context.Context, node *lightningNode) (int, error) {
|
||||||
pendingChansRequest := &lnrpc.PendingChannelRequest{
|
pendingChansRequest := &lnrpc.PendingChannelRequest{
|
||||||
Status: lnrpc.ChannelStatus_OPENING,
|
Status: lnrpc.ChannelStatus_OPENING,
|
||||||
}
|
}
|
||||||
@ -213,14 +213,14 @@ func numChannelsPending(node *lightningNode, ctxt context.Context) (int, error)
|
|||||||
|
|
||||||
// assertNumChannelsPending asserts that a pair of nodes have the expected
|
// assertNumChannelsPending asserts that a pair of nodes have the expected
|
||||||
// number of pending channels between them.
|
// number of pending channels between them.
|
||||||
func assertNumChannelsPending(t *harnessTest, ctxt context.Context,
|
func assertNumChannelsPending(ctxt context.Context, t *harnessTest,
|
||||||
alice, bob *lightningNode, expected int) {
|
alice, bob *lightningNode, expected int) {
|
||||||
aliceNumChans, err := numChannelsPending(alice, ctxt)
|
aliceNumChans, err := numChannelsPending(ctxt, alice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error fetching alice's node (%v) pending channels %v",
|
t.Fatalf("error fetching alice's node (%v) pending channels %v",
|
||||||
alice.nodeID, err)
|
alice.nodeID, err)
|
||||||
}
|
}
|
||||||
bobNumChans, err := numChannelsPending(bob, ctxt)
|
bobNumChans, err := numChannelsPending(ctxt, bob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error fetching bob's node (%v) pending channels %v",
|
t.Fatalf("error fetching bob's node (%v) pending channels %v",
|
||||||
bob.nodeID, err)
|
bob.nodeID, err)
|
||||||
@ -313,7 +313,7 @@ func testChannelFundingPersistence(net *networkHarness, t *harnessTest) {
|
|||||||
// been broadcast, but not confirmed. Alice and Bob's nodes
|
// been broadcast, but not confirmed. Alice and Bob's nodes
|
||||||
// should reflect this when queried via RPC.
|
// should reflect this when queried via RPC.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
||||||
assertNumChannelsPending(t, ctxt, net.Alice, net.Bob, 1)
|
assertNumChannelsPending(ctxt, t, net.Alice, net.Bob, 1)
|
||||||
|
|
||||||
// Restart both nodes to test that the appropriate state has been
|
// Restart both nodes to test that the appropriate state has been
|
||||||
// persisted and that both nodes recover gracefully.
|
// persisted and that both nodes recover gracefully.
|
||||||
@ -376,7 +376,7 @@ peersPoll:
|
|||||||
// Both nodes should still show a single channel as pending.
|
// Both nodes should still show a single channel as pending.
|
||||||
time.Sleep(time.Millisecond * 300)
|
time.Sleep(time.Millisecond * 300)
|
||||||
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
||||||
assertNumChannelsPending(t, ctxt, net.Alice, net.Bob, 1)
|
assertNumChannelsPending(ctxt, t, net.Alice, net.Bob, 1)
|
||||||
|
|
||||||
// Finally, mine the last block which should mark the channel as open.
|
// Finally, mine the last block which should mark the channel as open.
|
||||||
if _, err := net.Miner.Node.Generate(1); err != nil {
|
if _, err := net.Miner.Node.Generate(1); err != nil {
|
||||||
@ -387,7 +387,7 @@ peersPoll:
|
|||||||
// be no pending channels remaining for either node.
|
// be no pending channels remaining for either node.
|
||||||
time.Sleep(time.Millisecond * 300)
|
time.Sleep(time.Millisecond * 300)
|
||||||
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
||||||
assertNumChannelsPending(t, ctxt, net.Alice, net.Bob, 0)
|
assertNumChannelsPending(ctxt, t, net.Alice, net.Bob, 0)
|
||||||
|
|
||||||
// The channel should be listed in the peer information returned by
|
// The channel should be listed in the peer information returned by
|
||||||
// both peers.
|
// both peers.
|
||||||
@ -1009,7 +1009,7 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
if len(chanGraph.Edges) != 2 {
|
if len(chanGraph.Edges) != 2 {
|
||||||
t.Fatalf("only two channels should be seen as active in the "+
|
t.Fatalf("only two channels should be seen as active in the "+
|
||||||
"network, instead %v are: ", len(chanGraph.Edges),
|
"network, instead %v are: %v", len(chanGraph.Edges),
|
||||||
chanGraph.Edges)
|
chanGraph.Edges)
|
||||||
}
|
}
|
||||||
for _, link := range chanGraph.Edges {
|
for _, link := range chanGraph.Edges {
|
||||||
|
@ -49,15 +49,10 @@ var _ Message = (*FundingLocked)(nil)
|
|||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *FundingLocked) Decode(r io.Reader, pver uint32) error {
|
func (c *FundingLocked) Decode(r io.Reader, pver uint32) error {
|
||||||
err := readElements(r,
|
return readElements(r,
|
||||||
&c.ChannelOutpoint,
|
&c.ChannelOutpoint,
|
||||||
&c.ChannelID,
|
&c.ChannelID,
|
||||||
&c.NextPerCommitmentPoint)
|
&c.NextPerCommitmentPoint)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode serializes the target FundingLocked message into the passed io.Writer
|
// Encode serializes the target FundingLocked message into the passed io.Writer
|
||||||
@ -66,15 +61,10 @@ func (c *FundingLocked) Decode(r io.Reader, pver uint32) error {
|
|||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *FundingLocked) Encode(w io.Writer, pver uint32) error {
|
func (c *FundingLocked) Encode(w io.Writer, pver uint32) error {
|
||||||
err := writeElements(w,
|
return writeElements(w,
|
||||||
c.ChannelOutpoint,
|
c.ChannelOutpoint,
|
||||||
c.ChannelID,
|
c.ChannelID,
|
||||||
c.NextPerCommitmentPoint)
|
c.NextPerCommitmentPoint)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command returns the uint32 code which uniquely identifies this message as a
|
// Command returns the uint32 code which uniquely identifies this message as a
|
||||||
@ -111,7 +101,8 @@ func (c *FundingLocked) MaxPayloadLength(uint32) uint32 {
|
|||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *FundingLocked) Validate() error {
|
func (c *FundingLocked) Validate() error {
|
||||||
if c.NextPerCommitmentPoint == nil {
|
if c.NextPerCommitmentPoint == nil {
|
||||||
return fmt.Errorf("The next per commitment point must be non-nil.")
|
return fmt.Errorf("the next per commitment point must be " +
|
||||||
|
"non-nil.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're good!
|
// We're good!
|
||||||
|
@ -112,7 +112,7 @@ func NewSingleFundingRequest(chanID uint64, chanType uint8, coinType uint64,
|
|||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *SingleFundingRequest) Decode(r io.Reader, pver uint32) error {
|
func (c *SingleFundingRequest) Decode(r io.Reader, pver uint32) error {
|
||||||
err := readElements(r,
|
return readElements(r,
|
||||||
&c.ChannelID,
|
&c.ChannelID,
|
||||||
&c.ChannelType,
|
&c.ChannelType,
|
||||||
&c.CoinType,
|
&c.CoinType,
|
||||||
@ -125,11 +125,6 @@ func (c *SingleFundingRequest) Decode(r io.Reader, pver uint32) error {
|
|||||||
&c.DeliveryPkScript,
|
&c.DeliveryPkScript,
|
||||||
&c.DustLimit,
|
&c.DustLimit,
|
||||||
&c.ConfirmationDepth)
|
&c.ConfirmationDepth)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode serializes the target SingleFundingRequest into the passed io.Writer
|
// Encode serializes the target SingleFundingRequest into the passed io.Writer
|
||||||
@ -138,7 +133,7 @@ func (c *SingleFundingRequest) Decode(r io.Reader, pver uint32) error {
|
|||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *SingleFundingRequest) Encode(w io.Writer, pver uint32) error {
|
func (c *SingleFundingRequest) Encode(w io.Writer, pver uint32) error {
|
||||||
err := writeElements(w,
|
return writeElements(w,
|
||||||
c.ChannelID,
|
c.ChannelID,
|
||||||
c.ChannelType,
|
c.ChannelType,
|
||||||
c.CoinType,
|
c.CoinType,
|
||||||
@ -151,11 +146,6 @@ func (c *SingleFundingRequest) Encode(w io.Writer, pver uint32) error {
|
|||||||
c.DeliveryPkScript,
|
c.DeliveryPkScript,
|
||||||
c.DustLimit,
|
c.DustLimit,
|
||||||
c.ConfirmationDepth)
|
c.ConfirmationDepth)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command returns the uint32 code which uniquely identifies this message as a
|
// Command returns the uint32 code which uniquely identifies this message as a
|
||||||
@ -179,7 +169,7 @@ func (c *SingleFundingRequest) MaxPayloadLength(uint32) uint32 {
|
|||||||
length += 8
|
length += 8
|
||||||
|
|
||||||
// ChannelType - 1 byte
|
// ChannelType - 1 byte
|
||||||
length += 1
|
length++
|
||||||
|
|
||||||
// CoinType - 8 bytes
|
// CoinType - 8 bytes
|
||||||
length += 8
|
length += 8
|
||||||
|
@ -94,7 +94,7 @@ func (c *SingleFundingResponse) Decode(r io.Reader, pver uint32) error {
|
|||||||
// DeliveryPkScript (final delivery)
|
// DeliveryPkScript (final delivery)
|
||||||
// DustLimit (8)
|
// DustLimit (8)
|
||||||
// ConfirmationDepth (4)
|
// ConfirmationDepth (4)
|
||||||
err := readElements(r,
|
return readElements(r,
|
||||||
&c.ChannelID,
|
&c.ChannelID,
|
||||||
&c.ChannelDerivationPoint,
|
&c.ChannelDerivationPoint,
|
||||||
&c.CommitmentKey,
|
&c.CommitmentKey,
|
||||||
@ -103,11 +103,6 @@ func (c *SingleFundingResponse) Decode(r io.Reader, pver uint32) error {
|
|||||||
&c.DeliveryPkScript,
|
&c.DeliveryPkScript,
|
||||||
&c.DustLimit,
|
&c.DustLimit,
|
||||||
&c.ConfirmationDepth)
|
&c.ConfirmationDepth)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode serializes the target SingleFundingResponse into the passed io.Writer
|
// Encode serializes the target SingleFundingResponse into the passed io.Writer
|
||||||
@ -116,7 +111,7 @@ func (c *SingleFundingResponse) Decode(r io.Reader, pver uint32) error {
|
|||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *SingleFundingResponse) Encode(w io.Writer, pver uint32) error {
|
func (c *SingleFundingResponse) Encode(w io.Writer, pver uint32) error {
|
||||||
err := writeElements(w,
|
return writeElements(w,
|
||||||
c.ChannelID,
|
c.ChannelID,
|
||||||
c.ChannelDerivationPoint,
|
c.ChannelDerivationPoint,
|
||||||
c.CommitmentKey,
|
c.CommitmentKey,
|
||||||
@ -125,11 +120,6 @@ func (c *SingleFundingResponse) Encode(w io.Writer, pver uint32) error {
|
|||||||
c.DeliveryPkScript,
|
c.DeliveryPkScript,
|
||||||
c.DustLimit,
|
c.DustLimit,
|
||||||
c.ConfirmationDepth)
|
c.ConfirmationDepth)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command returns the uint32 code which uniquely identifies this message as a
|
// Command returns the uint32 code which uniquely identifies this message as a
|
||||||
|
@ -107,11 +107,11 @@ func (r *ChannelRouter) notifyTopologyChange(topologyDiff *TopologyChange) {
|
|||||||
|
|
||||||
// In this case we'll try to send the notification
|
// In this case we'll try to send the notification
|
||||||
// directly to the upstream client consumer.
|
// directly to the upstream client consumer.
|
||||||
case client.ntfnChan <- topologyDiff:
|
case c.ntfnChan <- topologyDiff:
|
||||||
|
|
||||||
// If the client cancel's the notifications, then we'll
|
// If the client cancel's the notifications, then we'll
|
||||||
// exit early.
|
// exit early.
|
||||||
case <-client.exit:
|
case <-c.exit:
|
||||||
|
|
||||||
// Similarly, if the ChannelRouter itself exists early,
|
// Similarly, if the ChannelRouter itself exists early,
|
||||||
// then we'll also exit ourselves.
|
// then we'll also exit ourselves.
|
||||||
|
@ -664,7 +664,7 @@ func TestChannelCloseNotification(t *testing.T) {
|
|||||||
Transactions: []*wire.MsgTx{
|
Transactions: []*wire.MsgTx{
|
||||||
{
|
{
|
||||||
TxIn: []*wire.TxIn{
|
TxIn: []*wire.TxIn{
|
||||||
&wire.TxIn{
|
{
|
||||||
PreviousOutPoint: chanUtxo,
|
PreviousOutPoint: chanUtxo,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -4,11 +4,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
|
||||||
"github.com/roasbeef/btcd/btcec"
|
|
||||||
"github.com/roasbeef/btcd/chaincfg/chainhash"
|
|
||||||
"github.com/roasbeef/btcd/wire"
|
|
||||||
"github.com/roasbeef/btcutil"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
@ -17,13 +12,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
prand "math/rand"
|
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/roasbeef/btcd/btcec"
|
"github.com/roasbeef/btcd/btcec"
|
||||||
"github.com/roasbeef/btcd/chaincfg/chainhash"
|
"github.com/roasbeef/btcd/chaincfg/chainhash"
|
||||||
"github.com/roasbeef/btcd/wire"
|
"github.com/roasbeef/btcd/wire"
|
||||||
"github.com/roasbeef/btcutil"
|
"github.com/roasbeef/btcutil"
|
||||||
|
|
||||||
|
prand "math/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -344,8 +339,7 @@ func TestBasicGraphPathFinding(t *testing.T) {
|
|||||||
// The length of the path should be exactly one hop as it's the
|
// The length of the path should be exactly one hop as it's the
|
||||||
// "shortest" known path in the graph.
|
// "shortest" known path in the graph.
|
||||||
if len(route.Hops) != 1 {
|
if len(route.Hops) != 1 {
|
||||||
t.Fatalf("shortest path not selected, should be of length 1, "+
|
t.Fatalf("shortest path not selected, should be of length 1, "+"is instead: %v", len(route.Hops))
|
||||||
"is instead: %v", len(route.Hops))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// As we have a direct path, the total time lock value should be
|
// As we have a direct path, the total time lock value should be
|
||||||
@ -388,8 +382,7 @@ func TestNewRoutePathTooLong(t *testing.T) {
|
|||||||
target = aliases["vincent"]
|
target = aliases["vincent"]
|
||||||
route, err = findRoute(graph, target, paymentAmt)
|
route, err = findRoute(graph, target, paymentAmt)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("should not have been able to find path, supposed to be "+
|
t.Fatalf("should not have been able to find path, supposed to be "+"greater than 20 hops, found route with %v hops", len(route.Hops))
|
||||||
"greater than 20 hops, found route with %v hops", len(route.Hops))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,9 +85,6 @@ func (p *RevocationProducer) AtIndex(v uint64) (*chainhash.Hash, error) {
|
|||||||
//
|
//
|
||||||
// NOTE: Part of the Producer interface.
|
// NOTE: Part of the Producer interface.
|
||||||
func (p *RevocationProducer) Encode(w io.Writer) error {
|
func (p *RevocationProducer) Encode(w io.Writer) error {
|
||||||
if _, err := w.Write(p.root.hash[:]); err != nil {
|
_, err := w.Write(p.root.hash[:])
|
||||||
return err
|
return err
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user