add check for wallet version

This commit is contained in:
lucretius
2024-01-20 15:43:43 +01:00
parent f97cd7d041
commit 8076ee1426

View File

@@ -484,11 +484,11 @@ impl WalletTx {
// Outgoing metadata was only added in version 2
let outgoing_metadata = Vector::read(&mut reader, |r| OutgoingTxMetadata::read(r))?;
let incoming_metadata = Vector::read(&mut reader, |r| IncomingTxMetadata::read(r))?;
//let incoming_metadata = Vector::read(&mut reader, |r| IncomingTxMetadata::read(r))?;
let full_tx_scanned = reader.read_u8()? > 0;
Ok(WalletTx{
let mut wallet_tx = WalletTx {
block,
datetime,
txid,
@@ -497,9 +497,15 @@ impl WalletTx {
total_shielded_value_spent,
total_transparent_value_spent,
outgoing_metadata,
incoming_metadata,
incoming_metadata: vec![],
full_tx_scanned
})
};
if version >= 5 {
wallet_tx.incoming_metadata = Vector::read(&mut reader, |r| IncomingTxMetadata::read(r))?;
}
Ok(wallet_tx)
}
pub fn write<W: Write>(&self, mut writer: W) -> io::Result<()> {