mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 21:22:37 +02:00
server: all references to primary interfaces are now through chainControl
This commit is contained in:
16
peer.go
16
peer.go
@@ -289,8 +289,8 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
lnChan, err := lnwallet.NewLightningChannel(p.server.lnwallet.Signer,
|
lnChan, err := lnwallet.NewLightningChannel(p.server.cc.signer,
|
||||||
p.server.chainNotifier, p.server.feeEstimator, dbChan)
|
p.server.cc.chainNotifier, p.server.cc.feeEstimator, dbChan)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1098,7 +1098,7 @@ func (p *peer) handleInitClosingSigned(req *htlcswitch.ChanClose, msg *lnwire.Cl
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_, bestHeight, err := p.server.bio.GetBestBlock()
|
_, bestHeight, err := p.server.cc.chainIO.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
req.Err <- err
|
req.Err <- err
|
||||||
return
|
return
|
||||||
@@ -1107,9 +1107,9 @@ func (p *peer) handleInitClosingSigned(req *htlcswitch.ChanClose, msg *lnwire.Cl
|
|||||||
// Finally, launch a goroutine which will request to be notified by the
|
// Finally, launch a goroutine which will request to be notified by the
|
||||||
// ChainNotifier once the closure transaction obtains a single
|
// ChainNotifier once the closure transaction obtains a single
|
||||||
// confirmation.
|
// confirmation.
|
||||||
notifier := p.server.chainNotifier
|
notifier := p.server.cc.chainNotifier
|
||||||
go waitForChanToClose(uint32(bestHeight), notifier, req.Err,
|
go waitForChanToClose(uint32(bestHeight), notifier, req.err,
|
||||||
req.ChanPoint, &closingTxid, func() {
|
req.ChanPoint, closingTxid, func() {
|
||||||
|
|
||||||
// First, we'll mark the database as being fully closed
|
// First, we'll mark the database as being fully closed
|
||||||
// so we'll no longer watch for its ultimate closure
|
// so we'll no longer watch for its ultimate closure
|
||||||
@@ -1168,7 +1168,7 @@ func (p *peer) handleResponseClosingSigned(msg *lnwire.ClosingSigned,
|
|||||||
}
|
}
|
||||||
closeTxid := closeTx.TxHash()
|
closeTxid := closeTx.TxHash()
|
||||||
|
|
||||||
_, bestHeight, err := p.server.bio.GetBestBlock()
|
_, bestHeight, err := p.server.cc.chainIO.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
peerLog.Errorf("unable to get best height: %v", err)
|
peerLog.Errorf("unable to get best height: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1206,7 +1206,7 @@ func (p *peer) handleResponseClosingSigned(msg *lnwire.ClosingSigned,
|
|||||||
// Finally, we'll launch a goroutine to watch the network for the
|
// Finally, we'll launch a goroutine to watch the network for the
|
||||||
// confirmation of the closing transaction, and mark the channel as
|
// confirmation of the closing transaction, and mark the channel as
|
||||||
// such within the database (once it's confirmed").
|
// such within the database (once it's confirmed").
|
||||||
notifier := p.server.chainNotifier
|
notifier := p.server.cc.chainNotifier
|
||||||
go waitForChanToClose(uint32(bestHeight), notifier, nil, chanPoint,
|
go waitForChanToClose(uint32(bestHeight), notifier, nil, chanPoint,
|
||||||
&closeTxid, func() {
|
&closeTxid, func() {
|
||||||
// Now that the closing transaction has been confirmed,
|
// Now that the closing transaction has been confirmed,
|
||||||
|
34
rpcserver.go
34
rpcserver.go
@@ -116,7 +116,7 @@ func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64) (*chainhash.Ha
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.server.lnwallet.SendOutputs(outputs)
|
return r.server.cc.wallet.SendOutputs(outputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendCoins executes a request to send coins to a particular address. Unlike
|
// SendCoins executes a request to send coins to a particular address. Unlike
|
||||||
@@ -168,7 +168,7 @@ func (r *rpcServer) NewAddress(ctx context.Context,
|
|||||||
addrType = lnwallet.PubKeyHash
|
addrType = lnwallet.PubKeyHash
|
||||||
}
|
}
|
||||||
|
|
||||||
addr, err := r.server.lnwallet.NewAddress(addrType, false)
|
addr, err := r.server.cc.wallet.NewAddress(addrType, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ func (r *rpcServer) NewAddress(ctx context.Context,
|
|||||||
func (r *rpcServer) NewWitnessAddress(ctx context.Context,
|
func (r *rpcServer) NewWitnessAddress(ctx context.Context,
|
||||||
in *lnrpc.NewWitnessAddressRequest) (*lnrpc.NewAddressResponse, error) {
|
in *lnrpc.NewWitnessAddressRequest) (*lnrpc.NewAddressResponse, error) {
|
||||||
|
|
||||||
addr, err := r.server.lnwallet.NewAddress(lnwallet.WitnessPubKey, false)
|
addr, err := r.server.cc.wallet.NewAddress(lnwallet.WitnessPubKey, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ func (r *rpcServer) OpenChannelSync(ctx context.Context,
|
|||||||
|
|
||||||
// Creation of channels before the wallet syncs up is currently
|
// Creation of channels before the wallet syncs up is currently
|
||||||
// disallowed.
|
// disallowed.
|
||||||
isSynced, err := r.server.lnwallet.IsSynced()
|
isSynced, err := r.server.cc.wallet.IsSynced()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -564,7 +564,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, bestHeight, err := r.server.bio.GetBestBlock()
|
_, bestHeight, err := r.server.cc.chainIO.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -606,7 +606,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
errChan = make(chan error, 1)
|
errChan = make(chan error, 1)
|
||||||
notifier := r.server.chainNotifier
|
notifier := r.server.cc.chainNotifier
|
||||||
go waitForChanToClose(uint32(bestHeight), notifier, errChan, chanPoint,
|
go waitForChanToClose(uint32(bestHeight), notifier, errChan, chanPoint,
|
||||||
closingTxid, func() {
|
closingTxid, func() {
|
||||||
// Respond to the local subsystem which
|
// Respond to the local subsystem which
|
||||||
@@ -689,8 +689,8 @@ func (r *rpcServer) fetchActiveChannel(chanPoint wire.OutPoint) (*lnwallet.Light
|
|||||||
|
|
||||||
// Otherwise, we create a fully populated channel state machine which
|
// Otherwise, we create a fully populated channel state machine which
|
||||||
// uses the db channel as backing storage.
|
// uses the db channel as backing storage.
|
||||||
return lnwallet.NewLightningChannel(r.server.lnwallet.Signer, nil,
|
return lnwallet.NewLightningChannel(r.server.cc.wallet.Signer, nil,
|
||||||
r.server.feeEstimator, dbChan)
|
r.server.cc.feeEstimator, dbChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
// forceCloseChan executes a unilateral close of the target channel by
|
// forceCloseChan executes a unilateral close of the target channel by
|
||||||
@@ -715,7 +715,7 @@ func (r *rpcServer) forceCloseChan(channel *lnwallet.LightningChannel) (*chainha
|
|||||||
channel.ChannelPoint(), newLogClosure(func() string {
|
channel.ChannelPoint(), newLogClosure(func() string {
|
||||||
return spew.Sdump(closeTx)
|
return spew.Sdump(closeTx)
|
||||||
}))
|
}))
|
||||||
if err := r.server.lnwallet.PublishTransaction(closeTx); err != nil {
|
if err := r.server.cc.wallet.PublishTransaction(closeTx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,12 +766,12 @@ func (r *rpcServer) GetInfo(ctx context.Context,
|
|||||||
|
|
||||||
idPub := r.server.identityPriv.PubKey().SerializeCompressed()
|
idPub := r.server.identityPriv.PubKey().SerializeCompressed()
|
||||||
|
|
||||||
bestHash, bestHeight, err := r.server.bio.GetBestBlock()
|
bestHash, bestHeight, err := r.server.cc.chainIO.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get best block info: %v", err)
|
return nil, fmt.Errorf("unable to get best block info: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
isSynced, err := r.server.lnwallet.IsSynced()
|
isSynced, err := r.server.cc.wallet.IsSynced()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to sync PoV of the wallet "+
|
return nil, fmt.Errorf("unable to sync PoV of the wallet "+
|
||||||
"with current best block in the main chain: %v", err)
|
"with current best block in the main chain: %v", err)
|
||||||
@@ -817,7 +817,7 @@ func (r *rpcServer) ListPeers(ctx context.Context,
|
|||||||
// In order to display the total number of satoshis of outbound
|
// In order to display the total number of satoshis of outbound
|
||||||
// (sent) and inbound (recv'd) satoshis that have been
|
// (sent) and inbound (recv'd) satoshis that have been
|
||||||
// transported through this peer, we'll sum up the sent/recv'd
|
// transported through this peer, we'll sum up the sent/recv'd
|
||||||
// values for each of the active channels we ahve with the
|
// values for each of the active channels we have with the
|
||||||
// peer.
|
// peer.
|
||||||
chans := serverPeer.ChannelSnapshots()
|
chans := serverPeer.ChannelSnapshots()
|
||||||
for _, c := range chans {
|
for _, c := range chans {
|
||||||
@@ -854,7 +854,7 @@ func (r *rpcServer) ListPeers(ctx context.Context,
|
|||||||
func (r *rpcServer) WalletBalance(ctx context.Context,
|
func (r *rpcServer) WalletBalance(ctx context.Context,
|
||||||
in *lnrpc.WalletBalanceRequest) (*lnrpc.WalletBalanceResponse, error) {
|
in *lnrpc.WalletBalanceRequest) (*lnrpc.WalletBalanceResponse, error) {
|
||||||
|
|
||||||
balance, err := r.server.lnwallet.ConfirmedBalance(1, in.WitnessOnly)
|
balance, err := r.server.cc.wallet.ConfirmedBalance(1, in.WitnessOnly)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -935,7 +935,7 @@ func (r *rpcServer) PendingChannels(ctx context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, currentHeight, err := r.server.bio.GetBestBlock()
|
_, currentHeight, err := r.server.cc.chainIO.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -1568,7 +1568,7 @@ func (r *rpcServer) SubscribeInvoices(req *lnrpc.InvoiceSubscription,
|
|||||||
func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest,
|
func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest,
|
||||||
updateStream lnrpc.Lightning_SubscribeTransactionsServer) error {
|
updateStream lnrpc.Lightning_SubscribeTransactionsServer) error {
|
||||||
|
|
||||||
txClient, err := r.server.lnwallet.SubscribeTransactions()
|
txClient, err := r.server.cc.wallet.SubscribeTransactions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1609,8 +1609,8 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest,
|
|||||||
func (r *rpcServer) GetTransactions(context.Context,
|
func (r *rpcServer) GetTransactions(context.Context,
|
||||||
*lnrpc.GetTransactionsRequest) (*lnrpc.TransactionDetails, error) {
|
*lnrpc.GetTransactionsRequest) (*lnrpc.TransactionDetails, error) {
|
||||||
|
|
||||||
// TODO(roasbeef): add pagination support
|
// TODO(btcsuite): add pagination support
|
||||||
transactions, err := r.server.lnwallet.ListTransactionDetails()
|
transactions, err := r.server.cc.wallet.ListTransactionDetails()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
64
server.go
64
server.go
@@ -15,14 +15,12 @@ import (
|
|||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
"github.com/lightningnetwork/lightning-onion"
|
"github.com/lightningnetwork/lightning-onion"
|
||||||
"github.com/lightningnetwork/lnd/brontide"
|
"github.com/lightningnetwork/lnd/brontide"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/discovery"
|
"github.com/lightningnetwork/lnd/discovery"
|
||||||
"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/lightningnetwork/lnd/routing"
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
"github.com/lightningnetwork/lnd/routing/chainview"
|
|
||||||
"github.com/roasbeef/btcd/btcec"
|
"github.com/roasbeef/btcd/btcec"
|
||||||
"github.com/roasbeef/btcd/connmgr"
|
"github.com/roasbeef/btcd/connmgr"
|
||||||
"github.com/roasbeef/btcutil"
|
"github.com/roasbeef/btcutil"
|
||||||
@@ -44,7 +42,7 @@ type server struct {
|
|||||||
identityPriv *btcec.PrivateKey
|
identityPriv *btcec.PrivateKey
|
||||||
|
|
||||||
// nodeSigner is an implementation of the MessageSigner implementation
|
// nodeSigner is an implementation of the MessageSigner implementation
|
||||||
// that's backed by the identituy private key of the running lnd node.
|
// that's backed by the identity private key of the running lnd node.
|
||||||
nodeSigner *nodeSigner
|
nodeSigner *nodeSigner
|
||||||
|
|
||||||
// lightningID is the sha256 of the public key corresponding to our
|
// lightningID is the sha256 of the public key corresponding to our
|
||||||
@@ -61,14 +59,11 @@ type server struct {
|
|||||||
|
|
||||||
rpcServer *rpcServer
|
rpcServer *rpcServer
|
||||||
|
|
||||||
chainNotifier chainntnfs.ChainNotifier
|
cc *chainControl
|
||||||
|
|
||||||
bio lnwallet.BlockChainIO
|
|
||||||
lnwallet *lnwallet.LightningWallet
|
|
||||||
feeEstimator lnwallet.FeeEstimator
|
|
||||||
|
|
||||||
fundingMgr *fundingManager
|
fundingMgr *fundingManager
|
||||||
chanDB *channeldb.DB
|
|
||||||
|
chanDB *channeldb.DB
|
||||||
|
|
||||||
htlcSwitch *htlcswitch.Switch
|
htlcSwitch *htlcswitch.Switch
|
||||||
invoices *invoiceRegistry
|
invoices *invoiceRegistry
|
||||||
@@ -108,12 +103,8 @@ type server struct {
|
|||||||
|
|
||||||
// newServer creates a new instance of the server which is to listen using the
|
// newServer creates a new instance of the server which is to listen using the
|
||||||
// passed listener address.
|
// passed listener address.
|
||||||
func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl) (*server, error) {
|
||||||
bio lnwallet.BlockChainIO, fundingSigner lnwallet.MessageSigner,
|
privKey, err := cc.wallet.GetIdentitykey()
|
||||||
wallet *lnwallet.LightningWallet, estimator lnwallet.FeeEstimator,
|
|
||||||
chanDB *channeldb.DB, chainView chainview.FilteredChainView) (*server, error) {
|
|
||||||
|
|
||||||
privKey, err := wallet.GetIdentitykey()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -129,14 +120,12 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
|
|
||||||
serializedPubKey := privKey.PubKey().SerializeCompressed()
|
serializedPubKey := privKey.PubKey().SerializeCompressed()
|
||||||
s := &server{
|
s := &server{
|
||||||
lnwallet: wallet,
|
chanDB: chanDB,
|
||||||
bio: bio,
|
cc: cc,
|
||||||
chainNotifier: notifier,
|
|
||||||
chanDB: chanDB,
|
|
||||||
feeEstimator: estimator,
|
|
||||||
|
|
||||||
invoices: newInvoiceRegistry(chanDB),
|
invoices: newInvoiceRegistry(chanDB),
|
||||||
utxoNursery: newUtxoNursery(chanDB, notifier, wallet),
|
|
||||||
|
utxoNursery: newUtxoNursery(chanDB, cc.chainNotifier, cc.wallet),
|
||||||
|
|
||||||
identityPriv: privKey,
|
identityPriv: privKey,
|
||||||
nodeSigner: newNodeSigner(privKey),
|
nodeSigner: newNodeSigner(privKey),
|
||||||
@@ -250,8 +239,8 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
|
|
||||||
s.chanRouter, err = routing.New(routing.Config{
|
s.chanRouter, err = routing.New(routing.Config{
|
||||||
Graph: chanGraph,
|
Graph: chanGraph,
|
||||||
Chain: bio,
|
Chain: cc.chainIO,
|
||||||
ChainView: chainView,
|
ChainView: cc.chainView,
|
||||||
SendToSwitch: func(firstHop *btcec.PublicKey,
|
SendToSwitch: func(firstHop *btcec.PublicKey,
|
||||||
htlcAdd *lnwire.UpdateAddHTLC) ([32]byte, error) {
|
htlcAdd *lnwire.UpdateAddHTLC) ([32]byte, error) {
|
||||||
firstHopPub := firstHop.SerializeCompressed()
|
firstHopPub := firstHop.SerializeCompressed()
|
||||||
@@ -264,7 +253,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
|
|
||||||
s.discoverSrv, err = discovery.New(discovery.Config{
|
s.discoverSrv, err = discovery.New(discovery.Config{
|
||||||
Broadcast: s.broadcastMessage,
|
Broadcast: s.broadcastMessage,
|
||||||
Notifier: s.chainNotifier,
|
Notifier: s.cc.chainNotifier,
|
||||||
Router: s.chanRouter,
|
Router: s.chanRouter,
|
||||||
SendToPeer: s.sendToPeer,
|
SendToPeer: s.sendToPeer,
|
||||||
TrickleDelay: time.Millisecond * 300,
|
TrickleDelay: time.Millisecond * 300,
|
||||||
@@ -276,8 +265,8 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.rpcServer = newRPCServer(s)
|
s.rpcServer = newRPCServer(s)
|
||||||
s.breachArbiter = newBreachArbiter(wallet, chanDB, notifier,
|
s.breachArbiter = newBreachArbiter(cc.wallet, chanDB, cc.chainNotifier,
|
||||||
s.htlcSwitch, s.bio, s.feeEstimator)
|
s.htlcSwitch, s.cc.chainIO, s.cc.feeEstimator)
|
||||||
|
|
||||||
var chanIDSeed [32]byte
|
var chanIDSeed [32]byte
|
||||||
if _, err := rand.Read(chanIDSeed[:]); err != nil {
|
if _, err := rand.Read(chanIDSeed[:]); err != nil {
|
||||||
@@ -286,16 +275,16 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
|
|
||||||
s.fundingMgr, err = newFundingManager(fundingConfig{
|
s.fundingMgr, err = newFundingManager(fundingConfig{
|
||||||
IDKey: s.identityPriv.PubKey(),
|
IDKey: s.identityPriv.PubKey(),
|
||||||
Wallet: wallet,
|
Wallet: cc.wallet,
|
||||||
ChainIO: s.bio,
|
ChainIO: s.cc.chainIO,
|
||||||
Notifier: s.chainNotifier,
|
Notifier: s.cc.chainNotifier,
|
||||||
FeeEstimator: s.feeEstimator,
|
FeeEstimator: s.cc.feeEstimator,
|
||||||
SignMessage: func(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error) {
|
SignMessage: func(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error) {
|
||||||
if pubKey.IsEqual(s.identityPriv.PubKey()) {
|
if pubKey.IsEqual(s.identityPriv.PubKey()) {
|
||||||
return s.nodeSigner.SignMessage(pubKey, msg)
|
return s.nodeSigner.SignMessage(pubKey, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fundingSigner.SignMessage(pubKey, msg)
|
return cc.msgSigner.SignMessage(pubKey, msg)
|
||||||
},
|
},
|
||||||
SendAnnouncement: func(msg lnwire.Message) error {
|
SendAnnouncement: func(msg lnwire.Message) error {
|
||||||
s.discoverSrv.ProcessLocalAnnouncement(msg,
|
s.discoverSrv.ProcessLocalAnnouncement(msg,
|
||||||
@@ -315,8 +304,8 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
for _, channel := range dbChannels {
|
for _, channel := range dbChannels {
|
||||||
if chanID.IsChanPoint(channel.ChanID) {
|
if chanID.IsChanPoint(channel.ChanID) {
|
||||||
return lnwallet.NewLightningChannel(
|
return lnwallet.NewLightningChannel(
|
||||||
wallet.Signer, notifier,
|
cc.signer, cc.chainNotifier,
|
||||||
s.feeEstimator,
|
cc.feeEstimator,
|
||||||
channel)
|
channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,7 +353,7 @@ func (s *server) Start() error {
|
|||||||
// sufficient number of confirmations, or when the input for the
|
// sufficient number of confirmations, or when the input for the
|
||||||
// funding transaction is spent in an attempt at an uncooperative close
|
// funding transaction is spent in an attempt at an uncooperative close
|
||||||
// by the counterparty.
|
// by the counterparty.
|
||||||
if err := s.chainNotifier.Start(); err != nil {
|
if err := s.cc.chainNotifier.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +402,7 @@ func (s *server) Stop() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown the wallet, funding manager, and the rpc server.
|
// Shutdown the wallet, funding manager, and the rpc server.
|
||||||
s.chainNotifier.Stop()
|
s.cc.chainNotifier.Stop()
|
||||||
s.rpcServer.Stop()
|
s.rpcServer.Stop()
|
||||||
s.fundingMgr.Stop()
|
s.fundingMgr.Stop()
|
||||||
s.chanRouter.Stop()
|
s.chanRouter.Stop()
|
||||||
@@ -421,7 +410,8 @@ func (s *server) Stop() error {
|
|||||||
s.utxoNursery.Stop()
|
s.utxoNursery.Stop()
|
||||||
s.breachArbiter.Stop()
|
s.breachArbiter.Stop()
|
||||||
s.discoverSrv.Stop()
|
s.discoverSrv.Stop()
|
||||||
s.lnwallet.Shutdown()
|
s.cc.wallet.Shutdown()
|
||||||
|
s.cc.chainView.Stop()
|
||||||
|
|
||||||
// Signal all the lingering goroutines to quit.
|
// Signal all the lingering goroutines to quit.
|
||||||
close(s.quit)
|
close(s.quit)
|
||||||
|
Reference in New Issue
Block a user