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);
|
options.noAuth = bool(data.noauth);
|
||||||
|
|
||||||
// Wallet
|
// Wallet
|
||||||
|
options.startHeight = num(data.startheight);
|
||||||
options.wipeNoReally = bool(data.wipenoreally);
|
options.wipeNoReally = bool(data.wipenoreally);
|
||||||
|
|
||||||
options.data = data;
|
options.data = data;
|
||||||
|
|||||||
@ -148,6 +148,7 @@ function FullNode(options) {
|
|||||||
witness: this.options.witness,
|
witness: this.options.witness,
|
||||||
useCheckpoints: this.options.useCheckpoints,
|
useCheckpoints: this.options.useCheckpoints,
|
||||||
maxFiles: this.options.maxFiles,
|
maxFiles: this.options.maxFiles,
|
||||||
|
startHeight: this.options.startHeight,
|
||||||
wipeNoReally: this.options.wipeNoReally,
|
wipeNoReally: this.options.wipeNoReally,
|
||||||
resolution: false,
|
resolution: false,
|
||||||
verify: false
|
verify: false
|
||||||
|
|||||||
@ -88,6 +88,7 @@ function SPVNode(options) {
|
|||||||
location: this.location('walletdb'),
|
location: this.location('walletdb'),
|
||||||
witness: this.options.witness,
|
witness: this.options.witness,
|
||||||
maxFiles: this.options.maxFiles,
|
maxFiles: this.options.maxFiles,
|
||||||
|
startHeight: this.options.startHeight,
|
||||||
wipeNoReally: this.options.wipeNoReally,
|
wipeNoReally: this.options.wipeNoReally,
|
||||||
resolution: true,
|
resolution: true,
|
||||||
verify: true
|
verify: true
|
||||||
|
|||||||
@ -1535,7 +1535,13 @@ WalletDB.prototype.init = co(function* init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.client) {
|
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);
|
tip = BlockMeta.fromEntry(tip);
|
||||||
} else {
|
} else {
|
||||||
tip = BlockMeta.fromEntry(this.network.genesis);
|
tip = BlockMeta.fromEntry(this.network.genesis);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user