Skip to content

Commit 6112567

Browse files
committed
fixup! Account for Bolt11InvoiceDescription.
1 parent 6948265 commit 6112567

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ldk-server/src/util/proto_adapter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use ldk_server_protos::types::pending_sweep_balance::BalanceType::{
2323
use ldk_server_protos::types::{
2424
bolt11_invoice_description, Channel, ForwardedPayment, LspFeeLimits, OutPoint, Payment,
2525
};
26-
use std::str::FromStr;
2726

2827
pub(crate) fn channel_to_proto(channel: ChannelDetails) -> Channel {
2928
Channel {
@@ -385,7 +384,8 @@ pub(crate) fn proto_to_bolt11_description(
385384
Bolt11InvoiceDescription::Direct(Description::new(s).unwrap())
386385
},
387386
Some(bolt11_invoice_description::Kind::Hash(h)) => {
388-
Bolt11InvoiceDescription::Hash(Sha256(sha256::Hash::from_str(&h).unwrap()))
387+
let hash_bytes = <[u8; 32]>::from_hex(&h).map_err(|_| NodeError::InvalidInvoice)?;
388+
Bolt11InvoiceDescription::Hash(Sha256(*sha256::Hash::from_bytes_ref(&hash_bytes)))
389389
},
390390
None => Bolt11InvoiceDescription::Direct(Description::new("".to_string()).unwrap()),
391391
})

0 commit comments

Comments
 (0)