Skip to content

Commit 0d22025

Browse files
committed
tapchannel: pass in cltvLock time when making 2nd level sweep vpkts
1 parent ba971f7 commit 0d22025

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tapchannel/aux_sweeper.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,22 +206,26 @@ func (a *AuxSweeper) createSweepVpackets(sweepInputs []*cmsg.AssetOutput,
206206
// the output information locked in, as this was a pre-signed
207207
// transaction.
208208
if sweepDesc.auxSigInfo.IsSome() {
209+
log.Infof("Re-creating second level HTLC vPkt to "+
210+
"spend: %v", resReq.ContractPoint)
211+
209212
var cltvTimeout fn.Option[uint32]
210213
sweepDesc.absoluteDelay.WhenSome(func(delay uint64) {
211214
cltvTimeout = fn.Some(uint32(delay))
212215
})
213216

217+
// When we create the 2nd level allocation, we set the output
218+
// index to be None, as we don't know exactly _where_ on the
219+
// sweep transaction this output will lie.
214220
alloc, err := createSecondLevelHtlcAllocations(
215221
resReq.ChanType, resReq.Initiator, sweepInputs,
216222
resReq.HtlcAmt, resReq.CommitCsvDelay, *resReq.KeyRing,
217-
fn.Some(resReq.ContractPoint.Index), cltvTimeout,
223+
fn.None[uint32](), cltvTimeout,
218224
)
219225
if err != nil {
220226
return lfn.Err[returnType](err)
221227
}
222228

223-
// TODO(roasbeef): allocation needs precise output index set?
224-
225229
allocs = append(allocs, alloc...)
226230
} else {
227231
// Otherwise, for each out we want to sweep, we'll construct an

0 commit comments

Comments
 (0)