mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-07-30 03:41:28 +00:00
Update serialization versions
This commit is contained in:
@@ -390,7 +390,7 @@ pub struct WalletTx {
|
||||
|
||||
impl WalletTx {
|
||||
pub fn serialized_version() -> u64 {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
pub fn new(height: i32, txid: &TxId) -> Self {
|
||||
@@ -424,15 +424,9 @@ impl WalletTx {
|
||||
let total_transparent_value_spent = reader.read_u64::<LittleEndian>()?;
|
||||
|
||||
// Outgoing metadata was only added in version 2
|
||||
let outgoing_metadata = match version {
|
||||
1 => vec![],
|
||||
_ => Vector::read(&mut reader, |r| OutgoingTxMetadata::read(r))?
|
||||
};
|
||||
let outgoing_metadata = Vector::read(&mut reader, |r| OutgoingTxMetadata::read(r))?;
|
||||
|
||||
let full_tx_scanned = match version {
|
||||
1 => false,
|
||||
_ => reader.read_u8()? > 0,
|
||||
};
|
||||
let full_tx_scanned = reader.read_u8()? > 0;
|
||||
|
||||
Ok(WalletTx{
|
||||
block,
|
||||
|
@@ -130,7 +130,7 @@ pub struct LightWallet {
|
||||
|
||||
impl LightWallet {
|
||||
pub fn serialized_version() -> u64 {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
fn get_pk_from_bip39seed(config: LightClientConfig, bip39seed: &[u8]) ->
|
||||
@@ -232,21 +232,14 @@ impl LightWallet {
|
||||
})?;
|
||||
let txs = txs_tuples.into_iter().collect::<HashMap<TxId, WalletTx>>();
|
||||
|
||||
// chain_name was added in v2
|
||||
if version >= 2 {
|
||||
let chain_name = utils::read_string(&mut reader)?;
|
||||
let chain_name = utils::read_string(&mut reader)?;
|
||||
|
||||
if chain_name != config.chain_name {
|
||||
return Err(Error::new(ErrorKind::InvalidData,
|
||||
format!("Wallet chain name {} doesn't match expected {}", chain_name, config.chain_name)));
|
||||
}
|
||||
if chain_name != config.chain_name {
|
||||
return Err(Error::new(ErrorKind::InvalidData,
|
||||
format!("Wallet chain name {} doesn't match expected {}", chain_name, config.chain_name)));
|
||||
}
|
||||
|
||||
let birthday = if version >= 2 {
|
||||
reader.read_u64::<LittleEndian>()?
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let birthday = reader.read_u64::<LittleEndian>()?;
|
||||
|
||||
Ok(LightWallet{
|
||||
seed: seed_bytes,
|
||||
|
Reference in New Issue
Block a user