Skip to content

Commit b95f9b8

Browse files
Roasbeefguggero
authored andcommitted
rpc+funding: add taproot overlay as RPC chan type
1 parent 570082d commit b95f9b8

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
@@ -2294,6 +2294,29 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
22942294

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

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

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

0 commit comments

Comments
 (0)