mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-03 02:02:17 +02:00
htlcswitch: remove lnrpc dependency
This commits removes an unwanted dependency that prevents moving parts of rpcserver to a sub server.
This commit is contained in:
31
peer.go
31
peer.go
@@ -23,7 +23,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/lnpeer"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/ticker"
|
||||
@@ -85,6 +84,18 @@ type chanSnapshotReq struct {
|
||||
resp chan []*channeldb.ChannelSnapshot
|
||||
}
|
||||
|
||||
// pendingUpdate describes the pending state of a closing channel.
|
||||
type pendingUpdate struct {
|
||||
Txid []byte
|
||||
OutputIndex uint32
|
||||
}
|
||||
|
||||
// channelCloseUpdate contains the outcome of the close channel operation.
|
||||
type channelCloseUpdate struct {
|
||||
ClosingTxid []byte
|
||||
Success bool
|
||||
}
|
||||
|
||||
// peer is an active peer on the Lightning Network. This struct is responsible
|
||||
// for managing any channel state related to this peer. To do so, it has
|
||||
// several helper goroutines to handle events such as HTLC timeouts, new
|
||||
@@ -2037,12 +2048,8 @@ func (p *peer) finalizeChanClosure(chanCloser *channelCloser) {
|
||||
// If this is a locally requested shutdown, update the caller with a
|
||||
// new event detailing the current pending state of this request.
|
||||
if closeReq != nil {
|
||||
closeReq.Updates <- &lnrpc.CloseStatusUpdate{
|
||||
Update: &lnrpc.CloseStatusUpdate_ClosePending{
|
||||
ClosePending: &lnrpc.PendingUpdate{
|
||||
Txid: closingTxid[:],
|
||||
},
|
||||
},
|
||||
closeReq.Updates <- &pendingUpdate{
|
||||
Txid: closingTxid[:],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2052,13 +2059,9 @@ func (p *peer) finalizeChanClosure(chanCloser *channelCloser) {
|
||||
// Respond to the local subsystem which requested the
|
||||
// channel closure.
|
||||
if closeReq != nil {
|
||||
closeReq.Updates <- &lnrpc.CloseStatusUpdate{
|
||||
Update: &lnrpc.CloseStatusUpdate_ChanClose{
|
||||
ChanClose: &lnrpc.ChannelCloseUpdate{
|
||||
ClosingTxid: closingTxid[:],
|
||||
Success: true,
|
||||
},
|
||||
},
|
||||
closeReq.Updates <- &channelCloseUpdate{
|
||||
ClosingTxid: closingTxid[:],
|
||||
Success: true,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user