walletdb: fix pending tx iteration.

This commit is contained in:
Christopher Jeffrey 2016-09-16 01:02:03 -07:00
parent 3a5b258209
commit 9b097f97b9
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1138,15 +1138,21 @@ WalletDB.prototype.rescan = function rescan(chaindb, height, callback) {
WalletDB.prototype.getPendingKeys = function getPendingKeys(callback) {
var layout = require('./txdb').layout;
var dummy = new Buffer(0);
var uniq = {};
this.db.iterate({
gte: layout.prefix(0x00000000, layout.p(constants.NULL_HASH)),
lte: layout.prefix(0xffffffff, layout.p(constants.HIGH_HASH)),
gte: layout.prefix(0x00000000, dummy),
lte: layout.prefix(0xffffffff, dummy),
keys: true,
parse: function(key) {
var wid = layout.pre(key);
var hash = layout.pp(key);
var wid, hash;
if (key[5] !== 0x70)
return;
wid = layout.pre(key);
hash = layout.pp(key);
if (uniq[hash])
return;