fix typo.

This commit is contained in:
Christopher Jeffrey 2014-12-01 22:47:43 -08:00
parent 774f08c91f
commit f3ea892b82
1 changed files with 7 additions and 6 deletions

View File

@ -417,22 +417,23 @@ Bitcoin.prototype.getMiningInfo = function() {
return bitcoindjs.getMiningInfo();
};
Bitcoin.prototype.getAddrTransactions = function(addr, callback) {
Bitcoin.prototype.getAddrTransactions = function(address, callback) {
if (!bitcoin.db) {
var tiny = require('tiny').json;
tiny.debug = function() {};
bitcoin.db = tiny({
file: process.env.HOME + '/.bitcoindjs.addr.db',
saveIndex: false,
initialCache: false
});
}
return bitcoin.db.get(addr, function(err, records) {
return bitcoin.db.get(address, function(err, records) {
var found = !err && records && records.length;
var last = found && records[records.length - 1];
var limit = 15 * 60 * 1000;
if (!found || last.timestamp + limit < Date.now()) {
var options = {
address: addr,
address: address,
blockindex: (records || []).reduce(function(out, record) {
return record.blockindex > out
? record.blockindex
@ -443,7 +444,7 @@ Bitcoin.prototype.getAddrTransactions = function(addr, callback) {
if (err) return callback(err);
addr = bitcoin.addr(addr);
if (addr.tx[0] && !addr.tx[0].vout[0]) {
return bitcoin.db.set(addr, [{
return bitcoin.db.set(address, [{
txid: null,
blockhash: null,
blockindex: null,
@ -467,7 +468,7 @@ Bitcoin.prototype.getAddrTransactions = function(addr, callback) {
timestamp: Date.now()
});
});
return bitcoin.db.set(addr, set, function() {
return bitcoin.db.set(address, set, function() {
return callback(null, addr);
});
});
@ -485,7 +486,7 @@ Bitcoin.prototype.getAddrTransactions = function(addr, callback) {
});
}, function() {
return callback(null, bitcoin.addr({
address: addr,
address: address,
tx: txs
}));
});