lnwallet: add dust limit to contribution
In order to make the node's dust limit available to the wallet during the initial stages of the funding process, add and set a DustLimit field in the Contribution.
This commit is contained in:
parent
74854963bf
commit
18f453a3e6
@ -579,6 +579,7 @@ func (f *fundingManager) handleFundingRequest(fmsg *fundingRequestMsg) {
|
||||
MultiSigKey: copyPubKey(msg.ChannelDerivationPoint),
|
||||
CommitKey: copyPubKey(msg.CommitmentKey),
|
||||
DeliveryAddress: addrs[0],
|
||||
DustLimit: msg.DustLimit,
|
||||
CsvDelay: delay,
|
||||
}
|
||||
if err := reservation.ProcessSingleContribution(contribution); err != nil {
|
||||
@ -662,6 +663,7 @@ func (f *fundingManager) handleFundingResponse(fmsg *fundingResponseMsg) {
|
||||
CommitKey: copyPubKey(msg.CommitmentKey),
|
||||
DeliveryAddress: addrs[0],
|
||||
RevocationKey: copyPubKey(msg.RevocationKey),
|
||||
DustLimit: msg.DustLimit,
|
||||
CsvDelay: msg.CsvDelay,
|
||||
}
|
||||
if err := resCtx.reservation.ProcessContribution(contribution); err != nil {
|
||||
|
@ -46,6 +46,11 @@ type ChannelContribution struct {
|
||||
// initial version of this party's commitment transaction.
|
||||
RevocationKey *btcec.PublicKey
|
||||
|
||||
// DustLimit is the threshold below which no HTLC output should be
|
||||
// generated for this party. HTLCs below this amount are not
|
||||
// enforceable on-chain from this party's point of view.
|
||||
DustLimit btcutil.Amount
|
||||
|
||||
// CsvDelay The delay (in blocks) to be used for the pay-to-self output
|
||||
// in this party's version of the commitment transaction.
|
||||
CsvDelay uint32
|
||||
|
@ -529,6 +529,7 @@ func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg
|
||||
|
||||
reservation.nodeAddr = req.nodeAddr
|
||||
reservation.ourContribution.CsvDelay = req.csvDelay
|
||||
reservation.ourContribution.DustLimit = req.ourDustLimit
|
||||
|
||||
reservation.partialState.NumConfsRequired = req.numConfs
|
||||
reservation.partialState.IdentityPub = req.nodeID
|
||||
@ -779,16 +780,18 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
||||
ourBalance := pendingReservation.partialState.OurBalance
|
||||
theirBalance := pendingReservation.partialState.TheirBalance
|
||||
ourCommitKey := ourContribution.CommitKey
|
||||
ourCommitTx, err := CreateCommitTx(fundingTxIn, ourCommitKey, theirCommitKey,
|
||||
ourRevokeKey, ourContribution.CsvDelay,
|
||||
ourBalance, theirBalance, pendingReservation.partialState.OurDustLimit)
|
||||
ourCommitTx, err := CreateCommitTx(fundingTxIn, ourCommitKey,
|
||||
theirCommitKey, ourRevokeKey, ourContribution.CsvDelay,
|
||||
ourBalance, theirBalance,
|
||||
pendingReservation.ourContribution.DustLimit)
|
||||
if err != nil {
|
||||
req.err <- err
|
||||
return
|
||||
}
|
||||
theirCommitTx, err := CreateCommitTx(fundingTxIn, theirCommitKey, ourCommitKey,
|
||||
theirContribution.RevocationKey, theirContribution.CsvDelay,
|
||||
theirBalance, ourBalance, pendingReservation.partialState.TheirDustLimit)
|
||||
theirCommitTx, err := CreateCommitTx(fundingTxIn, theirCommitKey,
|
||||
ourCommitKey, theirContribution.RevocationKey,
|
||||
theirContribution.CsvDelay, theirBalance, ourBalance,
|
||||
pendingReservation.theirContribution.DustLimit)
|
||||
if err != nil {
|
||||
req.err <- err
|
||||
return
|
||||
@ -1109,18 +1112,19 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
|
||||
theirCommitKey := pendingReservation.theirContribution.CommitKey
|
||||
ourBalance := pendingReservation.partialState.OurBalance
|
||||
theirBalance := pendingReservation.partialState.TheirBalance
|
||||
ourCommitTx, err := CreateCommitTx(fundingTxIn, ourCommitKey, theirCommitKey,
|
||||
pendingReservation.ourContribution.RevocationKey,
|
||||
pendingReservation.ourContribution.CsvDelay, ourBalance, theirBalance,
|
||||
pendingReservation.partialState.OurDustLimit)
|
||||
ourCommitTx, err := CreateCommitTx(fundingTxIn, ourCommitKey,
|
||||
theirCommitKey, pendingReservation.ourContribution.RevocationKey,
|
||||
pendingReservation.ourContribution.CsvDelay, ourBalance,
|
||||
theirBalance, pendingReservation.ourContribution.DustLimit)
|
||||
if err != nil {
|
||||
req.err <- err
|
||||
req.completeChan <- nil
|
||||
return
|
||||
}
|
||||
theirCommitTx, err := CreateCommitTx(fundingTxIn, theirCommitKey, ourCommitKey,
|
||||
req.revokeKey, pendingReservation.theirContribution.CsvDelay,
|
||||
theirBalance, ourBalance, pendingReservation.partialState.TheirDustLimit)
|
||||
theirCommitTx, err := CreateCommitTx(fundingTxIn, theirCommitKey,
|
||||
ourCommitKey, req.revokeKey,
|
||||
pendingReservation.theirContribution.CsvDelay, theirBalance,
|
||||
ourBalance, pendingReservation.theirContribution.DustLimit)
|
||||
if err != nil {
|
||||
req.err <- err
|
||||
req.completeChan <- nil
|
||||
|
Loading…
Reference in New Issue
Block a user