Skip to content

Commit db730d2

Browse files
committed
rpc+funding: add taproot overlay as RPC chan type
1 parent 7839454 commit db730d2

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

funding/manager_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4642,8 +4642,8 @@ func testZeroConf(t *testing.T, chanType *lnwire.ChannelType) {
46424642
// opening behavior with a specified fundmax flag. To give a hypothetical
46434643
// example, if ANCHOR types had been introduced after the fundmax flag had been
46444644
// activated, the developer would have had to code for the anchor reserve in the
4645-
// funding manager in the context of public and private channels. Otherwise
4646-
// inconsistent bahvior would have resulted when specifying fundmax for
4645+
// funding manager in the context of public and private channels. Otherwise,
4646+
// inconsistent behavior would have resulted when specifying fundmax for
46474647
// different types of channel openings.
46484648
// To ensure consistency this test compares a map of locally defined channel
46494649
// commitment types to the list of channel types that are defined in the proto
@@ -4659,6 +4659,7 @@ func TestCommitmentTypeFundmaxSanityCheck(t *testing.T) {
46594659
"ANCHORS": 3,
46604660
"SCRIPT_ENFORCED_LEASE": 4,
46614661
"SIMPLE_TAPROOT": 5,
4662+
"SIMPLE_TAPROOT_OVERLAY": 6,
46624663
}
46634664

46644665
for commitmentType := range lnrpc.CommitmentType_value {

rpcserver.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,29 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
22932293

22942294
*channelType = lnwire.ChannelType(*fv)
22952295

2296+
case lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY:
2297+
// If the taproot overlay channel type is being set, then the
2298+
// channel MUST be private.
2299+
if !in.Private {
2300+
return nil, fmt.Errorf("taproot overlay channels " +
2301+
"must be private")
2302+
}
2303+
2304+
channelType = new(lnwire.ChannelType)
2305+
fv := lnwire.NewRawFeatureVector(
2306+
lnwire.SimpleTaprootOverlayChansRequired,
2307+
)
2308+
2309+
if in.ZeroConf {
2310+
fv.Set(lnwire.ZeroConfRequired)
2311+
}
2312+
2313+
if in.ScidAlias {
2314+
fv.Set(lnwire.ScidAliasRequired)
2315+
}
2316+
2317+
*channelType = lnwire.ChannelType(*fv)
2318+
22962319
default:
22972320
return nil, fmt.Errorf("unhandled request channel type %v",
22982321
in.CommitmentType)
@@ -4527,6 +4550,9 @@ func rpcCommitmentType(chanType channeldb.ChannelType) lnrpc.CommitmentType {
45274550
case chanType.IsTaproot():
45284551
return lnrpc.CommitmentType_SIMPLE_TAPROOT
45294552

4553+
case chanType.HasTapscriptRoot():
4554+
return lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY
4555+
45304556
case chanType.HasLeaseExpiration():
45314557
return lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE
45324558

0 commit comments

Comments
 (0)