node: add http indexer info

This commit is contained in:
Braydon Fuller 2019-04-16 14:54:51 -07:00
parent bd26dbf32d
commit bb797602e6
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4
2 changed files with 17 additions and 0 deletions

View File

@ -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,

View File

@ -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 () => {