mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
2da9982e55
aaaaad6ac95b402fe18d019d67897ced6b316ee0 scripted-diff: Bump copyright of files changed in 2019 (MarcoFalke)
Pull request description:
ACKs for top commit:
practicalswift:
ACK aaaaad6ac95b402fe18d019d67897ced6b316ee0
promag:
ACK aaaaad6ac95b402fe18d019d67897ced6b316ee0 🎉
fanquake:
ACK aaaaad6ac95b402fe18d019d67897ced6b316ee0 - going to merge this now because the year is over and conflicts are minimal.
Tree-SHA512: 58cb1f53bc4c1395b2766f36fabc7e2332e213780a802762fff0afd59468dad0c3265f553714d761c7a2c44ff90f7dc250f04458f4b2eb8eef8b94f8c9891321
41 lines
1.7 KiB
Python
Executable File
41 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2017-2019 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test the -uacomment option."""
|
|
|
|
import re
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.test_node import ErrorMatch
|
|
from test_framework.util import assert_equal
|
|
|
|
|
|
class UacommentTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.num_nodes = 1
|
|
self.setup_clean_chain = True
|
|
|
|
def run_test(self):
|
|
self.log.info("test multiple -uacomment")
|
|
test_uacomment = self.nodes[0].getnetworkinfo()["subversion"][-12:-1]
|
|
assert_equal(test_uacomment, "(testnode0)")
|
|
|
|
self.restart_node(0, ["-uacomment=foo"])
|
|
foo_uacomment = self.nodes[0].getnetworkinfo()["subversion"][-17:-1]
|
|
assert_equal(foo_uacomment, "(testnode0; foo)")
|
|
|
|
self.log.info("test -uacomment max length")
|
|
self.stop_node(0)
|
|
expected = r"Error: Total length of network version string \([0-9]+\) exceeds maximum length \(256\). Reduce the number or size of uacomments."
|
|
self.nodes[0].assert_start_raises_init_error(["-uacomment=" + 'a' * 256], expected, match=ErrorMatch.FULL_REGEX)
|
|
|
|
self.log.info("test -uacomment unsafe characters")
|
|
for unsafe_char in ['/', ':', '(', ')', '₿', '🏃']:
|
|
expected = r"Error: User Agent comment \(" + re.escape(unsafe_char) + r"\) contains unsafe characters."
|
|
self.nodes[0].assert_start_raises_init_error(["-uacomment=" + unsafe_char], expected, match=ErrorMatch.FULL_REGEX)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
UacommentTest().main()
|