Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115704
D11610.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D11610.diff
View Options
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1399,6 +1399,12 @@
"requires coinstatsindex");
}
+ if (stats.m_hash_type == CoinStatsHashType::HASH_SERIALIZED) {
+ throw JSONRPCError(RPC_INVALID_PARAMETER,
+ "hash_serialized hash type cannot be "
+ "queried for a specific block");
+ }
+
pindex = ParseHashOrHeight(request.params[1], chainman);
}
diff --git a/test/functional/feature_coinstatsindex.py b/test/functional/feature_coinstatsindex.py
--- a/test/functional/feature_coinstatsindex.py
+++ b/test/functional/feature_coinstatsindex.py
@@ -42,6 +42,7 @@
self._test_coin_stats_index()
self._test_use_index_option()
self._test_reorg_index()
+ self._test_index_rejects_hash_serialized()
def block_sanity_check(self, block_info):
block_subsidy = 50_000_000
@@ -332,6 +333,21 @@
assert_raises_rpc_error(-32603, "Unable to read UTXO set",
node.gettxoutsetinfo, 'muhash', reorg_block)
+ def _test_index_rejects_hash_serialized(self):
+ self.log.info(
+ "Test that the rpc raises if the legacy hash is passed with the index")
+
+ msg = "hash_serialized hash type cannot be queried for a specific block"
+ assert_raises_rpc_error(-8, msg,
+ self.nodes[1].gettxoutsetinfo,
+ hash_type='hash_serialized', hash_or_height=111)
+
+ for use_index in {True, False, None}:
+ assert_raises_rpc_error(-8, msg,
+ self.nodes[1].gettxoutsetinfo,
+ hash_type='hash_serialized',
+ hash_or_height=111, use_index=use_index)
+
if __name__ == '__main__':
CoinStatsIndexTest().main()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:47 (5 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5182716
Default Alt Text
D11610.diff (2 KB)
Attached To
D11610: rpc: gettxoutsetinfo rejects hash_serialized for specific height
Event Timeline
Log In to Comment