Skip to content

Commit

Permalink
Merge pull request #500 from MutinyWallet/label-invoices
Browse files Browse the repository at this point in the history
Label paid invoices
  • Loading branch information
TonyGiorgio authored May 11, 2023
2 parents c986237 + 7a2e35d commit 7d4102e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mutiny-core/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ impl Node {
&self,
invoice: &Invoice,
amt_sats: Option<u64>,
labels: Vec<String>,
) -> Result<PaymentHash, MutinyError> {
let (pay_result, amt_msat) = if invoice.amount_milli_satoshis().is_none() {
if amt_sats.is_none() {
Expand All @@ -795,6 +796,14 @@ impl Node {
)
};

if let Err(e) = self
.persister
.storage
.set_invoice_labels(invoice.clone(), labels)
{
log_error!(self.logger, "could not set invoice label: {e}");
}

let last_update = utils::now().as_secs();
let mut payment_info = PaymentInfo {
preimage: None,
Expand Down Expand Up @@ -872,7 +881,7 @@ impl Node {
labels: Vec<String>,
) -> Result<MutinyInvoice, MutinyError> {
// initiate payment
let payment_hash = self.init_invoice_payment(invoice, amt_sats)?;
let payment_hash = self.init_invoice_payment(invoice, amt_sats, labels.clone())?;
let timeout: u64 = timeout_secs.unwrap_or(DEFAULT_PAYMENT_TIMEOUT);

self.await_payment(payment_hash, timeout, labels).await
Expand Down

0 comments on commit 7d4102e

Please sign in to comment.