diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a680ecf4..e10ce06b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,6 @@ process and allows parallel rescans. - Add `getMempoolRejectionFilter` and `checkMempoolRejectionFilter` NodeClient aliases. - Add `getFee`, an HTTP alternative to estimateFee socket call. - - Adds `getMedianTime(blockhash)` that returns median time past of the block. - Adds `getEntries(start, end)` that returns encoded chain entries. ### Wallet Changes diff --git a/lib/client/node.js b/lib/client/node.js index 305f53d98..dd4cc12b7 100644 --- a/lib/client/node.js +++ b/lib/client/node.js @@ -263,16 +263,6 @@ class NodeClient extends Client { return this.call('get entry', blockhash); } - /** - * Get median time past. - * @param {Hash} blockhash - * @returns {Promise} - */ - - getMedianTime(blockhash) { - return this.call('get median time', blockhash); - } - /** * Get hashes. * @param {Number} [start=-1] diff --git a/lib/wallet/nodeclient.js b/lib/wallet/nodeclient.js index 0f3dc6034..4a98ea33d 100644 --- a/lib/wallet/nodeclient.js +++ b/lib/wallet/nodeclient.js @@ -175,21 +175,6 @@ class NodeClient extends AsyncEmitter { return entry; } - /** - * Get median time past. - * @param {Hash} blockhash - * @returns {Promise} - */ - - async getMedianTime(blockhash) { - const entry = await this.node.chain.getEntry(blockhash); - - if (!entry) - return null; - - return this.node.chain.getMedianTime(entry); - } - /** * Send a transaction. Do not wait for promise. * @param {TX} tx @@ -358,7 +343,7 @@ class NodeClient extends AsyncEmitter { if (!entry) return null; - return entry; + return entry.toJSON(); } } diff --git a/lib/wallet/nullclient.js b/lib/wallet/nullclient.js index ba77a2dda..03cb521ea 100644 --- a/lib/wallet/nullclient.js +++ b/lib/wallet/nullclient.js @@ -10,7 +10,6 @@ const assert = require('bsert'); const EventEmitter = require('events'); const NameState = require('../covenants/namestate'); const Block = require('../primitives/block'); -const util = require('../utils/util'); /** * Null Client @@ -94,16 +93,6 @@ class NullClient extends EventEmitter { return { hash, height: 0, time: 0 }; } - /** - * Get median time past. - * @param {Hash} blockhash - * @returns {Promise} - */ - - async getMedianTime(blockhash) { - return util.now(); - } - /** * Send a transaction. Do not wait for promise. * @param {TX} tx diff --git a/test/node-http-test.js b/test/node-http-test.js index cb4f0029c..c8efcfba0 100644 --- a/test/node-http-test.js +++ b/test/node-http-test.js @@ -19,7 +19,6 @@ const mnemonics = require('./data/mnemonic-english.json'); const consensus = require('../lib/protocol/consensus'); const Outpoint = require('../lib/primitives/outpoint'); const ChainEntry = require('../lib/blockchain/chainentry'); -const util = require('../lib/utils/util'); const {ZERO_HASH} = consensus; // Commonly used test mnemonic @@ -434,7 +433,7 @@ describe('Node HTTP', function() { describe('Websockets', function() { this.timeout(15000); - describe('Get entry and mtp', function() { + describe('Get entry', function() { const nodeCtx = new NodeContext({ wallet: true }); @@ -463,11 +462,6 @@ describe('Node HTTP', function() { assert.strictEqual(entry.height, 0); }); - it('should get genesis mtp by height', async () => { - const mtp = await nclient.getMedianTime(0); - assert(mtp); - }); - it('should get last entry by height', async () => { const rawTip = await nclient.getTip(); assert(rawTip); @@ -483,14 +477,6 @@ describe('Node HTTP', function() { assert.bufferEqual(entry.hash, tip.hash); }); - it('should get last mtp by height', async () => { - const tip = ChainEntry.decode(await nclient.getTip()); - assert(tip); - - const mtp = await nclient.getMedianTime(tip.height); - assert(mtp); - }); - it('should get all entries by hash', async () => { const tip = ChainEntry.decode(await nclient.getTip()); assert(tip); @@ -508,25 +494,6 @@ describe('Node HTTP', function() { hash = entry.prevBlock; } while (entry.height > 0); }); - - it('should get all mtps by hash', async () => { - const tip = ChainEntry.decode(await nclient.getTip()); - - let entry; - let hash = tip.hash; - let lastMTP = util.now() + 1e8; - do { - entry = ChainEntry.decode(await nclient.getEntry(hash)); - assert(entry); - - const mtp = await nclient.getMedianTime(entry.hash); - assert(mtp); - assert(mtp <= lastMTP); - lastMTP = mtp; - - hash = entry.prevBlock; - } while (entry.height > 0); - }); }); describe('get hashes and entries', function() {