diff --git a/cw_monero/lib/api/transaction_history.dart b/cw_monero/lib/api/transaction_history.dart index a00a6b206..662eb1bb5 100644 --- a/cw_monero/lib/api/transaction_history.dart +++ b/cw_monero/lib/api/transaction_history.dart @@ -17,7 +17,7 @@ String getTxKey(String txId) { final status = monero.Wallet_status(wptr!); if (status != 0) { final error = monero.Wallet_errorString(wptr!); - return txId+"_"+error; + return ""; } return txKey; } @@ -364,16 +364,7 @@ class Transaction { confirmations = monero.TransactionInfo_confirmations(txInfo), fee = monero.TransactionInfo_fee(txInfo), description = monero.TransactionInfo_description(txInfo), - key = getTxKey(txInfo); - - static String getTxKey(monero.TransactionInfo txInfo) { - final txKey = monero.Wallet_getTxKey(wptr!, txid: monero.TransactionInfo_hash(txInfo)); - final status = monero.Wallet_status(wptr!); - if (status != 0) { - return ""; - } - return txKey; - } + key = getTxKey(monero.TransactionInfo_hash(txInfo)); Transaction.dummy({ required this.displayLabel, diff --git a/cw_monero/lib/api/wallet.dart b/cw_monero/lib/api/wallet.dart index 928fd7ef1..70c610418 100644 --- a/cw_monero/lib/api/wallet.dart +++ b/cw_monero/lib/api/wallet.dart @@ -150,14 +150,15 @@ final storeMutex = Mutex(); int lastStorePointer = 0; int lastStoreHeight = 0; -void storeSync() async { +void storeSync({bool force = false}) async { final addr = wptr!.address; final synchronized = await Isolate.run(() { return monero.Wallet_synchronized(Pointer.fromAddress(addr)); }); if (lastStorePointer == wptr!.address && lastStoreHeight + 5000 > monero.Wallet_blockChainHeight(wptr!) && - !synchronized) { + !synchronized && + !force) { return; } lastStorePointer = wptr!.address; diff --git a/cw_monero/lib/pending_monero_transaction.dart b/cw_monero/lib/pending_monero_transaction.dart index eb714eeb3..1c01a60dc 100644 --- a/cw_monero/lib/pending_monero_transaction.dart +++ b/cw_monero/lib/pending_monero_transaction.dart @@ -6,6 +6,7 @@ import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/amount_converter.dart'; import 'package:cw_core/pending_transaction.dart'; +import 'package:cw_monero/api/wallet.dart'; class DoubleSpendException implements Exception { DoubleSpendException(); @@ -53,6 +54,7 @@ class PendingMoneroTransaction with PendingTransaction { rethrow; } + storeSync(force: true); } @override