diff --git a/lib/wallet.js b/lib/wallet.js index 8145bba..1d65fb2 100644 --- a/lib/wallet.js +++ b/lib/wallet.js @@ -244,6 +244,7 @@ Wallet.prototype._scanChain = function (opts) { }) txs.on('end', function () { self.scanning = false + if (!txs.last) return self.state.tip = { height: txs.last.height, header: txs.last.header @@ -570,7 +571,7 @@ Wallet.prototype._loadRootKey = function (cb) { if (err && !err.notFound) return cb(err) if (err && err.notFound) { self.rootKey = new HDPrivateKey() - var serialized = self.rootKey.toBuffer() + var serialized = self.rootKey.xprivkey self.store.put('root', serialized, opts, function (err) { cb(err, self.rootKey) }) return }