add missing commands added in bitcoind v0.7.0

This commit is contained in:
freewil 2013-05-04 23:58:40 -04:00
parent 3c20e34d1a
commit 596a828f07
2 changed files with 48 additions and 3 deletions

View File

@ -2,6 +2,7 @@ module.exports = {
addMultiSigAddress: 'addmultisigaddress',
addNode: 'addnode', // bitcoind v0.8.0+
backupWallet: 'backupwallet',
createMultiSig: 'createmultisig',
createRawTransaction: 'createrawtransaction', // bitcoind v0.7.0+
decodeRawTransaction: 'decoderawtransaction', // bitcoind v0.7.0+
dumpPrivKey: 'dumpprivkey',
@ -14,14 +15,15 @@ module.exports = {
getBlock: 'getblock',
getBlockCount: 'getblockcount',
getBlockHash: 'getblockhash',
getBlockTemplate: 'getblocktemplate', // bitcoind v0.7.0+
getConnectionCount: 'getconnectioncount',
getDifficulty: 'getdifficulty',
getGenerate: 'getgenerate',
getHashesPerSecond: 'gethashespersec',
getHashesPerSec: 'gethashespersec',
getInfo: 'getinfo',
getMemorypool: 'getmemorypool',
getMemoryPool: 'getmemorypool',
getMemorypool: 'getmemorypool', // replaced in bitcoind v0.7.0 with
getMemoryPool: 'getmemorypool', // `getblocktemplate`, `submitblock`, `getrawmempool`
getMiningInfo: 'getmininginfo',
getNewAddress: 'getnewaddress',
getPeerInfo: 'getpeerinfo', // bitcoind v0.7.0+
@ -30,13 +32,16 @@ module.exports = {
getReceivedByAccount: 'getreceivedbyaccount',
getReceivedByAddress: 'getreceivedbyaddress',
getTransaction: 'gettransaction',
getTxOut: 'gettxout', // bitcoind v0.7.0+
getTxOutSetInfo: 'gettxoutsetinfo', // bitcoind v0.7.0+
getWork: 'getwork',
help: 'help',
importPrivKey: 'importprivkey',
keypoolRefill: 'keypoolrefill',
keyPoolRefill: 'keypoolrefill',
listAccounts: 'listaccounts',
listLockUnspent: 'listlockunspent', // bitcoind v0.8.0
listAddressGroupings: 'listaddressgroupings', // bitcoind v0.7.0+
listLockUnspent: 'listlockunspent', // bitcoind v0.8.0+
listReceivedByAccount: 'listreceivedbyaccount',
listReceivedByAddress: 'listreceivedbyaddress',
listSinceBlock: 'listsinceblock',
@ -54,6 +59,7 @@ module.exports = {
signMessage: 'signmessage',
signRawTransaction: 'signrawtransaction', // bitcoind v0.7.0+
stop: 'stop',
submitBlock: 'submitblock', // bitcoind v0.7.0+
validateAddress: 'validateaddress',
verifyMessage: 'verifymessage',
walletLock: 'walletlock',

39
test/missing-commands.js Normal file
View File

@ -0,0 +1,39 @@
var assert = require('assert'),
bitcoin = require('../'),
config = require('./config'),
commands = require('../commands');
describe('Client Commands', function() {
it('should have all the commands listed by `help`', function(done) {
var client = new bitcoin.Client(config);
var commandRegex = /^([a-z]+)/;
// get the list of all the commands
client.cmd('help', function(err, commandList) {
assert.ifError(err);
// split up the command list by newlines
var commandListLines = commandList.split('\n');
commandListLines.forEach(function(commandListLine) {
// get the actual name of the command from the command list line
var result = commandRegex.exec(commandListLine);
assert.ok(result, 'command list line failed to match regex: ' + commandListLine);
// check to see if the command name is in the commands object
var found = false;
for (var i in commands) {
if (commands[i] === result[1]) {
found = true;
break;
}
}
assert.ok(found, 'missing command found in `help`: ' + result[1]);
});
done();
});
});
});