lnd: update the FundingManager to new revoke key funding workflow
This commit is contained in:
parent
2c187209eb
commit
927db9cfd5
@ -250,7 +250,6 @@ func (f *fundingManager) handleFundingRequest(fmsg *fundingRequestMsg) {
|
|||||||
MultiSigKey: msg.ChannelDerivationPoint,
|
MultiSigKey: msg.ChannelDerivationPoint,
|
||||||
CommitKey: msg.CommitmentKey,
|
CommitKey: msg.CommitmentKey,
|
||||||
DeliveryAddress: addrs[0],
|
DeliveryAddress: addrs[0],
|
||||||
RevocationHash: msg.RevocationHash,
|
|
||||||
CsvDelay: delay,
|
CsvDelay: delay,
|
||||||
}
|
}
|
||||||
if err := reservation.ProcessSingleContribution(contribution); err != nil {
|
if err := reservation.ProcessSingleContribution(contribution); err != nil {
|
||||||
@ -269,7 +268,7 @@ func (f *fundingManager) handleFundingRequest(fmsg *fundingRequestMsg) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
fundingResp := lnwire.NewSingleFundingResponse(msg.ChannelID,
|
fundingResp := lnwire.NewSingleFundingResponse(msg.ChannelID,
|
||||||
ourContribution.RevocationHash, ourContribution.CommitKey,
|
ourContribution.RevocationKey, ourContribution.CommitKey,
|
||||||
ourContribution.MultiSigKey, ourContribution.CsvDelay,
|
ourContribution.MultiSigKey, ourContribution.CsvDelay,
|
||||||
deliveryScript)
|
deliveryScript)
|
||||||
|
|
||||||
@ -309,7 +308,7 @@ func (f *fundingManager) handleFundingResponse(fmsg *fundingResponseMsg) {
|
|||||||
MultiSigKey: msg.ChannelDerivationPoint,
|
MultiSigKey: msg.ChannelDerivationPoint,
|
||||||
CommitKey: msg.CommitmentKey,
|
CommitKey: msg.CommitmentKey,
|
||||||
DeliveryAddress: addrs[0],
|
DeliveryAddress: addrs[0],
|
||||||
RevocationHash: msg.RevocationHash,
|
RevocationKey: msg.RevocationKey,
|
||||||
CsvDelay: msg.CsvDelay,
|
CsvDelay: msg.CsvDelay,
|
||||||
}
|
}
|
||||||
if err := resCtx.reservation.ProcessContribution(contribution); err != nil {
|
if err := resCtx.reservation.ProcessContribution(contribution); err != nil {
|
||||||
@ -334,8 +333,9 @@ func (f *fundingManager) handleFundingResponse(fmsg *fundingResponseMsg) {
|
|||||||
fndgLog.Infof("Generated ChannelPoint(%v) for pendingID(%v)",
|
fndgLog.Infof("Generated ChannelPoint(%v) for pendingID(%v)",
|
||||||
outPoint, msg.ChannelID)
|
outPoint, msg.ChannelID)
|
||||||
|
|
||||||
|
revocationKey := resCtx.reservation.OurContribution().RevocationKey
|
||||||
fundingComplete := lnwire.NewSingleFundingComplete(msg.ChannelID,
|
fundingComplete := lnwire.NewSingleFundingComplete(msg.ChannelID,
|
||||||
outPoint, commitSig)
|
outPoint, commitSig, revocationKey)
|
||||||
sourcePeer.queueMsg(fundingComplete, nil)
|
sourcePeer.queueMsg(fundingComplete, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +370,8 @@ func (f *fundingManager) handleFundingComplete(fmsg *fundingCompleteMsg) {
|
|||||||
// sighash type used implicitly within this type of channel for
|
// sighash type used implicitly within this type of channel for
|
||||||
// commitment transactions.
|
// commitment transactions.
|
||||||
commitSig = append(commitSig, byte(txscript.SigHashAll))
|
commitSig = append(commitSig, byte(txscript.SigHashAll))
|
||||||
if err := resCtx.reservation.CompleteReservationSingle(fundingOut, commitSig); err != nil {
|
revokeKey := fmsg.msg.RevocationKey
|
||||||
|
if err := resCtx.reservation.CompleteReservationSingle(revokeKey, fundingOut, commitSig); err != nil {
|
||||||
// TODO(roasbeef): better error logging: peerID, channelID, etc.
|
// TODO(roasbeef): better error logging: peerID, channelID, etc.
|
||||||
fndgLog.Errorf("unable to complete single reservation: %v", err)
|
fndgLog.Errorf("unable to complete single reservation: %v", err)
|
||||||
return
|
return
|
||||||
@ -598,7 +599,6 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
contribution.CsvDelay,
|
contribution.CsvDelay,
|
||||||
contribution.CommitKey,
|
contribution.CommitKey,
|
||||||
contribution.MultiSigKey,
|
contribution.MultiSigKey,
|
||||||
contribution.RevocationHash,
|
|
||||||
deliveryScript,
|
deliveryScript,
|
||||||
)
|
)
|
||||||
msg.peer.queueMsg(fundingReq, nil)
|
msg.peer.queueMsg(fundingReq, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user