From 596a828f07beac28c3d43a082126b8e171e44d16 Mon Sep 17 00:00:00 2001 From: freewil Date: Sat, 4 May 2013 23:58:40 -0400 Subject: [PATCH] add missing commands added in bitcoind v0.7.0 --- commands.js | 12 +++++++++--- test/missing-commands.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 test/missing-commands.js diff --git a/commands.js b/commands.js index 9e5f3be..20e646b 100644 --- a/commands.js +++ b/commands.js @@ -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', diff --git a/test/missing-commands.js b/test/missing-commands.js new file mode 100644 index 0000000..994521d --- /dev/null +++ b/test/missing-commands.js @@ -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(); + }); + }); + +});