From 27e90ef41aa71778162111469e0d6ad80306b1b7 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Thu, 1 Oct 2015 23:50:06 -0400 Subject: [PATCH] Give false if spent information not available. --- lib/services/address/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/services/address/index.js b/lib/services/address/index.js index 2d0b8b77..d08ddc3e 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -8,6 +8,7 @@ var log = index.log; var errors = index.errors; var Transaction = require('../../transaction'); var bitcore = require('bitcore'); +var levelup = require('levelup'); var $ = bitcore.util.preconditions; var _ = bitcore.deps._; var Hash = bitcore.crypto.Hash; @@ -763,7 +764,9 @@ AddressService.prototype.getInputForOutput = function(txid, outputIndex, options keyEncoding: 'binary' }; this.node.services.db.store.get(key, dbOptions, function(err, buffer) { - if (err) { + if (err instanceof levelup.errors.NotFoundError) { + return callback(null, false); + } else if (err) { return callback(err); } var value = self._decodeInputValueMap(buffer);