filter out utxo without scriptpubkey
This commit is contained in:
parent
90d5e57e7a
commit
b452f76250
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var imports = require('soop').imports();
|
var imports = require('soop').imports();
|
||||||
|
var _ = require('lodash');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
var BitcoreAddress = bitcore.Address;
|
var BitcoreAddress = bitcore.Address;
|
||||||
@ -183,7 +184,9 @@ Address.prototype.update = function(next, opts) {
|
|||||||
return !x.spentTxId;
|
return !x.spentTxId;
|
||||||
});
|
});
|
||||||
tDb.fillScriptPubKey(txOut, function() {
|
tDb.fillScriptPubKey(txOut, function() {
|
||||||
self.unspent = txOut.map(function(x) {
|
//_.filter will filterout unspend without scriptPubkey
|
||||||
|
//(probably from double spends)
|
||||||
|
self.unspent = _.filter(txOut.map(function(x) {
|
||||||
return {
|
return {
|
||||||
address: self.addrStr,
|
address: self.addrStr,
|
||||||
txid: x.txid,
|
txid: x.txid,
|
||||||
@ -194,7 +197,7 @@ Address.prototype.update = function(next, opts) {
|
|||||||
confirmations: x.isConfirmedCached ? (config.safeConfirmations) : x.confirmations,
|
confirmations: x.isConfirmedCached ? (config.safeConfirmations) : x.confirmations,
|
||||||
confirmationsFromCache: !!x.isConfirmedCached,
|
confirmationsFromCache: !!x.isConfirmedCached,
|
||||||
};
|
};
|
||||||
});
|
}), 'scriptPubKey');;
|
||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user