mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
rpc: return warnings as an array instead of just a single one
The RPC documentation for `getblockchaininfo`, `getmininginfo` and `getnetworkinfo` states that "warnings" returns "any network and blockchain warnings". In practice, only a single warning is returned. Fix that by returning all warnings as an array. As a side benefit, cleans up the GetWarnings() logic.
This commit is contained in:
@ -73,8 +73,8 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
self.generatetoaddress(node, VB_PERIOD - VB_THRESHOLD + 1, node_deterministic_address)
|
||||
|
||||
# Check that we're not getting any versionbit-related errors in get*info()
|
||||
assert not VB_PATTERN.match(node.getmininginfo()["warnings"])
|
||||
assert not VB_PATTERN.match(node.getnetworkinfo()["warnings"])
|
||||
assert not VB_PATTERN.match(",".join(node.getmininginfo()["warnings"]))
|
||||
assert not VB_PATTERN.match(",".join(node.getnetworkinfo()["warnings"]))
|
||||
|
||||
# Build one period of blocks with VB_THRESHOLD blocks signaling some unknown bit
|
||||
self.send_blocks_with_version(peer, VB_THRESHOLD, VB_UNKNOWN_VERSION)
|
||||
@ -94,8 +94,8 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
# Generating one more block will be enough to generate an error.
|
||||
self.generatetoaddress(node, 1, node_deterministic_address)
|
||||
# Check that get*info() shows the versionbits unknown rules warning
|
||||
assert WARN_UNKNOWN_RULES_ACTIVE in node.getmininginfo()["warnings"]
|
||||
assert WARN_UNKNOWN_RULES_ACTIVE in node.getnetworkinfo()["warnings"]
|
||||
assert WARN_UNKNOWN_RULES_ACTIVE in ",".join(node.getmininginfo()["warnings"])
|
||||
assert WARN_UNKNOWN_RULES_ACTIVE in ",".join(node.getnetworkinfo()["warnings"])
|
||||
# Check that the alert file shows the versionbits unknown rules warning
|
||||
self.wait_until(lambda: self.versionbits_in_alert_file())
|
||||
|
||||
|
Reference in New Issue
Block a user