Skip to content

Commit 6dae2a0

Browse files
committed
Add notes
1 parent ced8a60 commit 6dae2a0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/mobile-app/data/wallet/writeQueue.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ export class WriteQueue {
103103
sequence: block.sequence - 1,
104104
});
105105

106+
// There are several unresolved cases with removing blocks, but removing more than a couple
107+
// blocks should be very uncommon, so they're listed here:
108+
//
109+
// * We could remove multiple blocks at a time. Again, the chain shouldn't generally be
110+
// removing more than a couple blocks unless something is wrong.
111+
//
112+
// * To be totally correct, the nullifier set should only include nullifiers between the DB
113+
// head and the writeQueue head, so we should remove nullifiers when we queue up a REMOVE.
114+
// However, we're only using the nullifierSet for checking existence, and assuming that the wallet
115+
// server validated the blocks correctly, these nullifiers should never be spent until they're readded
116+
// (probably by the same transaction on a different block). However, the nullifiers may not ever be
117+
// readded, which would cause them to get stuck in our nullifier set forever.
118+
//
119+
// * Related to the above, we could merge ADDs and REMOVEs if they apply to the same block.
106120
this.writeQueue.push({
107121
type: DBWriteType.REMOVE,
108122
accountId,

0 commit comments

Comments
 (0)