diff --git a/lib/wallet/layout.js b/lib/wallet/layout.js index 57a9295ef..babd96e1c 100644 --- a/lib/wallet/layout.js +++ b/lib/wallet/layout.js @@ -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 diff --git a/lib/wallet/txdb.js b/lib/wallet/txdb.js index a22a1c80b..6192a3a8e 100644 --- a/lib/wallet/txdb.js +++ b/lib/wallet/txdb.js @@ -532,13 +532,17 @@ class TXDB { putBid(b, nameHash, outpoint, options) { const {hash, index} = outpoint; + const acct = options.account + + assert(typeof acct === undefined || typeof acct === number) + const bb = new BlindBid(); bb.nameHash = nameHash; bb.name = options.name; bb.lockup = options.lockup; bb.blind = options.blind; bb.own = options.own; - b.put(layout.i.encode(nameHash, hash, index), bb.encode()); + b.put(layout.i.encode(nameHash, hash, index, acct), bb.encode()); } /** @@ -1881,7 +1885,8 @@ class TXDB { name, lockup, blind, - own: true + own: true, + account: path.account }); updated = true; diff --git a/lib/wallet/wallet.js b/lib/wallet/wallet.js index cf78b81ac..e85cb8657 100644 --- a/lib/wallet/wallet.js +++ b/lib/wallet/wallet.js @@ -1625,6 +1625,11 @@ class Wallet extends EventEmitter { assert(Number.isSafeInteger(value) && value >= 0); assert(Number.isSafeInteger(lockup) && lockup >= 0); assert((acct >>> 0) === acct || typeof acct === 'string'); + + if (acct != null) { + assert(acct >>> 0 === acct || typeof acct === "string"); + acct = await this.getAccountIndex(acct); + } if (!rules.verifyName(name)) throw new Error('Invalid name.');