Write vector tkeys
This commit is contained in:
@@ -39,11 +39,9 @@ use crate::grpc_client::{ChainSpec, BlockId, BlockRange, RawTransaction,
|
|||||||
use crate::grpc_client::client::CompactTxStreamer;
|
use crate::grpc_client::client::CompactTxStreamer;
|
||||||
use crate::SaplingParams;
|
use crate::SaplingParams;
|
||||||
|
|
||||||
// Used below to return the grpc "Client" type to calling methods
|
|
||||||
|
|
||||||
pub const DEFAULT_SERVER: &str = "https://lightd-main.zecwallet.co:443";
|
pub const DEFAULT_SERVER: &str = "https://lightd-main.zecwallet.co:443";
|
||||||
pub const WALLET_NAME: &str = "zeclite.wallet.dat";
|
pub const WALLET_NAME: &str = "zecwallet-light-wallet.dat";
|
||||||
pub const LOGFILE_NAME: &str = "zeclite.debug.log";
|
pub const LOGFILE_NAME: &str = "zecwallet-light-wallet.debug.log";
|
||||||
|
|
||||||
/// A Secure (https) grpc destination.
|
/// A Secure (https) grpc destination.
|
||||||
struct Dst {
|
struct Dst {
|
||||||
|
|||||||
@@ -216,9 +216,11 @@ impl LightWallet {
|
|||||||
let addresses = extfvks.iter().map( |fvk| fvk.default_address().unwrap().1 )
|
let addresses = extfvks.iter().map( |fvk| fvk.default_address().unwrap().1 )
|
||||||
.collect::<Vec<PaymentAddress<Bls12>>>();
|
.collect::<Vec<PaymentAddress<Bls12>>>();
|
||||||
|
|
||||||
let mut tpk_bytes = [0u8; 32];
|
let tkeys = Vector::read(&mut reader, |r| {
|
||||||
reader.read_exact(&mut tpk_bytes)?;
|
let mut tpk_bytes = [0u8; 32];
|
||||||
let tpk = secp256k1::SecretKey::from_slice(&tpk_bytes).unwrap();
|
r.read_exact(&mut tpk_bytes)?;
|
||||||
|
secp256k1::SecretKey::from_slice(&tpk_bytes).map_err(|e| io::Error::new(ErrorKind::InvalidData, e))
|
||||||
|
})?;
|
||||||
|
|
||||||
let blocks = Vector::read(&mut reader, |r| BlockData::read(r))?;
|
let blocks = Vector::read(&mut reader, |r| BlockData::read(r))?;
|
||||||
|
|
||||||
@@ -251,7 +253,7 @@ impl LightWallet {
|
|||||||
extsks,
|
extsks,
|
||||||
extfvks,
|
extfvks,
|
||||||
address: addresses,
|
address: addresses,
|
||||||
tkeys: vec![tpk],
|
tkeys: tkeys,
|
||||||
blocks: Arc::new(RwLock::new(blocks)),
|
blocks: Arc::new(RwLock::new(blocks)),
|
||||||
txs: Arc::new(RwLock::new(txs)),
|
txs: Arc::new(RwLock::new(txs)),
|
||||||
config: config.clone(),
|
config: config.clone(),
|
||||||
@@ -272,8 +274,9 @@ impl LightWallet {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Write the transparent private key
|
// Write the transparent private key
|
||||||
// TODO: This only writes the first key for now
|
Vector::write(&mut writer, &self.tkeys,
|
||||||
writer.write_all(&self.tkeys[0][..])?;
|
|w, pk| w.write_all(&pk[..])
|
||||||
|
)?;
|
||||||
|
|
||||||
Vector::write(&mut writer, &self.blocks.read().unwrap(), |w, b| b.write(w))?;
|
Vector::write(&mut writer, &self.blocks.read().unwrap(), |w, b| b.write(w))?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user