mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-25 15:39:25 -05:00
Add context if we fail to compute extended private key
This commit is contained in:
parent
1aa6d177bf
commit
c826a28911
@ -1,7 +1,7 @@
|
|||||||
use crate::fs::ensure_directory_exists;
|
use crate::fs::ensure_directory_exists;
|
||||||
use ::bitcoin::secp256k1::constants::SECRET_KEY_SIZE;
|
use ::bitcoin::secp256k1::constants::SECRET_KEY_SIZE;
|
||||||
use ::bitcoin::secp256k1::{self, SecretKey};
|
use ::bitcoin::secp256k1::{self, SecretKey};
|
||||||
use anyhow::Result;
|
use anyhow::{Context, Result};
|
||||||
use bdk::bitcoin::util::bip32::ExtendedPrivKey;
|
use bdk::bitcoin::util::bip32::ExtendedPrivKey;
|
||||||
use bitcoin::hashes::{sha256, Hash, HashEngine};
|
use bitcoin::hashes::{sha256, Hash, HashEngine};
|
||||||
use libp2p::identity;
|
use libp2p::identity;
|
||||||
@ -34,7 +34,8 @@ impl Seed {
|
|||||||
network: bitcoin::Network,
|
network: bitcoin::Network,
|
||||||
) -> Result<ExtendedPrivKey> {
|
) -> Result<ExtendedPrivKey> {
|
||||||
let seed = self.derive(b"BITCOIN_EXTENDED_PRIVATE_KEY").bytes();
|
let seed = self.derive(b"BITCOIN_EXTENDED_PRIVATE_KEY").bytes();
|
||||||
let private_key = ExtendedPrivKey::new_master(network, &seed)?;
|
let private_key = ExtendedPrivKey::new_master(network, &seed)
|
||||||
|
.context("Failed to create new master extended private key")?;
|
||||||
|
|
||||||
Ok(private_key)
|
Ok(private_key)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user