mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
rpc: add new commitment_type field to OpenChannelRequest
This field will be examined later down the stack along with the set of feature bits to determine if explicit channel commitment type negotiation is possible or not.
This commit is contained in:
28
rpcserver.go
28
rpcserver.go
@ -1912,6 +1912,33 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
err)
|
||||
}
|
||||
|
||||
var channelType *lnwire.ChannelType
|
||||
switch in.CommitmentType {
|
||||
case lnrpc.CommitmentType_UNKNOWN_COMMITMENT_TYPE:
|
||||
break
|
||||
|
||||
case lnrpc.CommitmentType_LEGACY:
|
||||
channelType = new(lnwire.ChannelType)
|
||||
*channelType = lnwire.ChannelType(*lnwire.NewRawFeatureVector())
|
||||
|
||||
case lnrpc.CommitmentType_STATIC_REMOTE_KEY:
|
||||
channelType = new(lnwire.ChannelType)
|
||||
*channelType = lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
))
|
||||
|
||||
case lnrpc.CommitmentType_ANCHORS:
|
||||
channelType = new(lnwire.ChannelType)
|
||||
*channelType = lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
))
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unhandled request channel type %v",
|
||||
in.CommitmentType)
|
||||
}
|
||||
|
||||
// Instruct the server to trigger the necessary events to attempt to
|
||||
// open a new channel. A stream is returned in place, this stream will
|
||||
// be used to consume updates of the state of the pending channel.
|
||||
@ -1929,6 +1956,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
MaxValueInFlight: maxValue,
|
||||
MaxHtlcs: maxHtlcs,
|
||||
MaxLocalCsv: uint16(in.MaxLocalCsv),
|
||||
ChannelType: channelType,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user