diff --git a/lib/bcoin/http/rpc.js b/lib/bcoin/http/rpc.js index 46d47b62..6312f3f2 100644 --- a/lib/bcoin/http/rpc.js +++ b/lib/bcoin/http/rpc.js @@ -260,6 +260,9 @@ RPC.prototype.execute = function execute(json, callback) { case 'removeprunedfunds': return this.removeprunedfunds(json.params, callback); + case 'getmemory': + return this.getmemory(json.params, callback); + default: return callback(new Error('Method not found.')); } @@ -1056,6 +1059,24 @@ RPC.prototype.getmempoolinfo = function getmempoolinfo(args, callback) { }); }; +RPC.prototype.getmempoolancestors = function getmempoolancestors(args, callback) { + if (args.help || args.length < 1 || args.length > 2) { + return callback(new RPCError('getmempoolancestors txid (verbose)')); + callback(new Error('Not implemented.')); +}; + +RPC.prototype.getmempooldescendants = function getmempooldescendants(args, callback) { + if (args.help || args.length < 1 || args.length > 2) { + return callback(new RPCError('getmempooldescendants txid (verbose)')); + callback(new Error('Not implemented.')); +}; + +RPC.prototype.getmempoolentry = function getmempoolentry(args, callback) { + if (args.help || args.length !== 1) + return callback(new RPCError('getmempoolentry txid')); + callback(new Error('Not implemented.')); +}; + RPC.prototype.getrawmempool = function getrawmempool(args, callback) { var verbose; @@ -1871,7 +1892,7 @@ RPC.prototype.decodescript = function decodescript(args, callback) { var data, script, hash, address; if (args.help || args.length !== 1) - return callback(new RPCError('decodescript \"hex\"')); + return callback(new RPCError('decodescript "hex"')); data = String(args[0]); script = new bcoin.script(); @@ -2541,7 +2562,7 @@ RPC.prototype.addmultisigaddress = function addmultisigaddress(args, callback) { RPC.prototype.addwitnessaddress = function addwitnessaddress(args, callback) { if (args.help || args.length < 1 || args.length > 1) - return callback(new RPCError('addwitnessaddress \"address\"')); + return callback(new RPCError('addwitnessaddress "address"')); // Unlikely to be implemented. callback(new Error('Not implemented.')); }; @@ -3648,6 +3669,22 @@ RPC.prototype.removeprunedfunds = function removeprunedfunds(args, callback) { callback(new Error('Not implemented.')); }; +RPC.prototype.getmemory = function getmemory(args, callback) { + var mem; + + if (args.help || args.length !== 0) + return callback(new RPCError('getmemory')); + + mem = process.memoryUsage(); + + callback(null, { + rss: utils.mb(mem.rss), + jsheap: utils.mb(mem.heapUsed), + jsheaptotal: utils.mb(mem.heapTotal), + nativeheap: utils.mb(mem.rss - mem.heapTotal) + }); +}; + /* * Helpers */