mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
payment code lookup fix
This commit is contained in:
parent
ce5586d675
commit
aec33094d6
1 changed files with 8 additions and 11 deletions
|
@ -148,15 +148,13 @@ mixin PaynymWalletInterface {
|
|||
btc_dart.NetworkType get networkType => _network;
|
||||
|
||||
Future<Address> currentReceivingPaynymAddress(PaymentCode sender) async {
|
||||
final key = await lookupKey(sender.toString());
|
||||
final keys = await lookupKey(sender.toString());
|
||||
final address = await _db
|
||||
.getAddresses(_walletId)
|
||||
.filter()
|
||||
.subTypeEqualTo(AddressSubType.paynymReceive)
|
||||
.and()
|
||||
.otherDataEqualTo(key)
|
||||
.and()
|
||||
.otherDataIsNotNull()
|
||||
.anyOf<String, Address>(keys, (q, String e) => q.otherDataEqualTo(e))
|
||||
.sortByDerivationIndexDesc()
|
||||
.findFirst();
|
||||
|
||||
|
@ -331,15 +329,13 @@ mixin PaynymWalletInterface {
|
|||
const maxCount = 2147483647;
|
||||
|
||||
for (int i = startIndex; i < maxCount; i++) {
|
||||
final key = await lookupKey(pCode.toString());
|
||||
final keys = await lookupKey(pCode.toString());
|
||||
final address = await _db
|
||||
.getAddresses(_walletId)
|
||||
.filter()
|
||||
.subTypeEqualTo(AddressSubType.paynymSend)
|
||||
.and()
|
||||
.otherDataEqualTo(key)
|
||||
.and()
|
||||
.otherDataIsNotNull()
|
||||
.anyOf<String, Address>(keys, (q, String e) => q.otherDataEqualTo(e))
|
||||
.and()
|
||||
.derivationIndexEqualTo(i)
|
||||
.findFirst();
|
||||
|
@ -1215,16 +1211,17 @@ mixin PaynymWalletInterface {
|
|||
}
|
||||
|
||||
/// look up a key that corresponds to a payment code string
|
||||
Future<String?> lookupKey(String paymentCodeString) async {
|
||||
Future<List<String>> lookupKey(String paymentCodeString) async {
|
||||
final keys =
|
||||
(await _secureStorage.keys).where((e) => e.startsWith(kPCodeKeyPrefix));
|
||||
final List<String> result = [];
|
||||
for (final key in keys) {
|
||||
final value = await _secureStorage.read(key: key);
|
||||
if (value == paymentCodeString) {
|
||||
return key;
|
||||
result.add(key);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// fetch a payment code string
|
||||
|
|
Loading…
Reference in a new issue