-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
From 1286d8b67484dd976997cccd726d4ea9318a6ecd Mon Sep 17 00:00:00 2001 | ||
From: Czarek Nakamoto <[email protected]> | ||
Date: Tue, 2 Apr 2024 11:56:09 +0200 | ||
Subject: [PATCH] FIX: wallet listener crashing | ||
|
||
--- | ||
src/wallet/api/wallet.cpp | 21 +++++++++++++++------ | ||
1 file changed, 15 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp | ||
index 3bbc60d74..b42289842 100644 | ||
--- a/src/wallet/api/wallet.cpp | ||
+++ b/src/wallet/api/wallet.cpp | ||
@@ -201,8 +201,11 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback | ||
<< ", burnt: " << print_money(burnt) | ||
<< ", raw_output_value: " << print_money(amount) | ||
<< ", idx: " << subaddr_index); | ||
- m_listener->moneyReceived(tx_hash, amount); | ||
- m_listener->updated(); | ||
+ // do not signal on sent tx if wallet is not syncronized completely | ||
+ if (m_listener && m_wallet->synchronized()) { | ||
+ m_listener->moneyReceived(tx_hash, amount); | ||
+ m_listener->updated(); | ||
+ } | ||
} | ||
|
||
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) | ||
@@ -214,8 +217,11 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback | ||
<< ", tx: " << tx_hash | ||
<< ", amount: " << print_money(amount) | ||
<< ", idx: " << subaddr_index); | ||
- m_listener->unconfirmedMoneyReceived(tx_hash, amount); | ||
- m_listener->updated(); | ||
+ // do not signal on sent tx if wallet is not syncronized completely | ||
+ if (m_listener && m_wallet->synchronized()) { | ||
+ m_listener->unconfirmedMoneyReceived(tx_hash, amount); | ||
+ m_listener->updated(); | ||
+ } | ||
} | ||
|
||
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, | ||
@@ -227,8 +233,11 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback | ||
<< ", tx: " << tx_hash | ||
<< ", amount: " << print_money(amount) | ||
<< ", idx: " << subaddr_index); | ||
- m_listener->moneySpent(tx_hash, amount); | ||
- m_listener->updated(); | ||
+ // do not signal on sent tx if wallet is not syncronized completely | ||
+ if (m_listener && m_wallet->synchronized()) { | ||
+ m_listener->moneySpent(tx_hash, amount); | ||
+ m_listener->updated(); | ||
+ } | ||
} | ||
|
||
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx) | ||
-- | ||
2.44.0 | ||
|