mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
merge bitcoin#28645: fix assert_debug_log
call-site bugs, add type checks
This commit is contained in:
parent
deaee147b7
commit
6a4ca62fd1
@ -302,7 +302,7 @@ class DashGovernanceTest (DashTestFramework):
|
||||
|
||||
self.log.info("Move a few block past the recent superblock height and make sure we have no new votes")
|
||||
for _ in range(5):
|
||||
with self.nodes[1].assert_debug_log("", [f"Voting NO-FUNDING for trigger:{winning_trigger_hash} success"]):
|
||||
with self.nodes[1].assert_debug_log(expected_msgs=[""], unexpected_msgs=[f"Voting NO-FUNDING for trigger:{winning_trigger_hash} success"]):
|
||||
self.bump_mocktime(1)
|
||||
self.generate(self.nodes[0], 1, sync_fun=self.sync_blocks())
|
||||
# Votes on both triggers should NOT change
|
||||
|
@ -145,7 +145,7 @@ class V2TransportTest(BitcoinTestFramework):
|
||||
wrong_network_magic_prefix = MAGIC_BYTES["mainnet"] + V1_PREFIX[4:]
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
s.connect(("127.0.0.1", p2p_port(0)))
|
||||
with self.nodes[0].assert_debug_log("V2 transport error: V1 peer with wrong MessageStart"):
|
||||
with self.nodes[0].assert_debug_log(["V2 transport error: V1 peer with wrong MessageStart"]):
|
||||
s.sendall(wrong_network_magic_prefix + b"somepayload")
|
||||
|
||||
# Check detection of missing garbage terminator (hits after fixed amount of data if terminator never matches garbage)
|
||||
@ -156,7 +156,7 @@ class V2TransportTest(BitcoinTestFramework):
|
||||
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == num_peers + 1)
|
||||
s.sendall(b'\x00' * (MAX_KEY_GARB_AND_GARBTERM_LEN - 1))
|
||||
self.wait_until(lambda: self.nodes[0].getpeerinfo()[-1]["bytesrecv"] == MAX_KEY_GARB_AND_GARBTERM_LEN - 1)
|
||||
with self.nodes[0].assert_debug_log("V2 transport error: missing garbage terminator"):
|
||||
with self.nodes[0].assert_debug_log(["V2 transport error: missing garbage terminator"]):
|
||||
s.sendall(b'\x00') # send out last byte
|
||||
# should disconnect immediately
|
||||
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == num_peers)
|
||||
|
@ -427,6 +427,9 @@ class TestNode():
|
||||
def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2):
|
||||
if unexpected_msgs is None:
|
||||
unexpected_msgs = []
|
||||
assert_equal(type(expected_msgs), list)
|
||||
assert_equal(type(unexpected_msgs), list)
|
||||
|
||||
time_end = time.time() + timeout * self.timeout_factor
|
||||
prev_size = self.debug_log_bytes()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user