From 5c13deb3baf80f9e0a599a060acef44863895e3d Mon Sep 17 00:00:00 2001 From: Mike the Tike Date: Tue, 1 Jun 2021 20:03:55 +0200 Subject: [PATCH] Update console wallet on one sided payment import --- .../src/ui/state/wallet_event_monitor.rs | 2 +- base_layer/core/src/blocks/genesis_block.rs | 2 +- base_layer/wallet/src/transaction_service/handle.rs | 1 + base_layer/wallet/src/transaction_service/service.rs | 11 +++++++++++ common/config/presets/tari_config_example.toml | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs b/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs index 74ac86f959..fb0a66b466 100644 --- a/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs +++ b/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs @@ -86,7 +86,7 @@ impl WalletEventMonitor { TransactionEvent::ReceivedTransaction(tx_id) | TransactionEvent::ReceivedTransactionReply(tx_id) | TransactionEvent::TransactionBroadcast(tx_id) | - TransactionEvent::TransactionMinedRequestTimedOut(tx_id) => { + TransactionEvent::TransactionMinedRequestTimedOut(tx_id) | TransactionEvent::TransactionImported(tx_id) => { self.trigger_tx_state_refresh(tx_id).await; }, TransactionEvent::TransactionDirectSendResult(tx_id, true) | diff --git a/base_layer/core/src/blocks/genesis_block.rs b/base_layer/core/src/blocks/genesis_block.rs index 0128098637..0ddbef114e 100644 --- a/base_layer/core/src/blocks/genesis_block.rs +++ b/base_layer/core/src/blocks/genesis_block.rs @@ -230,7 +230,7 @@ pub fn get_weatherwax_genesis_block_raw() -> Block { prev_hash: vec![ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], - timestamp: 1_620_120_256.into(), // 04/05/2021 @ 09:24:16 (UTC) + timestamp: 1_622_550_256.into(), output_mr: from_hex("dcc44f39b65e5e1e526887e7d56f7b85e2ea44bd29bc5bc195e6e015d19e1c06").unwrap(), range_proof_mr: from_hex("e4d7dab49a66358379a901b9a36c10f070aa9d7bdc8ae752947b6fc4e55d255f").unwrap(), output_mmr_size: 1, diff --git a/base_layer/wallet/src/transaction_service/handle.rs b/base_layer/wallet/src/transaction_service/handle.rs index 3c043ec2f7..c21f46a76a 100644 --- a/base_layer/wallet/src/transaction_service/handle.rs +++ b/base_layer/wallet/src/transaction_service/handle.rs @@ -183,6 +183,7 @@ pub enum TransactionEvent { TransactionStoreForwardSendResult(TxId, bool), TransactionCancelled(TxId), TransactionBroadcast(TxId), + TransactionImported(TxId), TransactionMined(TxId), TransactionMinedRequestTimedOut(TxId), TransactionMinedUnconfirmed(TxId, u64), diff --git a/base_layer/wallet/src/transaction_service/service.rs b/base_layer/wallet/src/transaction_service/service.rs index 8d1fe67007..b1b3eb377a 100644 --- a/base_layer/wallet/src/transaction_service/service.rs +++ b/base_layer/wallet/src/transaction_service/service.rs @@ -1663,6 +1663,17 @@ where maturity, ) .await?; + let _ = self + .event_publisher + .send(Arc::new(TransactionEvent::TransactionImported(tx_id))) + .map_err(|e| { + trace!( + target: LOG_TARGET, + "Error sending event, usually because there are no subscribers: {:?}", + e + ); + e + }); Ok(tx_id) } diff --git a/common/config/presets/tari_config_example.toml b/common/config/presets/tari_config_example.toml index d7ee0dc5f4..dcc94e9f84 100644 --- a/common/config/presets/tari_config_example.toml +++ b/common/config/presets/tari_config_example.toml @@ -119,6 +119,8 @@ base_node_query_timeout = 120 # (options: "DirectOnly", "StoreAndForwardOnly", DirectAndStoreAndForward". default: "DirectAndStoreAndForward"). #transaction_routing_mechanism = "DirectAndStoreAndForward" +scan_for_utxo_interval=60 + # When running the console wallet in command mode, use these values to determine what "stage" and timeout to wait # for sent transactions. # The stages are: