fundingmanager: change funding messages to use server.sendToPeer
Previously, during the channel funding process, peers sent wire messages using peer.queueMsg. By switching to server.sendToPeer, the fundingManager is more resilient to network connection issues or system restarts during the funding process. With server.sendToPeer, if a peer gets disconnected, the daemon can attempt to reconnect and continue the process using the peer’s public key ID.
This commit is contained in:
1 parent
69faebfcae
commit
b21bd351e8
7 files changed
+923
-680
No files matched your search
@@ -440,20 +440,20 @@ out:
|
||||
p.queueMsg(lnwire.NewPong(msg.Nonce), nil)
|
||||
|
||||
case *lnwire.SingleFundingRequest:
|
||||
p.server.fundingMgr.processFundingRequest(msg, p)
|
||||
p.server.fundingMgr.processFundingRequest(msg, p.addr)
|
||||
case *lnwire.SingleFundingResponse:
|
||||
p.server.fundingMgr.processFundingResponse(msg, p)
|
||||
p.server.fundingMgr.processFundingResponse(msg, p.addr)
|
||||
case *lnwire.SingleFundingComplete:
|
||||
p.server.fundingMgr.processFundingComplete(msg, p)
|
||||
p.server.fundingMgr.processFundingComplete(msg, p.addr)
|
||||
case *lnwire.SingleFundingSignComplete:
|
||||
p.server.fundingMgr.processFundingSignComplete(msg, p)
|
||||
p.server.fundingMgr.processFundingSignComplete(msg, p.addr)
|
||||
case *lnwire.SingleFundingOpenProof:
|
||||
p.server.fundingMgr.processFundingOpenProof(msg, p)
|
||||
p.server.fundingMgr.processFundingOpenProof(msg, p.addr)
|
||||
case *lnwire.CloseRequest:
|
||||
p.remoteCloseChanReqs <- msg
|
||||
|
||||
case *lnwire.ErrorGeneric:
|
||||
p.server.fundingMgr.processErrorGeneric(msg, p)
|
||||
p.server.fundingMgr.processErrorGeneric(msg, p.addr)
|
||||
|
||||
// TODO(roasbeef): create ChanUpdater interface for the below
|
||||
case *lnwire.UpdateAddHTLC:
|
||||
@@ -1766,6 +1766,17 @@ func (p *peer) updateCommitTx(state *commitmentState, reply bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// fetchNextPendingChanID provides unique IDs for each channel opened between
|
||||
// two peers
|
||||
func (p *peer) fetchNextPendingChanID() uint64 {
|
||||
p.pendingChannelMtx.Lock()
|
||||
defer p.pendingChannelMtx.Unlock()
|
||||
|
||||
chanID := p.nextPendingChannelID
|
||||
p.nextPendingChannelID++
|
||||
return chanID
|
||||
}
|
||||
|
||||
// logEntryToHtlcPkt converts a particular Lightning Commitment Protocol (LCP)
|
||||
// log entry the corresponding htlcPacket with src/dest set along with the
|
||||
// proper wire message. This helper method is provided in order to aid an
|
||||
|
||||
Reference in new issue
Block a user