aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_misc.py
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2020-07-31 14:02:00 +0200
committerFabian Jahr <fjahr@protonmail.com>2020-08-16 11:15:52 +0200
commitc447b09458c89c946957a211a4f5373b92af44bf (patch)
tree9eeb11c19596437b6cd2f099e5a7c172cf33c72f /test/functional/rpc_misc.py
parent667bc7a7f7c5d9a15eaf6957c3d8841a75efa7bc (diff)
downloadbitcoin-c447b09458c89c946957a211a4f5373b92af44bf.tar.xz
test: Add tests for getindexinfo RPC
Diffstat (limited to 'test/functional/rpc_misc.py')
-rwxr-xr-xtest/functional/rpc_misc.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/rpc_misc.py b/test/functional/rpc_misc.py
index cc5a264adb..0493ceeb64 100755
--- a/test/functional/rpc_misc.py
+++ b/test/functional/rpc_misc.py
@@ -61,6 +61,34 @@ class RpcMiscTest(BitcoinTestFramework):
node.logging(include=['qt'])
assert_equal(node.logging()['qt'], True)
+ self.log.info("test getindexinfo")
+ # Without any indices running the RPC returns an empty object
+ assert_equal(node.getindexinfo(), {})
+
+ # Restart the node with indices and wait for them to sync
+ self.restart_node(0, ["-txindex", "-blockfilterindex"])
+ self.wait_until(lambda: all(i["synced"] for i in node.getindexinfo().values()))
+
+ # Returns a list of all running indices by default
+ assert_equal(
+ node.getindexinfo(),
+ {
+ "txindex": {"synced": True, "best_block_height": 200},
+ "basic block filter index": {"synced": True, "best_block_height": 200}
+ }
+ )
+
+ # Specifying an index by name returns only the status of that index
+ assert_equal(
+ node.getindexinfo("txindex"),
+ {
+ "txindex": {"synced": True, "best_block_height": 200},
+ }
+ )
+
+ # Specifying an unknown index name returns an empty result
+ assert_equal(node.getindexinfo("foo"), {})
+
if __name__ == '__main__':
RpcMiscTest().main()