Skip to content

Commit

Permalink
wdb-test: rename lookahead migration data.
Browse files Browse the repository at this point in the history
  • Loading branch information
nodech committed Jul 11, 2024
1 parent 3ec3a4c commit 30f9de7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/data/migrations/wallet-0-migrate-migrations-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ async function getMigrationDump(wdb) {
'M'
];

return mutils.dumpWDB(wdb, prefixes.map(mutils.prefix2hex));
return mutils.dumpDB(wdb, prefixes.map(mutils.prefix2hex));
}
4 changes: 2 additions & 2 deletions test/data/migrations/wallet-1-change-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ async function getMigrationDump(wdb) {
beforeOnlyPrefixes.push(layout.wdb.W.encode(0).toString('hex'));
beforeOnlyPrefixes.push(layout.wdb.w.encode(0).toString('hex'));

const dump = await mutils.dumpWDB(wdb, prefixes);
const dumpBeforeOnly = await mutils.dumpWDB(wdb, beforeOnlyPrefixes);
const dump = await mutils.dumpDB(wdb, prefixes);
const dumpBeforeOnly = await mutils.dumpDB(wdb, beforeOnlyPrefixes);
const beforeOnly = dumpBeforeOnly;

const filtered = {};
Expand Down
2 changes: 1 addition & 1 deletion test/data/migrations/wallet-2-account-lookahead-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ async function getMigrationDump(wdb) {
prefixes.push(layout.wdb.a.encode(i, 0).slice(0, 5).toString('hex'));
}

return await mutils.dumpWDB(wdb, prefixes);
return await mutils.dumpDB(wdb, prefixes);
}
8 changes: 6 additions & 2 deletions test/util/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ exports.prefix2hex = function prefix2hex(prefix) {
return Buffer.from(prefix, 'ascii').toString('hex');
};

exports.dumpWDB = async (wdb, prefixes) => {
const data = await wdb.dump();
exports.dumpDB = async (db, prefixes) => {
const data = await db.dump();
const filtered = {};

for (const [key, value] of Object.entries(data)) {
Expand All @@ -215,3 +215,7 @@ exports.dumpWDB = async (wdb, prefixes) => {

return filtered;
};

exports.dumpChainDB = async (chaindb, prefixes) => {
return exports.dumpDB(chaindb.db, prefixes);
};
2 changes: 1 addition & 1 deletion test/wallet-migration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe('Wallet Migrations', function() {
describe('Migrate change address (data)', function() {
const location = testdir('wallet-lookahead-data');
const migrationsBAK = WalletMigrator.migrations;
const data = require('./data/migrations/wallet-2-account-lookahead-gen.json');
const data = require('./data/migrations/wallet-2-account-lookahead.json');
const Migration = WalletMigrator.MigrateAccountLookahead;

const walletOptions = {
Expand Down

0 comments on commit 30f9de7

Please sign in to comment.