Skip to content

Commit

Permalink
Fix unexpected error with wallet power updates (#1994)
Browse files Browse the repository at this point in the history
Merge pull request #1994

Fix unexpected error with wallet power updates
  • Loading branch information
CjS77 committed Jun 15, 2020
2 parents 946068a + b244b81 commit dfef9d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions base_layer/wallet/src/transaction_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,9 +1228,13 @@ where
PowerMode::Low => self.config.low_power_polling_timeout,
PowerMode::Normal => self.config.base_node_monitoring_timeout,
};
self.timeout_update_publisher
.send(timeout)
.map_err(|_| TransactionServiceError::ProtocolChannelError)?;
if let Err(e) = self.timeout_update_publisher.send(timeout) {
trace!(
target: LOG_TARGET,
"Could not send Timeout update, no subscribers to receive. (Err {:?})",
e
);
}

Ok(())
}
Expand Down
3 changes: 3 additions & 0 deletions base_layer/wallet/tests/transaction_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,9 @@ fn transaction_base_node_monitoring() {
let (_, _, bob_outbound_service, mut bob_tx_sender, _, _, _, _) =
setup_transaction_service_no_comms(&mut runtime, factories.clone(), TransactionMemoryDatabase::new(), None);

runtime.block_on(alice_ts.set_low_power_mode()).unwrap();
runtime.block_on(alice_ts.set_normal_power_mode()).unwrap();

let mut alice_total_available = 250000 * uT;
let (_utxo, uo) = make_input(&mut OsRng, alice_total_available, &factories.commitment);
runtime.block_on(alice_output_manager.add_output(uo)).unwrap();
Expand Down

0 comments on commit dfef9d5

Please sign in to comment.