try doing this from c++ again.

This commit is contained in:
Christopher Jeffrey 2014-12-12 15:29:41 -08:00
parent 6229c5cf9b
commit 21037a2a74
2 changed files with 150 additions and 150 deletions

View File

@ -139,12 +139,12 @@ Bitcoin.instances = {};
Bitcoin.prototype.instances = Bitcoin.instances;
Bitcoin.__defineGetter__('global', function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return Bitcoin.instances[Object.keys(Bitcoin.instances)[0]];
});
Bitcoin.prototype.__defineGetter__('global', function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return Bitcoin.global;
});
@ -372,7 +372,7 @@ Bitcoin.prototype.start = function(options, callback) {
};
Bitcoin.prototype.getBlock = function(blockhash, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getBlock(blockhash, function(err, block) {
if (err) return callback(err);
return callback(null, bitcoin.block(block));
@ -380,7 +380,7 @@ Bitcoin.prototype.getBlock = function(blockhash, callback) {
};
Bitcoin.prototype.getBlockHeight = function(height, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getBlock(+height, function(err, block) {
if (err) return callback(err);
return callback(null, bitcoin.block(block));
@ -389,7 +389,7 @@ Bitcoin.prototype.getBlockHeight = function(height, callback) {
Bitcoin.prototype.getTransaction =
Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
if (typeof txid === 'object' && txid) {
var options = txid;
callback = blockhash;
@ -420,7 +420,7 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
};
Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var slow = true;
if (typeof txid === 'object' && txid) {
@ -465,42 +465,42 @@ Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback)
};
Bitcoin.prototype.getInfo = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getInfo();
};
Bitcoin.prototype.getPeerInfo = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getPeerInfo();
};
Bitcoin.prototype.getAddresses = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getAddresses();
};
Bitcoin.prototype.getProgress = function(callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getProgress(callback);
};
Bitcoin.prototype.setGenerate = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.setGenerate(options || {});
};
Bitcoin.prototype.getGenerate = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getGenerate(options || {});
};
Bitcoin.prototype.getMiningInfo = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getMiningInfo();
};
Bitcoin.prototype.getAddrTransactions = function(address, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoin.db.get('addr-tx/' + address, function(err, records) {
var options = {
address: address,
@ -551,24 +551,24 @@ Bitcoin.prototype.getAddrTransactions = function(address, callback) {
};
Bitcoin.prototype.getBestBlock = function(callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var hash = bitcoindjs.getBestBlock();
return bitcoindjs.getBlock(hash, callback);
};
Bitcoin.prototype.getChainHeight = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getChainHeight();
};
Bitcoin.prototype.__defineGetter__('chainHeight', function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return this.getChainHeight();
});
Bitcoin.prototype.getBlockByTxid =
Bitcoin.prototype.getBlockByTx = function(txid, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoin.db.get('block-tx/' + txid, function(err, block) {
if (block) {
return self.getBlock(block.hash, function(err, block) {
@ -589,7 +589,7 @@ Bitcoin.prototype.getBlockByTx = function(txid, callback) {
Bitcoin.prototype.getBlocksByDate =
Bitcoin.prototype.getBlocksByTime = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getBlocksByTime(options, function(err, blocks) {
if (err) return callback(err);
return callback(null, blocks.map(function(block) {
@ -599,13 +599,13 @@ Bitcoin.prototype.getBlocksByTime = function(options, callback) {
};
Bitcoin.prototype.getLastFileIndex = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.getLastFileIndex();
};
Bitcoin.prototype.log =
Bitcoin.prototype.info = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
if (this.options.silent) return;
if (typeof arguments[0] !== 'string') {
var out = util.inspect(arguments[0], null, 20, true);
@ -616,7 +616,7 @@ Bitcoin.prototype.info = function() {
};
Bitcoin.prototype.error = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
if (this.options.silent) return;
if (typeof arguments[0] !== 'string') {
var out = util.inspect(arguments[0], null, 20, true);
@ -628,7 +628,7 @@ Bitcoin.prototype.error = function() {
Bitcoin.prototype.stop =
Bitcoin.prototype.close = function(callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var self = this;
return bitcoindjs.stop(function(err, status) {
if (err) {
@ -674,7 +674,7 @@ function Block(data) {
return data;
}
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var self = this;
@ -702,17 +702,17 @@ Object.defineProperty(Block.prototype, '_blockFlag', {
});
Block.isBlock = function(block) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return block._blockFlag === Block.prototype._blockFlag;
};
Block.fromHex = function(hex) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoin.block(bitcoindjs.blockFromHex(hex));
};
Block.prototype.getHash = function(enc) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var data = bitcoindjs.getBlockHex(this);
if (!this.hash || this.hash !== data.hash) {
this.hash = data.hash;
@ -724,12 +724,12 @@ Block.prototype.getHash = function(enc) {
};
Block.prototype.verify = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return this.verified = this.verified || bitcoindjs.verifyBlock(this);
};
Block.prototype.toHex = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var hex = Block.toHex(this);
if (!this.hex || this.hex !== hex) {
this.hex = hex;
@ -738,18 +738,18 @@ Block.prototype.toHex = function() {
};
Block.toHex = function(block) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var data = bitcoindjs.getBlockHex(block);
return data.hex;
};
Block.prototype.toBinary = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return Block.toBinary(this);
};
Block.toBinary = function(block) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var data = bitcoindjs.getBlockHex(block);
return new Buffer(data.hex, 'hex');
};
@ -771,7 +771,7 @@ function Transaction(data) {
return data;
}
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var self = this;
@ -796,29 +796,29 @@ Object.defineProperty(Transaction.prototype, '_txFlag', {
Transaction.isTransaction =
Transaction.isTx = function(tx) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return tx._txFlag === Transaction.prototype._txFlag;
};
Transaction.fromHex = function(hex) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoin.tx(bitcoindjs.txFromHex(hex));
};
Transaction.prototype.verify = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return this.verified = this.verified || bitcoindjs.verifyTransaction(this);
};
Transaction.prototype.sign =
Transaction.prototype.fill = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return Transaction.fill(this, options);
};
Transaction.sign =
Transaction.fill = function(tx, options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var isTx = bitcoin.tx.isTx(tx)
, newTx;
@ -840,7 +840,7 @@ Transaction.fill = function(tx, options) {
};
Transaction.prototype.getHash = function(enc) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var data = bitcoindjs.getTxHex(this);
if (!this.txid || this.txid !== data.hash) {
this.txid = data.hash;
@ -852,12 +852,12 @@ Transaction.prototype.getHash = function(enc) {
};
Transaction.prototype.isCoinbase = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return this.vin.length === 1 && this.vin[0].coinbase;
};
Transaction.prototype.toHex = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var hex = Transaction.toHex(this);
if (!this.hex || hex !== this.hex) {
this.hex = hex;
@ -866,24 +866,24 @@ Transaction.prototype.toHex = function() {
};
Transaction.toHex = function(tx) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var data = bitcoindjs.getTxHex(tx);
return data.hex;
};
Transaction.prototype.toBinary = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return Transaction.toBinary(this);
};
Transaction.toBinary = function(tx) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var data = bitcoindjs.getTxHex(tx);
return new Buffer(data.hex, 'hex');
};
Transaction.broadcast = function(tx, options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
if (typeof tx === 'string') {
tx = { hex: tx };
}
@ -922,7 +922,7 @@ Transaction.broadcast = function(tx, options, callback) {
};
Transaction.prototype.broadcast = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
if (!callback) {
callback = options;
options = null;
@ -943,7 +943,7 @@ function Addresses(data) {
return data;
}
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var self = this;
@ -964,7 +964,7 @@ Object.defineProperty(Transaction.prototype, '_addrFlag', {
Addresses.isAddresses =
Addresses.isAddr = function(addr) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return addr._txFlag === Addresses.prototype._addrFlag;
};
@ -974,7 +974,7 @@ Addresses.isAddr = function(addr) {
*/
function Wallet() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var obj = function() {
return obj;
};
@ -985,91 +985,91 @@ function Wallet() {
}
Wallet.prototype.createAddress = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletNewAddress(options || {});
};
Wallet.prototype.getAccountAddress = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletGetAccountAddress(options || {});
};
Wallet.prototype.setAccount = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletSetAccount(options || {});
};
Wallet.prototype.getAccount = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletGetAccount(options || {});
};
Wallet.prototype.getRecipients = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletGetRecipients(options || {});
};
Wallet.prototype.getRecipient = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
options = options || {};
var label = options.label || label;
return bitcoindjs.walletGetRecipients({ _label: label });
};
Wallet.prototype.setRecipient = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletSetRecipient(options || {});
};
Wallet.prototype.removeRecipient = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletRemoveRecipient(options || {});
};
Wallet.prototype.sendTo = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletSendTo(options || {}, callback);
};
Wallet.prototype.sendFrom = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletSendFrom(options || {}, callback);
};
Wallet.prototype.move = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletMove(options || {});
};
Wallet.prototype.signMessage = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletSignMessage(options || {});
};
Wallet.prototype.verifyMessage = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletVerifyMessage(options || {});
};
Wallet.prototype.createMultiSigAddress = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletCreateMultiSigAddress(options || {});
};
Wallet.prototype.getBalance = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletGetBalance(options || {});
};
Wallet.prototype.getUnconfirmedBalance = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletGetUnconfirmedBalance(options || {});
};
// XXX Wallet Transactions
Wallet.prototype.listTransactions =
Wallet.prototype.getTransactions = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var txs = bitcoindjs.walletListTransactions(options || {});
if (callback) {
// Retrieve to regular TXs from disk:
@ -1092,19 +1092,19 @@ Wallet.prototype.getTransactions = function(options, callback) {
Wallet.prototype.listReceivedByAddress =
Wallet.prototype.getReceivedByAddress = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletReceivedByAddress(options || {});
};
Wallet.prototype.listAccounts =
Wallet.prototype.getAccounts = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletListAccounts(options || {});
};
// XXX Wallet Transaction
Wallet.prototype.getTransaction = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var tx = bitcoindjs.walletGetTransaction(options || {});
if (callback) {
// Retrieve to regular TX from disk:
@ -1119,94 +1119,94 @@ Wallet.prototype.getTransaction = function(options, callback) {
};
Wallet.prototype.backup = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletBackup(options || {});
};
Wallet.prototype.decrypt =
Wallet.prototype.passphrase = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletPassphrase(options || {});
};
Wallet.prototype.passphraseChange = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletPassphraseChange(options || {});
};
Wallet.prototype.forgetPassphrase =
Wallet.prototype.lock = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletLock(options || {});
};
Wallet.prototype.encrypt = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletEncrypt(options || {});
};
Wallet.prototype.encrypted = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletEncrypted();
};
Wallet.prototype.isEncrypted = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return this.encrypted().encrypted;
};
Wallet.prototype.isLocked = function() {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return this.encrypted().locked;
};
Wallet.prototype.dumpKey = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletDumpKey(options || {});
};
Wallet.prototype.importKey = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletImportKey(options || {}, callback);
};
Wallet.prototype.keyPoolRefill = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletKeyPoolRefill(options || {});
};
Wallet.prototype.setTxFee = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletSetTxFee(options || {});
};
Wallet.prototype.dump = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletDumpWallet(options || {}, callback);
};
Wallet.prototype.import = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletImportWallet(options || {}, callback);
};
Wallet.prototype.changeLabel = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletChangeLabel(options || {});
};
Wallet.prototype.deleteAccount = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletDeleteAccount(options || {});
};
Wallet.prototype.isMine = function(options) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletIsMine(options || {});
};
Wallet.prototype.rescan = function(options, callback) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
return bitcoindjs.walletRescan(options || {}, callback);
};
@ -1219,7 +1219,7 @@ Wallet = new Wallet;
var utils = {};
utils.forEach = function(obj, iter, done) {
if (bitcoin.stopping) return;
// if (bitcoin.stopping) return;
var pending = obj.length;
if (!pending) return done();
var next = function() {

View File

@ -933,7 +933,7 @@ start_node_thread(void) {
NAN_METHOD(StopBitcoind) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsFunction()) {
return NanThrowError(
@ -1027,7 +1027,7 @@ async_stop_node_after(uv_work_t *req) {
NAN_METHOD(IsStopping) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
NanReturnValue(NanNew<Boolean>(ShutdownRequested()));
}
@ -1040,7 +1040,7 @@ NAN_METHOD(IsStopping) {
NAN_METHOD(IsStopped) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
NanReturnValue(NanNew<Boolean>(shutdown_complete));
}
@ -1053,7 +1053,7 @@ NAN_METHOD(IsStopped) {
NAN_METHOD(GetBlock) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2
|| (!args[0]->IsString() && !args[0]->IsNumber())
@ -1174,7 +1174,7 @@ async_get_block_after(uv_work_t *req) {
NAN_METHOD(GetTransaction) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 3
|| !args[0]->IsString()
@ -1287,7 +1287,7 @@ async_get_tx_after(uv_work_t *req) {
NAN_METHOD(BroadcastTx) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 4
|| !args[0]->IsObject()
@ -1421,7 +1421,7 @@ async_broadcast_tx_after(uv_work_t *req) {
NAN_METHOD(VerifyBlock) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -1452,7 +1452,7 @@ NAN_METHOD(VerifyBlock) {
NAN_METHOD(VerifyTransaction) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -1486,7 +1486,7 @@ NAN_METHOD(VerifyTransaction) {
NAN_METHOD(FillTransaction) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2 || !args[0]->IsObject() || !args[1]->IsObject()) {
return NanThrowError(
@ -1576,7 +1576,7 @@ NAN_METHOD(FillTransaction) {
NAN_METHOD(GetInfo) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() > 0) {
return NanThrowError(
@ -1627,7 +1627,7 @@ NAN_METHOD(GetInfo) {
NAN_METHOD(GetPeerInfo) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() > 0) {
return NanThrowError(
@ -1704,7 +1704,7 @@ NAN_METHOD(GetPeerInfo) {
NAN_METHOD(GetAddresses) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() > 0) {
return NanThrowError(
@ -1746,7 +1746,7 @@ NAN_METHOD(GetAddresses) {
NAN_METHOD(GetProgress) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsFunction()) {
return NanThrowError(
@ -1867,7 +1867,7 @@ async_get_progress_after(uv_work_t *req) {
NAN_METHOD(SetGenerate) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -1934,7 +1934,7 @@ NAN_METHOD(SetGenerate) {
NAN_METHOD(GetGenerate) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
bool generate = GetBoolArg("-gen", false);
NanReturnValue(NanNew<Boolean>(generate));
}
@ -1948,7 +1948,7 @@ NAN_METHOD(GetGenerate) {
NAN_METHOD(GetMiningInfo) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
Local<Object> obj = NanNew<Object>();
@ -1988,7 +1988,7 @@ NAN_METHOD(GetMiningInfo) {
NAN_METHOD(GetAddrTransactions) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2
|| (!args[0]->IsString() && !args[0]->IsObject())
@ -2208,7 +2208,7 @@ async_get_addrtx_after(uv_work_t *req) {
NAN_METHOD(GetBestBlock) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 0) {
return NanThrowError(
@ -2229,7 +2229,7 @@ NAN_METHOD(GetBestBlock) {
NAN_METHOD(GetChainHeight) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() > 0) {
return NanThrowError(
@ -2248,7 +2248,7 @@ NAN_METHOD(GetChainHeight) {
NAN_METHOD(GetBlockByTx) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2
|| !args[0]->IsString()
@ -2368,7 +2368,7 @@ async_block_tx_after(uv_work_t *req) {
NAN_METHOD(GetBlocksByTime) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2
|| !args[0]->IsString()
@ -2504,7 +2504,7 @@ async_block_time_after(uv_work_t *req) {
NAN_METHOD(GetLastFileIndex) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() > 0) {
return NanThrowError(
@ -2527,7 +2527,7 @@ NAN_METHOD(GetLastFileIndex) {
NAN_METHOD(GetBlockHex) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -2561,7 +2561,7 @@ NAN_METHOD(GetBlockHex) {
NAN_METHOD(GetTxHex) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -2594,7 +2594,7 @@ NAN_METHOD(GetTxHex) {
NAN_METHOD(BlockFromHex) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsString()) {
return NanThrowError(
@ -2628,7 +2628,7 @@ NAN_METHOD(BlockFromHex) {
NAN_METHOD(TxFromHex) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsString()) {
return NanThrowError(
@ -2676,7 +2676,7 @@ boost::mutex poll_packets_mutex;
NAN_METHOD(HookPackets) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
Local<Array> obj = NanNew<Array>();
poll_packets_list *cur = NULL;
@ -3233,7 +3233,7 @@ process_packet(CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTim
NAN_METHOD(WalletNewAddress) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3321,7 +3321,7 @@ CBitcoinAddress GetAccountAddress(std::string strAccount, bool bForceNew=false)
NAN_METHOD(WalletGetAccountAddress) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3366,7 +3366,7 @@ NAN_METHOD(WalletGetAccountAddress) {
NAN_METHOD(WalletSetAccount) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3460,7 +3460,7 @@ NAN_METHOD(WalletSetAccount) {
NAN_METHOD(WalletGetAccount) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3495,7 +3495,7 @@ NAN_METHOD(WalletGetAccount) {
NAN_METHOD(WalletGetRecipients) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3540,7 +3540,7 @@ NAN_METHOD(WalletGetRecipients) {
NAN_METHOD(WalletSetRecipient) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3589,7 +3589,7 @@ NAN_METHOD(WalletSetRecipient) {
NAN_METHOD(WalletRemoveRecipient) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3618,7 +3618,7 @@ NAN_METHOD(WalletRemoveRecipient) {
NAN_METHOD(WalletSendTo) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2 || !args[0]->IsObject() || !args[1]->IsFunction()) {
return NanThrowError(
@ -3747,7 +3747,7 @@ async_wallet_sendto_after(uv_work_t *req) {
NAN_METHOD(WalletSendFrom) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2 || !args[0]->IsObject() || !args[1]->IsFunction()) {
return NanThrowError(
@ -3890,7 +3890,7 @@ async_wallet_sendfrom_after(uv_work_t *req) {
NAN_METHOD(WalletMove) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -3973,7 +3973,7 @@ NAN_METHOD(WalletMove) {
NAN_METHOD(WalletSignMessage) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4030,7 +4030,7 @@ NAN_METHOD(WalletSignMessage) {
NAN_METHOD(WalletVerifyMessage) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4153,7 +4153,7 @@ CScript _createmultisig_redeemScript(int nRequired, Local<Array> keys) {
NAN_METHOD(WalletCreateMultiSigAddress) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4223,7 +4223,7 @@ NAN_METHOD(WalletCreateMultiSigAddress) {
NAN_METHOD(WalletGetBalance) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4301,7 +4301,7 @@ NAN_METHOD(WalletGetBalance) {
NAN_METHOD(WalletGetUnconfirmedBalance) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
NanReturnValue(NanNew<Number>(pwalletMain->GetUnconfirmedBalance()));
}
@ -4314,7 +4314,7 @@ NAN_METHOD(WalletGetUnconfirmedBalance) {
NAN_METHOD(WalletListTransactions) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4549,7 +4549,7 @@ ListTransactions_V8(const CWalletTx& wtx, const string& strAccount,
NAN_METHOD(WalletReceivedByAddress) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4609,7 +4609,7 @@ NAN_METHOD(WalletReceivedByAddress) {
NAN_METHOD(WalletListAccounts) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4721,7 +4721,7 @@ NAN_METHOD(WalletListAccounts) {
NAN_METHOD(WalletGetTransaction) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4789,7 +4789,7 @@ NAN_METHOD(WalletGetTransaction) {
NAN_METHOD(WalletBackup) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4817,7 +4817,7 @@ NAN_METHOD(WalletBackup) {
NAN_METHOD(WalletPassphrase) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4860,7 +4860,7 @@ NAN_METHOD(WalletPassphrase) {
NAN_METHOD(WalletPassphraseChange) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4907,7 +4907,7 @@ NAN_METHOD(WalletPassphraseChange) {
NAN_METHOD(WalletLock) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 0) {
return NanThrowError(
@ -4933,7 +4933,7 @@ NAN_METHOD(WalletLock) {
NAN_METHOD(WalletEncrypt) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -4988,7 +4988,7 @@ NAN_METHOD(WalletEncrypt) {
NAN_METHOD(WalletEncrypted) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() > 0) {
return NanThrowError(
@ -5020,7 +5020,7 @@ NAN_METHOD(WalletEncrypted) {
NAN_METHOD(WalletKeyPoolRefill) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5058,7 +5058,7 @@ NAN_METHOD(WalletKeyPoolRefill) {
NAN_METHOD(WalletSetTxFee) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5089,7 +5089,7 @@ NAN_METHOD(WalletSetTxFee) {
NAN_METHOD(WalletDumpKey) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5138,7 +5138,7 @@ NAN_METHOD(WalletDumpKey) {
NAN_METHOD(WalletImportKey) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5331,7 +5331,7 @@ async_import_key_after(uv_work_t *req) {
NAN_METHOD(WalletDumpWallet) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2 || !args[0]->IsObject() || !args[1]->IsFunction()) {
return NanThrowError(
@ -5484,7 +5484,7 @@ async_dump_wallet_after(uv_work_t *req) {
NAN_METHOD(WalletImportWallet) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2 || !args[0]->IsObject() || !args[1]->IsFunction()) {
return NanThrowError(
@ -5665,7 +5665,7 @@ async_import_wallet_after(uv_work_t *req) {
NAN_METHOD(WalletChangeLabel) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5748,7 +5748,7 @@ NAN_METHOD(WalletChangeLabel) {
NAN_METHOD(WalletDeleteAccount) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5829,7 +5829,7 @@ NAN_METHOD(WalletDeleteAccount) {
NAN_METHOD(WalletIsMine) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 1 || !args[0]->IsObject()) {
return NanThrowError(
@ -5877,7 +5877,7 @@ NAN_METHOD(WalletIsMine) {
NAN_METHOD(WalletRescan) {
NanScope();
// if (SHUTTING_DOWN()) NanReturnValue(Undefined());
if (SHUTTING_DOWN()) NanReturnValue(NanNew<Array>());
if (args.Length() < 2 || !args[0]->IsObject() || !args[1]->IsFunction()) {
return NanThrowError(