fix bug handling unconfirmed txs

This commit is contained in:
Matias Alejo Garcia 2014-05-13 17:00:32 -03:00
parent 36281230a0
commit 9b4ba424a8
2 changed files with 3 additions and 4 deletions

View File

@ -586,8 +586,8 @@ TransactionDb.prototype.add = function(tx, blockhash, cb) {
// existed? // existed?
var k = OUTS_PREFIX + tx.txid + '-' + o.n; var k = OUTS_PREFIX + tx.txid + '-' + o.n;
db.get(k, function(err) { db.get(k, function(err, val) {
if (err && err.notFound) { if (!val || (err && err.notFound)) {
db.batch() db.batch()
.put(k, addr + ':' + sat) .put(k, addr + ':' + sat)
.put(ADDR_PREFIX + addr + '-' + tx.txid + '-' + o.n, sat + ':' + ts) .put(ADDR_PREFIX + addr + '-' + tx.txid + '-' + o.n, sat + ':' + ts)
@ -698,7 +698,6 @@ TransactionDb.prototype.createFromArray = function(txs, blockHash, next) {
Rpc.getTxInfo(t, function(err, inInfo) { Rpc.getTxInfo(t, function(err, inInfo) {
if (!inInfo) return each_cb(err); if (!inInfo) return each_cb(err);
return self.add(inInfo, blockHash, each_cb); return self.add(inInfo, blockHash, each_cb);
}); });
} else { } else {

View File

@ -50,7 +50,7 @@
"start": "node node_modules/grunt-cli/bin/grunt" "start": "node node_modules/grunt-cli/bin/grunt"
}, },
"dependencies": { "dependencies": {
"bitcore": "=0.1.18", "bitcore": "=0.1.19",
"base58-native": "0.1.2", "base58-native": "0.1.2",
"async": "*", "async": "*",
"leveldown": "*", "leveldown": "*",