walletdb: add startHeight option.
This commit is contained in:
parent
b2c02a7052
commit
666e7d514f
@ -210,6 +210,7 @@ config.parseData = function parseData(data, prefix, dirname) {
|
||||
options.noAuth = bool(data.noauth);
|
||||
|
||||
// Wallet
|
||||
options.startHeight = num(data.startheight);
|
||||
options.wipeNoReally = bool(data.wipenoreally);
|
||||
|
||||
options.data = data;
|
||||
|
||||
@ -148,6 +148,7 @@ function FullNode(options) {
|
||||
witness: this.options.witness,
|
||||
useCheckpoints: this.options.useCheckpoints,
|
||||
maxFiles: this.options.maxFiles,
|
||||
startHeight: this.options.startHeight,
|
||||
wipeNoReally: this.options.wipeNoReally,
|
||||
resolution: false,
|
||||
verify: false
|
||||
|
||||
@ -88,6 +88,7 @@ function SPVNode(options) {
|
||||
location: this.location('walletdb'),
|
||||
witness: this.options.witness,
|
||||
maxFiles: this.options.maxFiles,
|
||||
startHeight: this.options.startHeight,
|
||||
wipeNoReally: this.options.wipeNoReally,
|
||||
resolution: true,
|
||||
verify: true
|
||||
|
||||
@ -1535,7 +1535,13 @@ WalletDB.prototype.init = co(function* init() {
|
||||
}
|
||||
|
||||
if (this.client) {
|
||||
tip = yield this.client.getTip();
|
||||
if (this.options.startHeight != null) {
|
||||
tip = yield this.client.getEntry(this.options.startHeight);
|
||||
if (!tip)
|
||||
throw new Error('WDB: Could not find start block.');
|
||||
} else {
|
||||
tip = yield this.client.getTip();
|
||||
}
|
||||
tip = BlockMeta.fromEntry(tip);
|
||||
} else {
|
||||
tip = BlockMeta.fromEntry(this.network.genesis);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user