-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
215 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
// walletdb version 0 to 1 migration. | ||
|
||
const Network = require('../../../lib/protocol/network'); | ||
const WalletDB = require('../../../lib/wallet/walletdb'); | ||
const cutil = require('../../util/common'); | ||
const wutils = require('../../util/wallet'); | ||
|
||
const NETWORK = Network.get('regtest'); | ||
|
||
(async () => { | ||
const wdb = new WalletDB({ | ||
network: NETWORK, | ||
memory: true | ||
}); | ||
|
||
await wdb.open(); | ||
console.log(JSON.stringify({ | ||
data: await getMigrationDump(wdb) | ||
}, null, 2)); | ||
|
||
await wdb.close(); | ||
})().catch((err) => { | ||
console.error(err.stack); | ||
process.exit(1); | ||
}); | ||
|
||
async function getMigrationDump(wdb) { | ||
const prefixes = [ | ||
'M' | ||
]; | ||
|
||
return wutils.dumpWDB(wdb, prefixes.map(cutil.prefix2hex)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"description": "Migrate migrations. Affects wdb layout M.", | ||
"cases": [ | ||
{ | ||
"description": "Migration after migration flag was set.", | ||
"before": { | ||
"4d00000000": "00" | ||
}, | ||
"after": { | ||
"4d": "000000000200" | ||
} | ||
}, | ||
{ | ||
"description": "Migration before flag was set.", | ||
"before": {}, | ||
"after": { | ||
"4d": "000000000200" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters