mirror of
https://github.com/mimblewimble/grin-wallet.git
synced 2025-02-01 08:51:09 +03:00
Merge pull request #225 from antiochp/explicit_wallet_proto_version
use explicit protocol version (local is not safe)
This commit is contained in:
commit
291bc2e2f4
3 changed files with 6 additions and 8 deletions
|
@ -360,7 +360,7 @@ where
|
||||||
.join(filename);
|
.join(filename);
|
||||||
let path_buf = Path::new(&path).to_path_buf();
|
let path_buf = Path::new(&path).to_path_buf();
|
||||||
let mut stored_tx = File::create(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.write_all(&tx_hex.as_bytes())?;
|
||||||
stored_tx.sync_all()?;
|
stored_tx.sync_all()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -380,8 +380,7 @@ where
|
||||||
tx_f.read_to_string(&mut content)?;
|
tx_f.read_to_string(&mut content)?;
|
||||||
let tx_bin = util::from_hex(content).unwrap();
|
let tx_bin = util::from_hex(content).unwrap();
|
||||||
Ok(Some(
|
Ok(Some(
|
||||||
ser::deserialize::<Transaction>(&mut &tx_bin[..], ser::ProtocolVersion::local())
|
ser::deserialize::<Transaction>(&mut &tx_bin[..], ser::ProtocolVersion(1)).unwrap(),
|
||||||
.unwrap(),
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,10 +185,9 @@ where
|
||||||
libwallet::ErrorKind::ClientCallback("Error parsing TxWrapper: tx_bin".to_owned()),
|
libwallet::ErrorKind::ClientCallback("Error parsing TxWrapper: tx_bin".to_owned()),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let tx: Transaction = ser::deserialize(&mut &tx_bin[..], ser::ProtocolVersion::local())
|
let tx: Transaction = ser::deserialize(&mut &tx_bin[..], ser::ProtocolVersion(1)).context(
|
||||||
.context(libwallet::ErrorKind::ClientCallback(
|
libwallet::ErrorKind::ClientCallback("Error parsing TxWrapper: tx".to_owned()),
|
||||||
"Error parsing TxWrapper: tx".to_owned(),
|
)?;
|
||||||
))?;
|
|
||||||
|
|
||||||
super::award_block_to_wallet(
|
super::award_block_to_wallet(
|
||||||
&self.chain,
|
&self.chain,
|
||||||
|
|
|
@ -448,7 +448,7 @@ pub fn post_tx<'a, C>(client: &C, tx: &Transaction, fluff: bool) -> Result<(), E
|
||||||
where
|
where
|
||||||
C: NodeClient + 'a,
|
C: NodeClient + 'a,
|
||||||
{
|
{
|
||||||
let tx_hex = grin_util::to_hex(ser::ser_vec(tx, ser::ProtocolVersion::local()).unwrap());
|
let tx_hex = grin_util::to_hex(ser::ser_vec(tx, ser::ProtocolVersion(1)).unwrap());
|
||||||
let res = client.post_tx(&TxWrapper { tx_hex: tx_hex }, fluff);
|
let res = client.post_tx(&TxWrapper { tx_hex: tx_hex }, fluff);
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
error!("api: post_tx: failed with error: {}", e);
|
error!("api: post_tx: failed with error: {}", e);
|
||||||
|
|
Loading…
Reference in a new issue