mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
add replace tx logic for potentially unconfirmed transactions to update properly
This commit is contained in:
parent
c503e8f8d8
commit
7fc4b724c4
1 changed files with 7 additions and 0 deletions
|
@ -38,6 +38,13 @@ mixin WalletDB {
|
|||
for (final data in transactionsData) {
|
||||
final tx = data.item1;
|
||||
|
||||
final potentiallyUnconfirmedTx =
|
||||
await isar.transactions.where().txidEqualTo(tx.txid).findFirst();
|
||||
if (potentiallyUnconfirmedTx != null) {
|
||||
// update use id to replace tx
|
||||
tx.id = potentiallyUnconfirmedTx.id;
|
||||
await isar.transactions.delete(potentiallyUnconfirmedTx.id);
|
||||
}
|
||||
// save transaction
|
||||
await isar.transactions.put(tx);
|
||||
|
||||
|
|
Loading…
Reference in a new issue