-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::util::proto_adapter::payment_to_proto; | ||
use hex::FromHex; | ||
use ldk_node::lightning::ln::channelmanager::PaymentId; | ||
use ldk_node::Node; | ||
use protos::{GetPaymentDetailsRequest, GetPaymentDetailsResponse}; | ||
use std::sync::Arc; | ||
|
||
pub(crate) const GET_PAYMENT_DETAILS_PATH: &str = "GetPaymentDetails"; | ||
|
||
pub(crate) fn handle_get_payment_details_request( | ||
node: Arc<Node>, request: GetPaymentDetailsRequest, | ||
) -> Result<GetPaymentDetailsResponse, ldk_node::NodeError> { | ||
let payment_id_bytes = <[u8; PaymentId::LENGTH]>::from_hex(&request.payment_id) | ||
.map_err(|_| ldk_node::NodeError::InvalidPaymentId)?; | ||
|
||
let payment_details = node.payment(&PaymentId(payment_id_bytes)); | ||
|
||
let response = GetPaymentDetailsResponse { | ||
payment: payment_details.map(|payment| payment_to_proto(payment)), | ||
}; | ||
|
||
Ok(response) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters