Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scratch PR for investigating attaching accounts to BID covenants #398

Closed
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