Grab sync lock when sending to prevent anchor changes ported from 5a885adc15

This commit is contained in:
DenioD
2020-07-30 11:30:19 +02:00
parent e6ad8d9617
commit 21e7e20d6c
2 changed files with 18 additions and 7 deletions

View File

@@ -1277,11 +1277,15 @@ impl LightClient {
info!("Creating transaction");
let rawtx = self.wallet.write().unwrap().send_to_address(
u32::from_str_radix(&self.config.consensus_branch_id, 16).unwrap(),
&self.sapling_spend, &self.sapling_output,
addrs
);
let rawtx = {
let _lock = self.sync_lock.lock().unwrap();
self.wallet.write().unwrap().send_to_address(
u32::from_str_radix(&self.config.consensus_branch_id, 16).unwrap(),
&self.sapling_spend, &self.sapling_output,
addrs
)
};
match rawtx {
Ok(txbytes) => broadcast_raw_tx(&self.get_server_uri(), self.config.no_cert_verification, txbytes),