Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lightning-liquidity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ inbound Lightning liquidity for which they are willing and able to pay in bitcoi
on-boarding of clients as the channel opening fees are deducted from the
incoming payment, i.e., no funds are required client-side to initiate this
flow.
- [bLIP-55 / LSPS5] lets a client register HTTPS webhooks with its LSP so the LSP can send signed push
notifications (for example "payment incoming") that wake the app when it is offline, which is essential
for mobile wallets that get suspended in the background.

To get started, you'll want to setup a `LiquidityManager` and configure it to be the `CustomMessageHandler` of your LDK node. You can then call `LiquidityManager::lsps1_client_handler` / `LiquidityManager::lsps2_client_handler`, or `LiquidityManager::lsps2_service_handler`, to access the respective client-side or service-side handlers.
To get started, you'll want to setup a `LiquidityManager` and configure it to be the `CustomMessageHandler` of your LDK node. You can then call `LiquidityManager::lsps1_client_handler` / `LiquidityManager::lsps2_client_handler`, `LiquidityManager::lsps2_service_handler`, `LiquidityManager::lsps5_service_handler` or `LiquidityManager::lsps5_client_handler` to access the respective client-side or service-side handlers.

`LiquidityManager` uses an eventing system to notify the user about important updates to the protocol flow. To this end, you will need to handle events emitted via one of the event handling methods provided by `LiquidityManager`, e.g., `LiquidityManager::next_event`.

[bLIP-50 / LSPS0]: https://github.com/lightning/blips/blob/master/blip-0050.md
[bLIP-51 / LSPS1]: https://github.com/lightning/blips/blob/master/blip-0051.md
[bLIP-52 / LSPS2]: https://github.com/lightning/blips/blob/master/blip-0052.md
[bLIP-55 / LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
16 changes: 8 additions & 8 deletions lightning-liquidity/src/lsps2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ where
"Received get_info response for an unknown request: {:?}",
request_id
),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
});
}

Expand All @@ -222,7 +222,7 @@ where
"Received get_info response from unknown peer: {:?}",
counterparty_node_id
),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
})
},
}
Expand All @@ -246,7 +246,7 @@ where
"Received get_info error for an unknown request: {:?}",
request_id
),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
});
}

Expand All @@ -267,7 +267,7 @@ where
Err(lightning_error)
},
None => {
return Err(LightningError { err: format!("Received error response for a get_info request from an unknown counterparty ({:?})",counterparty_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received error response for a get_info request from an unknown counterparty ({:?})",counterparty_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
}
Expand All @@ -289,7 +289,7 @@ where
"Received buy response for an unknown request: {:?}",
request_id
),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
})?;

if let Ok(intercept_scid) = result.jit_channel_scid.to_scid() {
Expand All @@ -316,7 +316,7 @@ where
"Received buy response from unknown peer: {:?}",
counterparty_node_id
),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
});
},
}
Expand All @@ -335,7 +335,7 @@ where

peer_state.pending_buy_requests.remove(&request_id).ok_or(LightningError {
err: format!("Received buy error for an unknown request: {:?}", request_id),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
})?;

let lightning_error = LightningError {
Expand All @@ -355,7 +355,7 @@ where
Err(lightning_error)
},
None => {
return Err(LightningError { err: format!("Received error response for a buy request from an unknown counterparty ({:?})", counterparty_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received error response for a buy request from an unknown counterparty ({:?})", counterparty_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
}
Expand Down
6 changes: 3 additions & 3 deletions lightning-liquidity/src/lsps5/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ where
"Received unexpected request message from {}",
counterparty_node_id
),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
});
},
LSPS5Message::Response(rid, resp) => (rid, resp),
};
let mut result: Result<(), LightningError> = Err(LightningError {
err: format!("Received LSPS5 response from unknown peer: {}", counterparty_node_id),
action: ErrorAction::IgnoreAndLog(Level::Error),
action: ErrorAction::IgnoreAndLog(Level::Debug),
});
let event_queue_notifier = self.pending_events.notifier();
let handle_response = |peer_state: &mut PeerState<TP>| {
Expand Down Expand Up @@ -409,7 +409,7 @@ where
} else {
result = Err(LightningError {
err: format!("Received response for unknown request ID: {}", request_id.0),
action: ErrorAction::IgnoreAndLog(Level::Info),
action: ErrorAction::IgnoreAndLog(Level::Debug),
});
}
};
Expand Down
16 changes: 8 additions & 8 deletions lightning-liquidity/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ where
lsps0_service_handler.handle_message(msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS0 request message without LSPS0 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS0 request message without LSPS0 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
},
Expand All @@ -510,7 +510,7 @@ where
lsps1_client_handler.handle_message(msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS1 response message without LSPS1 client handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS1 response message without LSPS1 client handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
},
Expand All @@ -521,19 +521,19 @@ where
lsps1_service_handler.handle_message(_msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS1 request message without LSPS1 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS1 request message without LSPS1 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
#[cfg(not(lsps1_service))]
return Err(LightningError { err: format!("Received LSPS1 request message without LSPS1 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS1 request message without LSPS1 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
LSPSMessage::LSPS2(msg @ LSPS2Message::Response(..)) => {
match &self.lsps2_client_handler {
Some(lsps2_client_handler) => {
lsps2_client_handler.handle_message(msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS2 response message without LSPS2 client handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS2 response message without LSPS2 client handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
},
Expand All @@ -543,7 +543,7 @@ where
lsps2_service_handler.handle_message(msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS2 request message without LSPS2 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS2 request message without LSPS2 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
},
Expand All @@ -553,7 +553,7 @@ where
lsps5_client_handler.handle_message(msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS5 response message without LSPS5 client handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS5 response message without LSPS5 client handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
},
Expand All @@ -563,7 +563,7 @@ where
lsps5_service_handler.handle_message(msg, sender_node_id)?;
},
None => {
return Err(LightningError { err: format!("Received LSPS5 request message without LSPS5 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
return Err(LightningError { err: format!("Received LSPS5 request message without LSPS5 service handler configured. From node = {:?}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
},
}
},
Expand Down
Loading