Skip to content

Commit 2b358fa

Browse files
Roasbeefguggero
authored andcommitted
funding: add chan type awareness for new taproot chans overlay
1 parent 1e47398 commit 2b358fa

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

funding/commitment_type_negotiation.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,74 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
307307

308308
return lnwallet.CommitmentTypeSimpleTaproot, nil
309309

310+
// Simple taproot channels overlay only.
311+
case channelFeatures.OnlyContains(
312+
lnwire.SimpleTaprootOverlayChansRequired,
313+
):
314+
315+
if !hasFeatures(
316+
local, remote,
317+
lnwire.SimpleTaprootOverlayChansOptional,
318+
) {
319+
320+
return 0, errUnsupportedChannelType
321+
}
322+
323+
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
324+
325+
// Simple taproot overlay channels with scid only.
326+
case channelFeatures.OnlyContains(
327+
lnwire.SimpleTaprootOverlayChansRequired,
328+
lnwire.ScidAliasRequired,
329+
):
330+
331+
if !hasFeatures(
332+
local, remote,
333+
lnwire.SimpleTaprootOverlayChansOptional,
334+
lnwire.ScidAliasOptional,
335+
) {
336+
337+
return 0, errUnsupportedChannelType
338+
}
339+
340+
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
341+
342+
// Simple taproot overlay channels with zero conf only.
343+
case channelFeatures.OnlyContains(
344+
lnwire.SimpleTaprootOverlayChansRequired,
345+
lnwire.ZeroConfRequired,
346+
):
347+
348+
if !hasFeatures(
349+
local, remote,
350+
lnwire.SimpleTaprootOverlayChansOptional,
351+
lnwire.ZeroConfOptional,
352+
) {
353+
354+
return 0, errUnsupportedChannelType
355+
}
356+
357+
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
358+
359+
// Simple taproot overlay channels with scid and zero conf.
360+
case channelFeatures.OnlyContains(
361+
lnwire.SimpleTaprootOverlayChansRequired,
362+
lnwire.ZeroConfRequired,
363+
lnwire.ScidAliasRequired,
364+
):
365+
366+
if !hasFeatures(
367+
local, remote,
368+
lnwire.SimpleTaprootOverlayChansOptional,
369+
lnwire.ZeroConfOptional,
370+
lnwire.ScidAliasOptional,
371+
) {
372+
373+
return 0, errUnsupportedChannelType
374+
}
375+
376+
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
377+
310378
// No features, use legacy commitment type.
311379
case channelFeatures.IsEmpty():
312380
return lnwallet.CommitmentTypeLegacy, nil

0 commit comments

Comments
 (0)