Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino committed Oct 6, 2024
1 parent 14017f4 commit 9c2d843
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class Database {
* @param {Transaction} tx
*/
async storeTx(tx) {
if (!tx) throw new Error('Cannot store undefined');
const store = this.#db
.transaction('txs', 'readwrite')
.objectStore('txs');
Expand Down Expand Up @@ -333,6 +334,7 @@ export class Database {
const cursor = await store.openCursor();
const txs = [];
while (cursor) {
if (!cursor.value) break;
// Append the TXID from the Index key
cursor.value.txid = cursor.key;
txs.push(cursor.value);
Expand Down Expand Up @@ -450,6 +452,7 @@ export class Database {
const store = transaction.objectStore('txs');
let cursor = await store.openCursor();
while (cursor) {
if (!cursor.value) break;
if (cursor.value.blockHeight === -1) {
await cursor.delete();
}
Expand Down

0 comments on commit 9c2d843

Please sign in to comment.