mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
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:
parent
94e6ebf53b
commit
cb382e213f
3 changed files with 3 additions and 14 deletions
|
@ -48,9 +48,6 @@ class Transaction {
|
||||||
|
|
||||||
final outputs = IsarLinks<Output>();
|
final outputs = IsarLinks<Output>();
|
||||||
|
|
||||||
@Backlink(to: "transaction")
|
|
||||||
final note = IsarLink<TransactionNote>();
|
|
||||||
|
|
||||||
int getConfirmations(int currentChainHeight) {
|
int getConfirmations(int currentChainHeight) {
|
||||||
if (height == null) return 0;
|
if (height == null) return 0;
|
||||||
return max(0, currentChainHeight - height!);
|
return max(0, currentChainHeight - height!);
|
||||||
|
|
|
@ -7,7 +7,8 @@ part 'transaction_note.g.dart';
|
||||||
class TransactionNote {
|
class TransactionNote {
|
||||||
Id id = Isar.autoIncrement;
|
Id id = Isar.autoIncrement;
|
||||||
|
|
||||||
late String value;
|
@Index(unique: true)
|
||||||
|
late String txid;
|
||||||
|
|
||||||
final transaction = IsarLink<Transaction>();
|
late String value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2085,14 +2085,6 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
for (final data in txnsData) {
|
for (final data in txnsData) {
|
||||||
final tx = data.item1;
|
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
|
// save transaction
|
||||||
await isar.transactions.put(tx);
|
await isar.transactions.put(tx);
|
||||||
|
|
||||||
|
@ -2111,7 +2103,6 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
await tx.address.save();
|
await tx.address.save();
|
||||||
await tx.note.save();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue