convert input to object

This commit is contained in:
Patrick Nagurny 2015-07-24 13:43:17 -06:00
parent ac774ba9e8
commit bede8a96ea
1 changed files with 5 additions and 3 deletions

View File

@ -34,7 +34,8 @@ AddressModule.prototype.getAPIMethods = function() {
['getOutputs', this, this.getOutputs, 2], ['getOutputs', this, this.getOutputs, 2],
['getUnspentOutputs', this, this.getUnspentOutputs, 2], ['getUnspentOutputs', this, this.getUnspentOutputs, 2],
['isSpent', this, this.isSpent, 2], ['isSpent', this, this.isSpent, 2],
['getTransactionsForAddress', this, this.getTransactionsForAddress, 2] ['getTransactionsForAddress', this, this.getTransactionsForAddress, 2],
['getSpendTxForOutput', this, this.getSpendTxForOutput, 3]
]; ];
}; };
@ -120,9 +121,10 @@ AddressModule.prototype.blockHandler = function(block, addOutput, callback) {
} }
for(var j = 0; j < inputs.length; j++) { for(var j = 0; j < inputs.length; j++) {
var input = inputs[j].toObject();
operations.push({ operations.push({
type: action, type: action,
key: [AddressModule.PREFIXES.SPENTS, inputs[j].prevTxId, inputs[j].outputIndex].join('-'), key: [AddressModule.PREFIXES.SPENTS, input.prevTxId, input.outputIndex].join('-'),
value: txid value: txid
}); });
} }
@ -324,7 +326,7 @@ AddressModule.prototype.getTransactionsForAddress = function(address, queryMempo
transactions.push(tx); transactions.push(tx);
self.db.getSpendTxForOutput(output.txid, output.outputIndex, queryMempool, function(err, tx) { self.getSpendTxForOutput(output.txid, output.outputIndex, queryMempool, function(err, tx) {
if(err instanceof levelup.errors.NotFoundError) { if(err instanceof levelup.errors.NotFoundError) {
return next(); return next();
} else if(err) { } else if(err) {