separate tx note from transaction object to ensure total separation of blockchain data from other user to ease rescanning the blockchain

This commit is contained in:
julian 2023-01-13 13:33:46 -06:00
parent 94e6ebf53b
commit cb382e213f
3 changed files with 3 additions and 14 deletions

View file

@ -48,9 +48,6 @@ class Transaction {
final outputs = IsarLinks<Output>();
@Backlink(to: "transaction")
final note = IsarLink<TransactionNote>();
int getConfirmations(int currentChainHeight) {
if (height == null) return 0;
return max(0, currentChainHeight - height!);

View file

@ -7,7 +7,8 @@ part 'transaction_note.g.dart';
class TransactionNote {
Id id = Isar.autoIncrement;
late String value;
@Index(unique: true)
late String txid;
final transaction = IsarLink<Transaction>();
late String value;
}

View file

@ -2085,14 +2085,6 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
for (final data in txnsData) {
final tx = data.item1;
final prevTx =
await isar.transactions.where().txidEqualTo(tx.txid).findFirst();
if (prevTx != null) {
tx.note.value = prevTx.note.value;
await isar.transactions.delete(prevTx.id);
}
// save transaction
await isar.transactions.put(tx);
@ -2111,7 +2103,6 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await tx.address.save();
await tx.note.save();
}
});
}