Skip to content

Commit

Permalink
Merge pull request fedimint#6308 from m1sterc001guy/federation_name
Browse files Browse the repository at this point in the history
chore: include federation name in `FederationInfo`
  • Loading branch information
elsirion authored Nov 9, 2024
2 parents f6f9c6f + 2e92427 commit d6533ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gateway/ln-gateway/src/federation_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ impl FederationManager {

Ok(FederationInfo {
federation_id,
federation_name: self.federation_name(client).await,
balance_msat,
federation_index,
routing_fees,
Expand All @@ -242,6 +243,12 @@ impl FederationManager {
.await
}

pub async fn federation_name(&self, client: &ClientHandleArc) -> Option<String> {
let client_config = client.config().await;
let federation_name = client_config.global.federation_name();
federation_name.map(String::from)
}

pub async fn federation_info_all_federations(
&self,
mut dbtx: DatabaseTransaction<'_, NonCommittable>,
Expand All @@ -259,6 +266,7 @@ impl FederationManager {

federation_infos.push(FederationInfo {
federation_id: *federation_id,
federation_name: self.federation_name(client.value()).await,
balance_msat,
federation_index,
routing_fees,
Expand Down
1 change: 1 addition & 0 deletions gateway/ln-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,7 @@ impl Gateway {
// federation info here because short channel id is not yet persisted.
let federation_info = FederationInfo {
federation_id,
federation_name: federation_manager.federation_name(&client).await,
balance_msat: client.get_balance().await,
federation_index,
routing_fees: Some(gateway_config.routing_fees.into()),
Expand Down
1 change: 1 addition & 0 deletions gateway/ln-gateway/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub struct WithdrawResponse {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct FederationInfo {
pub federation_id: FederationId,
pub federation_name: Option<String>,
pub balance_msat: Amount,
pub federation_index: u64,
pub routing_fees: Option<FederationRoutingFees>,
Expand Down

0 comments on commit d6533ed

Please sign in to comment.