Skip to content
2 changes: 1 addition & 1 deletion lib/wallet/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ exports.txdb = {
// Name undo records
U: bdb.key('U', ['hash256']),
// Bids
i: bdb.key('i', ['hash256', 'hash256', 'uint32']),
i: bdb.key('i', ['hash256', 'hash256', 'uint32', 'uint32']), // Im not entirely sure how bucket.iterator(...) works - im assuming order is important here.
// Reveals
B: bdb.key('B', ['hash256', 'hash256', 'uint32']),
// Blinds
Expand Down
16 changes: 16 additions & 0 deletions lib/wallet/txdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,8 @@ class TXDB {
lockup,
blind,
own: true
// Put acct here somehow. Can get using the `outpoint`? Poking around.
// account: 123
});

updated = true;
Expand Down Expand Up @@ -2250,6 +2252,20 @@ class TXDB {
});
}

/**
* Test whether an account owns a coin.
* @param {Number} acct
* @param {Hash} hash
* @param {Index} number
* @returns {Promise} - Returns Boolean.
*/

hasCoinByAccount(acct, hash, index) {
assert(typeof acct === 'number');

return this.bucket.has(layout.C.encode(acct, hash, index));
}

/**
* Get hashes of all transactions in the database.
* @param {Number} acct
Expand Down
Loading