mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-09 18:24:03 +02:00
lnwallet+breacharbiter: record local csv delay
This commit is contained in:
@@ -896,6 +896,13 @@ func (bo *breachedOutput) CraftInputScript(signer input.Signer, txn *wire.MsgTx,
|
||||
// must be built on top of the confirmation height before the output can be
|
||||
// spent.
|
||||
func (bo *breachedOutput) BlocksToMaturity() uint32 {
|
||||
// If the output is a to_remote output we can claim, and it's of the
|
||||
// confirmed type, we must wait one block before claiming it.
|
||||
if bo.witnessType == input.CommitmentToRemoteConfirmed {
|
||||
return 1
|
||||
}
|
||||
|
||||
// All other breached outputs have no CSV delay.
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -952,6 +959,12 @@ func newRetributionInfo(chanPoint *wire.OutPoint,
|
||||
witnessType = input.CommitSpendNoDelayTweakless
|
||||
}
|
||||
|
||||
// If the local delay is non-zero, it means this output is of
|
||||
// the confirmed to_remote type.
|
||||
if breachInfo.LocalDelay != 0 {
|
||||
witnessType = input.CommitmentToRemoteConfirmed
|
||||
}
|
||||
|
||||
localOutput := makeBreachedOutput(
|
||||
&breachInfo.LocalOutpoint,
|
||||
witnessType,
|
||||
@@ -1117,6 +1130,7 @@ func (b *breachArbiter) sweepSpendableOutputsTxn(txWeight int64,
|
||||
for _, input := range inputs {
|
||||
txn.AddTxIn(&wire.TxIn{
|
||||
PreviousOutPoint: *input.OutPoint(),
|
||||
Sequence: input.BlocksToMaturity(),
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user