mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
monero fixes (#1581)
Some checks are pending
Cache Dependencies / test (push) Waiting to run
Some checks are pending
Cache Dependencies / test (push) Waiting to run
* correct comparision while syncing * fix issue from report 25916.txt * return proper address even if numSubaddresses returned 0
This commit is contained in:
parent
e58d87e94c
commit
96e4a4eb6c
5 changed files with 13 additions and 5 deletions
|
@ -42,12 +42,16 @@ class Subaddress {
|
||||||
|
|
||||||
List<Subaddress> getAllSubaddresses() {
|
List<Subaddress> getAllSubaddresses() {
|
||||||
final size = monero.Wallet_numSubaddresses(wptr!, accountIndex: subaddress!.accountIndex);
|
final size = monero.Wallet_numSubaddresses(wptr!, accountIndex: subaddress!.accountIndex);
|
||||||
return List.generate(size, (index) {
|
final list = List.generate(size, (index) {
|
||||||
return Subaddress(
|
return Subaddress(
|
||||||
accountIndex: subaddress!.accountIndex,
|
accountIndex: subaddress!.accountIndex,
|
||||||
addressIndex: index,
|
addressIndex: index,
|
||||||
);
|
);
|
||||||
}).reversed.toList();
|
}).reversed.toList();
|
||||||
|
if (list.length == 0) {
|
||||||
|
list.add(Subaddress(addressIndex: subaddress!.accountIndex, accountIndex: 0));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSubaddressSync({required int accountIndex, required String label}) {
|
void addSubaddressSync({required int accountIndex, required String label}) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ void storeSync() async {
|
||||||
return monero.Wallet_synchronized(Pointer.fromAddress(addr));
|
return monero.Wallet_synchronized(Pointer.fromAddress(addr));
|
||||||
});
|
});
|
||||||
if (lastStorePointer == wptr!.address &&
|
if (lastStorePointer == wptr!.address &&
|
||||||
lastStoreHeight + 5000 < monero.Wallet_blockChainHeight(wptr!) &&
|
lastStoreHeight + 5000 > monero.Wallet_blockChainHeight(wptr!) &&
|
||||||
!synchronized) {
|
!synchronized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
|
||||||
accountIndex: accountIndex,
|
accountIndex: accountIndex,
|
||||||
defaultLabel: defaultLabel,
|
defaultLabel: defaultLabel,
|
||||||
usedAddresses: usedAddresses.toList());
|
usedAddresses: usedAddresses.toList());
|
||||||
subaddress = subaddressList.subaddresses.last;
|
subaddress = (subaddressList.subaddresses.isEmpty) ? Subaddress(id: 0, address: address, label: defaultLabel) : subaddressList.subaddresses.last;
|
||||||
address = subaddress!.address;
|
address = subaddress!.address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,16 @@ class Subaddress {
|
||||||
|
|
||||||
List<Subaddress> getAllSubaddresses() {
|
List<Subaddress> getAllSubaddresses() {
|
||||||
final size = wownero.Wallet_numSubaddresses(wptr!, accountIndex: subaddress!.accountIndex);
|
final size = wownero.Wallet_numSubaddresses(wptr!, accountIndex: subaddress!.accountIndex);
|
||||||
return List.generate(size, (index) {
|
final list = List.generate(size, (index) {
|
||||||
return Subaddress(
|
return Subaddress(
|
||||||
accountIndex: subaddress!.accountIndex,
|
accountIndex: subaddress!.accountIndex,
|
||||||
addressIndex: index,
|
addressIndex: index,
|
||||||
);
|
);
|
||||||
}).reversed.toList();
|
}).reversed.toList();
|
||||||
|
if (list.isEmpty) {
|
||||||
|
list.add(Subaddress(addressIndex: 0, accountIndex: subaddress!.accountIndex));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSubaddressSync({required int accountIndex, required String label}) {
|
void addSubaddressSync({required int accountIndex, required String label}) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
|
||||||
accountIndex: accountIndex,
|
accountIndex: accountIndex,
|
||||||
defaultLabel: defaultLabel,
|
defaultLabel: defaultLabel,
|
||||||
usedAddresses: usedAddresses.toList());
|
usedAddresses: usedAddresses.toList());
|
||||||
subaddress = subaddressList.subaddresses.last;
|
subaddress = (subaddressList.subaddresses.isEmpty) ? Subaddress(id: 0, address: address, label: defaultLabel) : subaddressList.subaddresses.last;
|
||||||
address = subaddress!.address;
|
address = subaddress!.address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue