From bb797602e68f2e6fff11a0a5a7a7a3a808632f7c Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Tue, 16 Apr 2019 14:54:51 -0700 Subject: [PATCH] node: add http indexer info --- lib/node/http.js | 10 ++++++++++ test/http-test.js | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/lib/node/http.js b/lib/node/http.js index 2edd8cb2..01de675f 100644 --- a/lib/node/http.js +++ b/lib/node/http.js @@ -127,6 +127,16 @@ class HTTP extends Server { tip: this.chain.tip.rhash(), progress: this.chain.getProgress() }, + indexes: { + addr: { + enabled: Boolean(this.node.addrindex), + height: this.node.addrindex ? this.node.addrindex.height : 0 + }, + tx: { + enabled: Boolean(this.node.txindex), + height: this.node.txindex ? this.node.txindex.height : 0 + } + }, pool: { host: addr.host, port: addr.port, diff --git a/test/http-test.js b/test/http-test.js index 93af5848..6c52fffe 100644 --- a/test/http-test.js +++ b/test/http-test.js @@ -89,6 +89,13 @@ describe('HTTP', function() { assert.strictEqual(info.pool.agent, node.pool.options.agent); assert.typeOf(info.chain, 'object'); assert.strictEqual(info.chain.height, 0); + assert.typeOf(info.indexes, 'object'); + assert.typeOf(info.indexes.addr, 'object'); + assert.equal(info.indexes.addr.enabled, false); + assert.equal(info.indexes.addr.height, 0); + assert.typeOf(info.indexes.tx, 'object'); + assert.equal(info.indexes.addr.enabled, false); + assert.equal(info.indexes.tx.height, 0); }); it('should get wallet info', async () => {