use explicit protocol version (local is not safe)

This commit is contained in:
antiochp
2019-09-26 08:33:33 +01:00
parent 061a058571
commit d89331a720
3 changed files with 6 additions and 8 deletions
+2 -3
View File
@@ -360,7 +360,7 @@ where
.join(filename);
let path_buf = Path::new(&path).to_path_buf();
let mut stored_tx = File::create(path_buf)?;
let tx_hex = util::to_hex(ser::ser_vec(tx, ser::ProtocolVersion::local()).unwrap());;
let tx_hex = util::to_hex(ser::ser_vec(tx, ser::ProtocolVersion(1)).unwrap());;
stored_tx.write_all(&tx_hex.as_bytes())?;
stored_tx.sync_all()?;
Ok(())
@@ -380,8 +380,7 @@ where
tx_f.read_to_string(&mut content)?;
let tx_bin = util::from_hex(content).unwrap();
Ok(Some(
ser::deserialize::<Transaction>(&mut &tx_bin[..], ser::ProtocolVersion::local())
.unwrap(),
ser::deserialize::<Transaction>(&mut &tx_bin[..], ser::ProtocolVersion(1)).unwrap(),
))
}
+3 -4
View File
@@ -185,10 +185,9 @@ where
libwallet::ErrorKind::ClientCallback("Error parsing TxWrapper: tx_bin".to_owned()),
)?;
let tx: Transaction = ser::deserialize(&mut &tx_bin[..], ser::ProtocolVersion::local())
.context(libwallet::ErrorKind::ClientCallback(
"Error parsing TxWrapper: tx".to_owned(),
))?;
let tx: Transaction = ser::deserialize(&mut &tx_bin[..], ser::ProtocolVersion(1)).context(
libwallet::ErrorKind::ClientCallback("Error parsing TxWrapper: tx".to_owned()),
)?;
super::award_block_to_wallet(
&self.chain,