Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wallet): special-case descriptor for single-guardian instances #3821

Merged
merged 2 commits into from Dec 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions modules/fedimint-wallet-common/src/config.rs
Expand Up @@ -7,7 +7,7 @@ use fedimint_core::encoding::{Decodable, Encodable};
use fedimint_core::module::__reexports::serde_json;
use fedimint_core::util::SafeUrl;
use fedimint_core::{plugin_types_trait_impl_config, Feerate, PeerId};
use miniscript::descriptor::Wsh;
use miniscript::descriptor::{Wpkh, Wsh};
use secp256k1::SecretKey;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -150,9 +150,21 @@ impl WalletConfig {
bitcoin_rpc: BitcoinRpcConfig,
client_default_bitcoin_rpc: BitcoinRpcConfig,
) -> Self {
let peg_in_descriptor = PegInDescriptor::Wsh(
Wsh::new_sortedmulti(threshold, pubkeys.values().copied().collect()).unwrap(),
);
let peg_in_descriptor = if pubkeys.len() == 1 {
PegInDescriptor::Wpkh(
Wpkh::new(
*pubkeys
.values()
.next()
.expect("there is exactly one pub key"),
)
.expect("Our key type is always compressed"),
)
} else {
PegInDescriptor::Wsh(
Wsh::new_sortedmulti(threshold, pubkeys.values().copied().collect()).unwrap(),
)
};

Self {
local: WalletConfigLocal { bitcoin_rpc },
Expand Down