mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 22:31:48 +01:00
msggen: add funderupdate method
Changelog-None
This commit is contained in:
parent
5047bc6dd1
commit
5510445bbc
11 changed files with 788 additions and 294 deletions
114
.msggen.json
114
.msggen.json
|
@ -84,6 +84,11 @@
|
|||
"perkb": 0,
|
||||
"perkw": 1
|
||||
},
|
||||
"FunderupdatePolicy": {
|
||||
"available": 1,
|
||||
"fixed": 2,
|
||||
"match": 0
|
||||
},
|
||||
"GetinfoAddressType": {
|
||||
"dns": 0,
|
||||
"ipv4": 1,
|
||||
|
@ -1233,6 +1238,43 @@
|
|||
"FundChannel_Start.scriptpubkey": 2,
|
||||
"FundChannel_Start.warning_usage": 5
|
||||
},
|
||||
"FunderupdateRequest": {
|
||||
"FunderUpdate.channel_fee_max_base_msat": 14,
|
||||
"FunderUpdate.channel_fee_max_proportional_thousandths": 15,
|
||||
"FunderUpdate.compact_lease": 16,
|
||||
"FunderUpdate.fund_probability": 10,
|
||||
"FunderUpdate.funding_weight": 13,
|
||||
"FunderUpdate.fuzz_percent": 9,
|
||||
"FunderUpdate.lease_fee_base_msat": 11,
|
||||
"FunderUpdate.lease_fee_basis": 12,
|
||||
"FunderUpdate.leases_only": 3,
|
||||
"FunderUpdate.max_their_funding_msat": 5,
|
||||
"FunderUpdate.min_their_funding_msat": 4,
|
||||
"FunderUpdate.per_channel_max_msat": 7,
|
||||
"FunderUpdate.per_channel_min_msat": 6,
|
||||
"FunderUpdate.policy": 1,
|
||||
"FunderUpdate.policy_mod": 2,
|
||||
"FunderUpdate.reserve_tank_msat": 8
|
||||
},
|
||||
"FunderupdateResponse": {
|
||||
"FunderUpdate.channel_fee_max_base_msat": 15,
|
||||
"FunderUpdate.channel_fee_max_proportional_thousandths": 16,
|
||||
"FunderUpdate.compact_lease": 17,
|
||||
"FunderUpdate.fund_probability": 11,
|
||||
"FunderUpdate.funding_weight": 14,
|
||||
"FunderUpdate.fuzz_percent": 10,
|
||||
"FunderUpdate.lease_fee_base_msat": 12,
|
||||
"FunderUpdate.lease_fee_basis": 13,
|
||||
"FunderUpdate.leases_only": 4,
|
||||
"FunderUpdate.max_their_funding_msat": 6,
|
||||
"FunderUpdate.min_their_funding_msat": 5,
|
||||
"FunderUpdate.per_channel_max_msat": 8,
|
||||
"FunderUpdate.per_channel_min_msat": 7,
|
||||
"FunderUpdate.policy": 2,
|
||||
"FunderUpdate.policy_mod": 3,
|
||||
"FunderUpdate.reserve_tank_msat": 9,
|
||||
"FunderUpdate.summary": 1
|
||||
},
|
||||
"FundpsbtRequest": {
|
||||
"FundPsbt.excess_as_change": 8,
|
||||
"FundPsbt.feerate": 2,
|
||||
|
@ -5025,6 +5067,78 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
},
|
||||
"FunderUpdate.channel_fee_max_base_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.channel_fee_max_proportional_thousandths": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.compact_lease": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.fund_probability": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.funding_weight": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.fuzz_percent": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.lease_fee_base_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.lease_fee_basis": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.leases_only": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.max_their_funding_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.min_their_funding_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.per_channel_max_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.per_channel_min_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.policy": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.policy_mod": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.reserve_tank_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FunderUpdate.summary": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"GetLog": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
|
|
52
cln-grpc/proto/node.proto
generated
52
cln-grpc/proto/node.proto
generated
|
@ -66,6 +66,7 @@ service Node {
|
|||
rpc FundChannel(FundchannelRequest) returns (FundchannelResponse) {}
|
||||
rpc FundChannel_Start(Fundchannel_startRequest) returns (Fundchannel_startResponse) {}
|
||||
rpc GetLog(GetlogRequest) returns (GetlogResponse) {}
|
||||
rpc FunderUpdate(FunderupdateRequest) returns (FunderupdateResponse) {}
|
||||
rpc GetRoute(GetrouteRequest) returns (GetrouteResponse) {}
|
||||
rpc ListForwards(ListforwardsRequest) returns (ListforwardsResponse) {}
|
||||
rpc ListOffers(ListoffersRequest) returns (ListoffersResponse) {}
|
||||
|
@ -1929,6 +1930,57 @@ message GetlogLog {
|
|||
optional bytes data = 7;
|
||||
}
|
||||
|
||||
message FunderupdateRequest {
|
||||
// FunderUpdate.policy
|
||||
enum FunderupdatePolicy {
|
||||
MATCH = 0;
|
||||
AVAILABLE = 1;
|
||||
FIXED = 2;
|
||||
}
|
||||
optional FunderupdatePolicy policy = 1;
|
||||
optional Amount policy_mod = 2;
|
||||
optional bool leases_only = 3;
|
||||
optional Amount min_their_funding_msat = 4;
|
||||
optional Amount max_their_funding_msat = 5;
|
||||
optional Amount per_channel_min_msat = 6;
|
||||
optional Amount per_channel_max_msat = 7;
|
||||
optional Amount reserve_tank_msat = 8;
|
||||
optional uint32 fuzz_percent = 9;
|
||||
optional uint32 fund_probability = 10;
|
||||
optional Amount lease_fee_base_msat = 11;
|
||||
optional uint32 lease_fee_basis = 12;
|
||||
optional uint32 funding_weight = 13;
|
||||
optional Amount channel_fee_max_base_msat = 14;
|
||||
optional uint32 channel_fee_max_proportional_thousandths = 15;
|
||||
optional bytes compact_lease = 16;
|
||||
}
|
||||
|
||||
message FunderupdateResponse {
|
||||
// FunderUpdate.policy
|
||||
enum FunderupdatePolicy {
|
||||
MATCH = 0;
|
||||
AVAILABLE = 1;
|
||||
FIXED = 2;
|
||||
}
|
||||
string summary = 1;
|
||||
FunderupdatePolicy policy = 2;
|
||||
uint32 policy_mod = 3;
|
||||
bool leases_only = 4;
|
||||
Amount min_their_funding_msat = 5;
|
||||
Amount max_their_funding_msat = 6;
|
||||
Amount per_channel_min_msat = 7;
|
||||
Amount per_channel_max_msat = 8;
|
||||
Amount reserve_tank_msat = 9;
|
||||
uint32 fuzz_percent = 10;
|
||||
uint32 fund_probability = 11;
|
||||
optional Amount lease_fee_base_msat = 12;
|
||||
optional uint32 lease_fee_basis = 13;
|
||||
optional uint32 funding_weight = 14;
|
||||
optional Amount channel_fee_max_base_msat = 15;
|
||||
optional uint32 channel_fee_max_proportional_thousandths = 16;
|
||||
optional bytes compact_lease = 17;
|
||||
}
|
||||
|
||||
message GetrouteRequest {
|
||||
bytes id = 1;
|
||||
uint64 riskfactor = 3;
|
||||
|
|
73
cln-grpc/src/convert.rs
generated
73
cln-grpc/src/convert.rs
generated
|
@ -1827,6 +1827,31 @@ impl From<responses::GetlogResponse> for pb::GetlogResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::FunderupdateResponse> for pb::FunderupdateResponse {
|
||||
fn from(c: responses::FunderupdateResponse) -> Self {
|
||||
Self {
|
||||
channel_fee_max_base_msat: c.channel_fee_max_base_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #2 for type u32?
|
||||
compact_lease: c.compact_lease.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex?
|
||||
fund_probability: c.fund_probability, // Rule #2 for type u32
|
||||
funding_weight: c.funding_weight, // Rule #2 for type u32?
|
||||
fuzz_percent: c.fuzz_percent, // Rule #2 for type u32
|
||||
lease_fee_base_msat: c.lease_fee_base_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
lease_fee_basis: c.lease_fee_basis, // Rule #2 for type u32?
|
||||
leases_only: c.leases_only, // Rule #2 for type boolean
|
||||
max_their_funding_msat: Some(c.max_their_funding_msat.into()), // Rule #2 for type msat
|
||||
min_their_funding_msat: Some(c.min_their_funding_msat.into()), // Rule #2 for type msat
|
||||
per_channel_max_msat: Some(c.per_channel_max_msat.into()), // Rule #2 for type msat
|
||||
per_channel_min_msat: Some(c.per_channel_min_msat.into()), // Rule #2 for type msat
|
||||
policy: c.policy as i32,
|
||||
policy_mod: c.policy_mod, // Rule #2 for type u32
|
||||
reserve_tank_msat: Some(c.reserve_tank_msat.into()), // Rule #2 for type msat
|
||||
summary: c.summary, // Rule #2 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::GetrouteRoute> for pb::GetrouteRoute {
|
||||
fn from(c: responses::GetrouteRoute) -> Self {
|
||||
|
@ -3484,6 +3509,30 @@ impl From<requests::GetlogRequest> for pb::GetlogRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::FunderupdateRequest> for pb::FunderupdateRequest {
|
||||
fn from(c: requests::FunderupdateRequest) -> Self {
|
||||
Self {
|
||||
channel_fee_max_base_msat: c.channel_fee_max_base_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #2 for type u32?
|
||||
compact_lease: c.compact_lease.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex?
|
||||
fund_probability: c.fund_probability, // Rule #2 for type u32?
|
||||
funding_weight: c.funding_weight, // Rule #2 for type u32?
|
||||
fuzz_percent: c.fuzz_percent, // Rule #2 for type u32?
|
||||
lease_fee_base_msat: c.lease_fee_base_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
lease_fee_basis: c.lease_fee_basis, // Rule #2 for type u32?
|
||||
leases_only: c.leases_only, // Rule #2 for type boolean?
|
||||
max_their_funding_msat: c.max_their_funding_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
min_their_funding_msat: c.min_their_funding_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
per_channel_max_msat: c.per_channel_max_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
per_channel_min_msat: c.per_channel_min_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
policy: c.policy.map(|v| v as i32),
|
||||
policy_mod: c.policy_mod.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve_tank_msat: c.reserve_tank_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::GetrouteRequest> for pb::GetrouteRequest {
|
||||
fn from(c: requests::GetrouteRequest) -> Self {
|
||||
|
@ -4734,6 +4783,30 @@ impl From<pb::GetlogRequest> for requests::GetlogRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::FunderupdateRequest> for requests::FunderupdateRequest {
|
||||
fn from(c: pb::FunderupdateRequest) -> Self {
|
||||
Self {
|
||||
channel_fee_max_base_msat: c.channel_fee_max_base_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #1 for type u32?
|
||||
compact_lease: c.compact_lease.map(|v| hex::encode(v)), // Rule #1 for type hex?
|
||||
fund_probability: c.fund_probability, // Rule #1 for type u32?
|
||||
funding_weight: c.funding_weight, // Rule #1 for type u32?
|
||||
fuzz_percent: c.fuzz_percent, // Rule #1 for type u32?
|
||||
lease_fee_base_msat: c.lease_fee_base_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
lease_fee_basis: c.lease_fee_basis, // Rule #1 for type u32?
|
||||
leases_only: c.leases_only, // Rule #1 for type boolean?
|
||||
max_their_funding_msat: c.max_their_funding_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
min_their_funding_msat: c.min_their_funding_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
per_channel_max_msat: c.per_channel_max_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
per_channel_min_msat: c.per_channel_min_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
policy: c.policy.map(|v| v.try_into().unwrap()),
|
||||
policy_mod: c.policy_mod.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve_tank_msat: c.reserve_tank_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::GetrouteRequest> for requests::GetrouteRequest {
|
||||
fn from(c: pb::GetrouteRequest) -> Self {
|
||||
|
|
|
@ -1938,6 +1938,38 @@ impl Node for Server
|
|||
|
||||
}
|
||||
|
||||
async fn funder_update(
|
||||
&self,
|
||||
request: tonic::Request<pb::FunderupdateRequest>,
|
||||
) -> Result<tonic::Response<pb::FunderupdateResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::FunderupdateRequest = req.into();
|
||||
debug!("Client asked for funder_update");
|
||||
trace!("funder_update request: {:?}", req);
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::FunderUpdate(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method FunderUpdate: {:?}", e)))?;
|
||||
match result {
|
||||
Response::FunderUpdate(r) => {
|
||||
trace!("funder_update response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call FunderUpdate",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn get_route(
|
||||
&self,
|
||||
request: tonic::Request<pb::GetrouteRequest>,
|
||||
|
|
160
cln-rpc/src/model.rs
generated
160
cln-rpc/src/model.rs
generated
|
@ -78,6 +78,7 @@ pub enum Request {
|
|||
FundChannel(requests::FundchannelRequest),
|
||||
FundChannel_Start(requests::Fundchannel_startRequest),
|
||||
GetLog(requests::GetlogRequest),
|
||||
FunderUpdate(requests::FunderupdateRequest),
|
||||
GetRoute(requests::GetrouteRequest),
|
||||
ListForwards(requests::ListforwardsRequest),
|
||||
ListOffers(requests::ListoffersRequest),
|
||||
|
@ -193,6 +194,7 @@ pub enum Response {
|
|||
FundChannel(responses::FundchannelResponse),
|
||||
FundChannel_Start(responses::Fundchannel_startResponse),
|
||||
GetLog(responses::GetlogResponse),
|
||||
FunderUpdate(responses::FunderupdateResponse),
|
||||
GetRoute(responses::GetrouteResponse),
|
||||
ListForwards(responses::ListforwardsResponse),
|
||||
ListOffers(responses::ListoffersResponse),
|
||||
|
@ -2239,6 +2241,92 @@ pub mod requests {
|
|||
"getlog"
|
||||
}
|
||||
}
|
||||
/// ['Funder plugin will use to decide how much capital to commit to a v2 open channel request.', 'There are three policy options, detailed below:', ' * `match` -- Contribute *policy_mod* percent of their requested funds. Valid *policy_mod* values are 0 to 200. If this is a channel lease request, we match based on their requested funds. If it is not a channel lease request (and *lease_only* is false), then we match their funding amount. Note: any lease match less than 100 will likely fail, as clients will not accept a lease less than their request.', ' * `available` -- Contribute *policy_mod* percent of our available node wallet funds. Valid *policy_mod* values are 0 to 100.', ' * `fixed` -- Contributes a fixed *policy_mod* sats to v2 channel open requests.']
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum FunderupdatePolicy {
|
||||
#[serde(rename = "match")]
|
||||
MATCH = 0,
|
||||
#[serde(rename = "available")]
|
||||
AVAILABLE = 1,
|
||||
#[serde(rename = "fixed")]
|
||||
FIXED = 2,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for FunderupdatePolicy {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<FunderupdatePolicy, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(FunderupdatePolicy::MATCH),
|
||||
1 => Ok(FunderupdatePolicy::AVAILABLE),
|
||||
2 => Ok(FunderupdatePolicy::FIXED),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum FunderupdatePolicy", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for FunderupdatePolicy {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
FunderupdatePolicy::MATCH => "MATCH",
|
||||
FunderupdatePolicy::AVAILABLE => "AVAILABLE",
|
||||
FunderupdatePolicy::FIXED => "FIXED",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct FunderupdateRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel_fee_max_base_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel_fee_max_proportional_thousandths: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub compact_lease: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub fund_probability: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub funding_weight: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub fuzz_percent: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub lease_fee_base_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub lease_fee_basis: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub leases_only: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub max_their_funding_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub min_their_funding_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub per_channel_max_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub per_channel_min_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub policy: Option<FunderupdatePolicy>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub policy_mod: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reserve_tank_msat: Option<Amount>,
|
||||
}
|
||||
|
||||
impl From<FunderupdateRequest> for Request {
|
||||
fn from(r: FunderupdateRequest) -> Self {
|
||||
Request::FunderUpdate(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for FunderupdateRequest {
|
||||
type Response = super::responses::FunderupdateResponse;
|
||||
}
|
||||
|
||||
impl TypedRequest for FunderupdateRequest {
|
||||
type Response = super::responses::FunderupdateResponse;
|
||||
|
||||
fn method(&self) -> &str {
|
||||
"funderupdate"
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct GetrouteRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -6926,6 +7014,78 @@ pub mod responses {
|
|||
}
|
||||
}
|
||||
|
||||
/// ['Policy funder plugin will use to decide how much capital to commit to a v2 open channel request.']
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum FunderupdatePolicy {
|
||||
#[serde(rename = "match")]
|
||||
MATCH = 0,
|
||||
#[serde(rename = "available")]
|
||||
AVAILABLE = 1,
|
||||
#[serde(rename = "fixed")]
|
||||
FIXED = 2,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for FunderupdatePolicy {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<FunderupdatePolicy, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(FunderupdatePolicy::MATCH),
|
||||
1 => Ok(FunderupdatePolicy::AVAILABLE),
|
||||
2 => Ok(FunderupdatePolicy::FIXED),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum FunderupdatePolicy", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for FunderupdatePolicy {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
FunderupdatePolicy::MATCH => "MATCH",
|
||||
FunderupdatePolicy::AVAILABLE => "AVAILABLE",
|
||||
FunderupdatePolicy::FIXED => "FIXED",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct FunderupdateResponse {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel_fee_max_base_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel_fee_max_proportional_thousandths: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub compact_lease: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub funding_weight: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub lease_fee_base_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub lease_fee_basis: Option<u32>,
|
||||
// Path `FunderUpdate.policy`
|
||||
pub policy: FunderupdatePolicy,
|
||||
pub fund_probability: u32,
|
||||
pub fuzz_percent: u32,
|
||||
pub leases_only: bool,
|
||||
pub max_their_funding_msat: Amount,
|
||||
pub min_their_funding_msat: Amount,
|
||||
pub per_channel_max_msat: Amount,
|
||||
pub per_channel_min_msat: Amount,
|
||||
pub policy_mod: u32,
|
||||
pub reserve_tank_msat: Amount,
|
||||
pub summary: String,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for FunderupdateResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::FunderUpdate(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ['The features understood by the destination node.']
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum GetrouteRouteStyle {
|
||||
|
|
|
@ -10813,7 +10813,7 @@
|
|||
"default": "fixed"
|
||||
},
|
||||
"policy_mod": {
|
||||
"type": "sat",
|
||||
"type": "msat",
|
||||
"description": [
|
||||
"Number or 'modification' to apply to the policy."
|
||||
],
|
||||
|
|
|
@ -147,8 +147,8 @@ def load_jsonrpc_service():
|
|||
"FundChannel_Complete",
|
||||
"FundChannel",
|
||||
"FundChannel_Start",
|
||||
# "funderupdate",
|
||||
"GetLog",
|
||||
"FunderUpdate",
|
||||
"GetRoute",
|
||||
"ListForwards",
|
||||
"ListOffers",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -304,6 +304,11 @@ class NodeStub(object):
|
|||
request_serializer=node__pb2.GetlogRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.GetlogResponse.FromString,
|
||||
)
|
||||
self.FunderUpdate = channel.unary_unary(
|
||||
'/cln.Node/FunderUpdate',
|
||||
request_serializer=node__pb2.FunderupdateRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.FunderupdateResponse.FromString,
|
||||
)
|
||||
self.GetRoute = channel.unary_unary(
|
||||
'/cln.Node/GetRoute',
|
||||
request_serializer=node__pb2.GetrouteRequest.SerializeToString,
|
||||
|
@ -892,6 +897,12 @@ class NodeServicer(object):
|
|||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def FunderUpdate(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def GetRoute(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
|
@ -1467,6 +1478,11 @@ def add_NodeServicer_to_server(servicer, server):
|
|||
request_deserializer=node__pb2.GetlogRequest.FromString,
|
||||
response_serializer=node__pb2.GetlogResponse.SerializeToString,
|
||||
),
|
||||
'FunderUpdate': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.FunderUpdate,
|
||||
request_deserializer=node__pb2.FunderupdateRequest.FromString,
|
||||
response_serializer=node__pb2.FunderupdateResponse.SerializeToString,
|
||||
),
|
||||
'GetRoute': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetRoute,
|
||||
request_deserializer=node__pb2.GetrouteRequest.FromString,
|
||||
|
@ -2698,6 +2714,23 @@ class Node(object):
|
|||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def FunderUpdate(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(request, target, '/cln.Node/FunderUpdate',
|
||||
node__pb2.FunderupdateRequest.SerializeToString,
|
||||
node__pb2.FunderupdateResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetRoute(request,
|
||||
target,
|
||||
|
|
|
@ -1497,6 +1497,28 @@ def getlog2py(m):
|
|||
})
|
||||
|
||||
|
||||
def funderupdate2py(m):
|
||||
return remove_default({
|
||||
"policy": str(m.policy), # EnumField in generate_composite
|
||||
"channel_fee_max_base_msat": amount2msat(m.channel_fee_max_base_msat), # PrimitiveField in generate_composite
|
||||
"channel_fee_max_proportional_thousandths": m.channel_fee_max_proportional_thousandths, # PrimitiveField in generate_composite
|
||||
"compact_lease": hexlify(m.compact_lease), # PrimitiveField in generate_composite
|
||||
"fund_probability": m.fund_probability, # PrimitiveField in generate_composite
|
||||
"funding_weight": m.funding_weight, # PrimitiveField in generate_composite
|
||||
"fuzz_percent": m.fuzz_percent, # PrimitiveField in generate_composite
|
||||
"lease_fee_base_msat": amount2msat(m.lease_fee_base_msat), # PrimitiveField in generate_composite
|
||||
"lease_fee_basis": m.lease_fee_basis, # PrimitiveField in generate_composite
|
||||
"leases_only": m.leases_only, # PrimitiveField in generate_composite
|
||||
"max_their_funding_msat": amount2msat(m.max_their_funding_msat), # PrimitiveField in generate_composite
|
||||
"min_their_funding_msat": amount2msat(m.min_their_funding_msat), # PrimitiveField in generate_composite
|
||||
"per_channel_max_msat": amount2msat(m.per_channel_max_msat), # PrimitiveField in generate_composite
|
||||
"per_channel_min_msat": amount2msat(m.per_channel_min_msat), # PrimitiveField in generate_composite
|
||||
"policy_mod": m.policy_mod, # PrimitiveField in generate_composite
|
||||
"reserve_tank_msat": amount2msat(m.reserve_tank_msat), # PrimitiveField in generate_composite
|
||||
"summary": m.summary, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def getroute_route2py(m):
|
||||
return remove_default({
|
||||
"style": str(m.style), # EnumField in generate_composite
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"default": "fixed"
|
||||
},
|
||||
"policy_mod": {
|
||||
"type": "sat",
|
||||
"type": "msat",
|
||||
"description": [
|
||||
"Number or 'modification' to apply to the policy."
|
||||
],
|
||||
|
|
Loading…
Add table
Reference in a new issue