mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
paynym receiving address scanning fix
This commit is contained in:
parent
68be62e3ef
commit
b64ffe91b7
1 changed files with 31 additions and 2 deletions
|
@ -162,7 +162,21 @@ mixin PaynymWalletInterface {
|
||||||
|
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
final generatedAddress = await _generatePaynymReceivingAddress(sender, 0);
|
final generatedAddress = await _generatePaynymReceivingAddress(sender, 0);
|
||||||
await _db.putAddress(generatedAddress);
|
|
||||||
|
final existing = await _db
|
||||||
|
.getAddresses(_walletId)
|
||||||
|
.filter()
|
||||||
|
.valueEqualTo(generatedAddress.value)
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (existing == null) {
|
||||||
|
// Add that new address
|
||||||
|
await _db.putAddress(generatedAddress);
|
||||||
|
} else {
|
||||||
|
// we need to update the address
|
||||||
|
await _db.updateAddress(existing, generatedAddress);
|
||||||
|
}
|
||||||
|
|
||||||
return currentReceivingPaynymAddress(sender);
|
return currentReceivingPaynymAddress(sender);
|
||||||
} else {
|
} else {
|
||||||
return address;
|
return address;
|
||||||
|
@ -203,7 +217,22 @@ mixin PaynymWalletInterface {
|
||||||
sender,
|
sender,
|
||||||
address.derivationIndex + 1,
|
address.derivationIndex + 1,
|
||||||
);
|
);
|
||||||
await _db.putAddress(nextAddress);
|
|
||||||
|
final existing = await _db
|
||||||
|
.getAddresses(_walletId)
|
||||||
|
.filter()
|
||||||
|
.valueEqualTo(nextAddress.value)
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (existing == null) {
|
||||||
|
// Add that new address
|
||||||
|
await _db.putAddress(nextAddress);
|
||||||
|
} else {
|
||||||
|
// we need to update the address
|
||||||
|
await _db.updateAddress(existing, nextAddress);
|
||||||
|
}
|
||||||
|
// keep checking until address with no tx history is set as current
|
||||||
|
await checkCurrentPaynymReceivingAddressForTransactions(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue