Remove dependency on zcash-multisig
This commit is contained in:
parent
ccb25c61f9
commit
1ddd34017e
|
@ -63,10 +63,6 @@ bech32 = "0.8.1"
|
|||
rand_chacha = "0.3.1"
|
||||
blake2b_simd = "0.5.11"
|
||||
|
||||
[dependencies.zcash_multisig]
|
||||
git = "https://github.com/hhanh00/zcash-multisig.git"
|
||||
rev = "ce5baab5a25021950f51a9d53dc6c39ea9fe2997"
|
||||
|
||||
# librustzcash synced to 35023ed8ca2fb1061e78fd740b640d4eefcc5edd
|
||||
|
||||
[dependencies.zcash_client_backend]
|
||||
|
|
|
@ -32,7 +32,6 @@ use zcash_primitives::memo::Memo;
|
|||
use zcash_primitives::transaction::builder::Progress;
|
||||
use zcash_primitives::transaction::components::Amount;
|
||||
use zcash_proofs::prover::LocalTxProver;
|
||||
use zcash_multisig::{SecretShare, split_account};
|
||||
use zcash_params::coin::TICKER;
|
||||
|
||||
const DEFAULT_CHUNK_SIZE: u32 = 100_000;
|
||||
|
@ -136,6 +135,11 @@ impl Wallet {
|
|||
Ok(ivk)
|
||||
}
|
||||
|
||||
pub fn get_sk(&self, account: u32) -> anyhow::Result<String> {
|
||||
let sk = self.db.get_sk(account)?;
|
||||
Ok(sk)
|
||||
}
|
||||
|
||||
pub fn new_account_with_key(&self, name: &str, key: &str) -> anyhow::Result<i32> {
|
||||
let (seed, sk, ivk, pa) = decode_key(key)?;
|
||||
let account = self
|
||||
|
@ -531,14 +535,13 @@ impl Wallet {
|
|||
Ok(payment_json)
|
||||
}
|
||||
|
||||
pub fn store_share_secret(&self, account: u32, secret: &str) -> anyhow::Result<()> {
|
||||
let share = SecretShare::decode(secret)?;
|
||||
pub fn store_share_secret(&self, account: u32, secret: &str, index: usize, threshold: usize, participants: usize) -> anyhow::Result<()> {
|
||||
self.db.store_share_secret(
|
||||
account,
|
||||
secret,
|
||||
share.index,
|
||||
share.threshold,
|
||||
share.participants,
|
||||
index,
|
||||
threshold,
|
||||
participants,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -546,19 +549,6 @@ impl Wallet {
|
|||
self.db.get_share_secret(account)
|
||||
}
|
||||
|
||||
pub fn split_account(&self, t: usize, n: usize, account: u32) -> anyhow::Result<String> {
|
||||
let sk = self.db.get_sk(account)?;
|
||||
let esk = decode_extended_spending_key(NETWORK.hrp_sapling_extended_spending_key(), &sk)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let secret_key = esk.expsk.ask;
|
||||
let nsk = esk.expsk.nsk;
|
||||
let shares = split_account(t, n, secret_key, nsk)?;
|
||||
let shares: Vec<_> = shares.iter().map(|s| s.encode().unwrap()).collect();
|
||||
let res = shares.join("|");
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
pub fn parse_recipients(recipients: &str) -> anyhow::Result<Vec<RecipientMemo>> {
|
||||
let recipients: Vec<Recipient> = serde_json::from_str(recipients)?;
|
||||
let recipient_memos: Vec<_> = recipients.iter().map(|r| RecipientMemo::from(r)).collect();
|
||||
|
|
Loading…
Reference in New Issue