Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CW-826 Fix missing tx keys in monero #1828

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions cw_monero/lib/api/transaction_history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -357,16 +357,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,
Expand Down
5 changes: 3 additions & 2 deletions cw_monero/lib/api/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions cw_monero/lib/pending_monero_transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -53,6 +54,7 @@ class PendingMoneroTransaction with PendingTransaction {

rethrow;
}
storeSync(force: true);
}

@override
Expand Down
Loading