test: fix wallet test case for bidreveal.
This commit is contained in:
parent
3ae22968fd
commit
fd2e57a761
3 changed files with 10 additions and 8 deletions
|
|
@ -563,8 +563,10 @@ class MigrateBidRevealEntries extends AbstractMigration {
|
|||
const totalOld = nameLen + 1 + 13;
|
||||
const totalNew = nameLen + 1 + 13 + 36;
|
||||
|
||||
// allow migration to be interrupted in the middle.
|
||||
assert(value.length === totalOld || value.length === totalNew);
|
||||
|
||||
// skip if already migrated.
|
||||
if (value.length === totalNew)
|
||||
continue;
|
||||
|
||||
|
|
@ -591,11 +593,14 @@ class MigrateBidRevealEntries extends AbstractMigration {
|
|||
const bidKey = txlayout.i.encode(
|
||||
nameHash, bidPrevout.hash, bidPrevout.index);
|
||||
const bidRecord = await bucket.get(bidKey);
|
||||
// ensure bid exists.
|
||||
assert(bidRecord);
|
||||
|
||||
const newReveal = Buffer.concat([value, bidPrevout.encode()]);
|
||||
assert(newReveal.length === totalNew);
|
||||
// update reveal with bid outpoint.
|
||||
b.put(key, newReveal);
|
||||
// index bid to reveal.
|
||||
b.put(txlayout.E.encode(nameHash, bidPrevout.hash, bidPrevout.index),
|
||||
(new Outpoint(txHash, txIndex)).encode());
|
||||
await b.write();
|
||||
|
|
@ -648,6 +653,7 @@ class MigrateBidRevealEntries extends AbstractMigration {
|
|||
const nameLen = value[0];
|
||||
const totalNew = nameLen + 1 + 41 + 4;
|
||||
|
||||
// allow migration to be interrupted in the middle.
|
||||
if (totalNew === value.length)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,16 +66,16 @@ let timeCounter = 0;
|
|||
|
||||
// fund wallets
|
||||
const mtx1 = new MTX();
|
||||
mtx1.addInput(wutils.determinsticInput(txID++));
|
||||
mtx1.addInput(wutils.deterministicInput(txID++));
|
||||
mtx1.addOutput(await wallet1.receiveAddress(0), 10e6);
|
||||
|
||||
const mtx2 = new MTX();
|
||||
mtx2.addInput(wutils.determinsticInput(txID++));
|
||||
mtx2.addInput(wutils.deterministicInput(txID++));
|
||||
mtx2.addOutput(await wallet1.receiveAddress(1), 10e6);
|
||||
|
||||
// fund second wallet.
|
||||
const mtx3 = new MTX();
|
||||
mtx3.addInput(wutils.determinsticInput(txID++));
|
||||
mtx3.addInput(wutils.deterministicInput(txID++));
|
||||
mtx3.addOutput(await wallet2.receiveAddress(), 10e6);
|
||||
|
||||
await wdb.addBlock(wutils.nextEntry(wdb), [
|
||||
|
|
|
|||
|
|
@ -3649,7 +3649,7 @@ describe('Wallet', function() {
|
|||
}
|
||||
};
|
||||
|
||||
const NAME = 'testname';
|
||||
const NAME = rules.grindName(10, 1, network);
|
||||
const NAMEHASH = rules.hashString(NAME);
|
||||
let wallet;
|
||||
|
||||
|
|
@ -3664,10 +3664,6 @@ describe('Wallet', function() {
|
|||
await wdb.connect();
|
||||
|
||||
wallet = await wdb.create();
|
||||
|
||||
// rollout all names
|
||||
wdb.height = 52 * 144 * 7;
|
||||
wdb.state.height = 52 * 144 * 7;
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue