rpc+funding: add taproot overlay as RPC chan type

This commit is contained in:
Olaoluwa Osuntokun
2024-06-25 15:32:05 -07:00
parent 78394541e7
commit db730d27b5
2 changed files with 29 additions and 2 deletions

View File

@@ -2293,6 +2293,29 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
*channelType = lnwire.ChannelType(*fv)
case lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY:
// If the taproot overlay channel type is being set, then the
// channel MUST be private.
if !in.Private {
return nil, fmt.Errorf("taproot overlay channels " +
"must be private")
}
channelType = new(lnwire.ChannelType)
fv := lnwire.NewRawFeatureVector(
lnwire.SimpleTaprootOverlayChansRequired,
)
if in.ZeroConf {
fv.Set(lnwire.ZeroConfRequired)
}
if in.ScidAlias {
fv.Set(lnwire.ScidAliasRequired)
}
*channelType = lnwire.ChannelType(*fv)
default:
return nil, fmt.Errorf("unhandled request channel type %v",
in.CommitmentType)
@@ -4527,6 +4550,9 @@ func rpcCommitmentType(chanType channeldb.ChannelType) lnrpc.CommitmentType {
case chanType.IsTaproot():
return lnrpc.CommitmentType_SIMPLE_TAPROOT
case chanType.HasTapscriptRoot():
return lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY
case chanType.HasLeaseExpiration():
return lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE