Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MutinyWallet/mutiny-node
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 828783b6953723f879447d68c8cbc70b4aa47020
Choose a base ref
..
head repository: MutinyWallet/mutiny-node
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3bb5939547fd84170b53f391ab3fc37efdaef807
Choose a head ref
89 changes: 53 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023 Mutiny Wallet Inc.
Copyright (c) 2022-2024 Mutiny Wallet Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
16 changes: 8 additions & 8 deletions mutiny-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ cargo-features = ["per-package-target"]

[package]
name = "mutiny-core"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
authors = ["Tony Giorgio <tony@mutinywallet.com>", "benthecarman <ben@mutinywallet.com>"]
description = "The core SDK for the mutiny node"
@@ -52,13 +52,13 @@ bincode = "1.3.3"
hex = "0.4.3"
async-lock = "3.2.0"

fedimint-client = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-core = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-wallet-client = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-mint-client = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-ln-client = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-bip39 = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-ln-common = { git = "https://github.com/fedimint/fedimint.git", rev = "51d09c76b8a15615114d4f2c2663c738d8ff3135" }
fedimint-client = "0.2.1"
fedimint-core = "0.2.1"
fedimint-wallet-client = "0.2.1"
fedimint-mint-client = "0.2.1"
fedimint-ln-client = "0.2.1"
fedimint-bip39 = "0.2.1"
fedimint-ln-common = "0.2.1"

base64 = "0.13.0"
pbkdf2 = "0.11"
21 changes: 14 additions & 7 deletions mutiny-core/src/federation.rs
Original file line number Diff line number Diff line change
@@ -412,12 +412,6 @@ impl FederationClient {
invoice: Bolt11Invoice,
labels: Vec<String>,
) -> Result<MutinyInvoice, MutinyError> {
// Save before sending
let mut stored_payment: MutinyInvoice = invoice.clone().into();
stored_payment.inbound = false;
stored_payment.labels = labels;
self.g.save_payment(stored_payment.clone()).await?;

let lightning_module = self
.fedimint_client
.get_first_module::<LightningClientModule>();
@@ -426,6 +420,12 @@ impl FederationClient {
.pay_bolt11_invoice(invoice.clone(), ())
.await?;

// Save after payment was initiated successfully
let mut stored_payment: MutinyInvoice = invoice.clone().into();
stored_payment.inbound = false;
stored_payment.labels = labels;
self.g.save_payment(stored_payment.clone()).await?;

// Subscribe and process outcome based on payment type
let inv = match outgoing_payment.payment_type {
fedimint_ln_client::PayType::Internal(pay_id) => {
@@ -629,15 +629,18 @@ where
let timeout_future = sleep(timeout as i32);
pin_mut!(timeout_future);

log_trace!(logger, "start timeout stream futures");
while let future::Either::Left((outcome_option, _)) =
future::select(s.next(), &mut timeout_future).await
{
if let Some(outcome) = outcome_option {
log_trace!(logger, "Streamed Outcome received: {:?}", outcome);
let (status, preimage) = process_fn(outcome);
invoice.status = status;
invoice.preimage = preimage;

if matches!(invoice.status, HTLCStatus::Succeeded | HTLCStatus::Failed) {
log_trace!(logger, "Streamed Outcome final, returning");
break;
}
} else {
@@ -649,6 +652,11 @@ where
break;
}
}
log_trace!(
logger,
"Done with stream outcome, status: {}",
invoice.status
);
}
}

@@ -679,7 +687,6 @@ fn fedimint_seed_generation() {
#[cfg(test)]
fn fedimint_mnemonic_generation() {
use super::*;
use std::str::FromStr;

let mnemonic_str = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
let root_mnemonic = Mnemonic::from_str(mnemonic_str).expect("could not generate");
6 changes: 5 additions & 1 deletion mutiny-core/src/keymanager.rs
Original file line number Diff line number Diff line change
@@ -68,7 +68,11 @@ impl<S: MutinyStorage> PhantomKeysManager<S> {
) -> Result<Transaction, ()> {
let address = {
let mut wallet = self.wallet.wallet.try_write().map_err(|_| ())?;
wallet.get_internal_address(AddressIndex::New).address
// These often fail because we continually retry these. Use LastUnused so we don't generate a ton of new
// addresses for no reason.
wallet
.get_internal_address(AddressIndex::LastUnused)
.address
};

let result = self.inner.spend_spendable_outputs(
Loading