Skip to content

Commit 0043318

Browse files
UdjinM6claude
andcommitted
feat: add async indexes to getindexinfo RPC
Add addressindex, timestampindex, and spentindex to getindexinfo RPC output. Update rpc_misc.py test to verify new indexes are reported. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3997f4c commit 0043318

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/rpc/node.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <index/blockfilterindex.h>
1313
#include <index/coinstatsindex.h>
1414
#include <index/spentindex.h>
15+
#include <index/timestampindex.h>
1516
#include <index/txindex.h>
1617
#include <init.h>
1718
#include <interfaces/chain.h>
@@ -1142,6 +1143,18 @@ static RPCHelpMan getindexinfo()
11421143
result.pushKVs(SummaryToJSON(index.GetSummary(), index_name));
11431144
});
11441145

1146+
if (g_addressindex) {
1147+
result.pushKVs(SummaryToJSON(g_addressindex->GetSummary(), index_name));
1148+
}
1149+
1150+
if (g_timestampindex) {
1151+
result.pushKVs(SummaryToJSON(g_timestampindex->GetSummary(), index_name));
1152+
}
1153+
1154+
if (g_spentindex) {
1155+
result.pushKVs(SummaryToJSON(g_spentindex->GetSummary(), index_name));
1156+
}
1157+
11451158
return result;
11461159
}
11471160
};

test/functional/rpc_misc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def run_test(self):
8686
assert_equal(node.getindexinfo(), {})
8787

8888
# Restart the node with indices and wait for them to sync
89-
self.restart_node(0, ["-txindex", "-blockfilterindex", "-coinstatsindex"])
89+
self.restart_node(0, ["-txindex", "-blockfilterindex", "-coinstatsindex",
90+
"-addressindex", "-timestampindex", "-spentindex"])
9091
self.wait_until(lambda: all(i["synced"] for i in node.getindexinfo().values()))
9192

9293
# Returns a list of all running indices by default
@@ -97,10 +98,14 @@ def run_test(self):
9798
"txindex": values,
9899
"basic block filter index": values,
99100
"coinstatsindex": values,
101+
"addressindex": values,
102+
"timestampindex": values,
103+
"spentindex": values,
100104
}
101105
)
102106
# Specifying an index by name returns only the status of that index
103-
for i in {"txindex", "basic block filter index", "coinstatsindex"}:
107+
for i in {"txindex", "basic block filter index", "coinstatsindex",
108+
"addressindex", "timestampindex", "spentindex"}:
104109
assert_equal(node.getindexinfo(i), {i: values})
105110

106111
# Specifying an unknown index name returns an empty result

0 commit comments

Comments
 (0)