Skip to content

Commit 204fc7f

Browse files
Roasbeefguggero
authored andcommitted
rpc+funding: add taproot overlay as RPC chan type
1 parent 19608a6 commit 204fc7f

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

22782278
*channelType = lnwire.ChannelType(*fv)
22792279

2280+
case lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY:
2281+
// If the taproot overlay channel type is being set, then the
2282+
// channel MUST be private.
2283+
if !in.Private {
2284+
return nil, fmt.Errorf("taproot overlay channels " +
2285+
"must be private")
2286+
}
2287+
2288+
channelType = new(lnwire.ChannelType)
2289+
fv := lnwire.NewRawFeatureVector(
2290+
lnwire.SimpleTaprootOverlayChansRequired,
2291+
)
2292+
2293+
if in.ZeroConf {
2294+
fv.Set(lnwire.ZeroConfRequired)
2295+
}
2296+
2297+
if in.ScidAlias {
2298+
fv.Set(lnwire.ScidAliasRequired)
2299+
}
2300+
2301+
*channelType = lnwire.ChannelType(*fv)
2302+
22802303
default:
22812304
return nil, fmt.Errorf("unhandled request channel type %v",
22822305
in.CommitmentType)
@@ -4511,6 +4534,9 @@ func rpcCommitmentType(chanType channeldb.ChannelType) lnrpc.CommitmentType {
45114534
case chanType.IsTaproot():
45124535
return lnrpc.CommitmentType_SIMPLE_TAPROOT
45134536

4537+
case chanType.HasTapscriptRoot():
4538+
return lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY
4539+
45144540
case chanType.HasLeaseExpiration():
45154541
return lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE
45164542

0 commit comments

Comments
 (0)