diff --git a/chia/protocols/protocol_state_machine.py b/chia/protocols/protocol_state_machine.py index 1428d2387aa2..dcf3791a2521 100644 --- a/chia/protocols/protocol_state_machine.py +++ b/chia/protocols/protocol_state_machine.py @@ -8,7 +8,7 @@ NO_REPLY_EXPECTED = [ pmt.new_signage_point_or_end_of_sub_slot, pmt.request_mempool_transactions, pmt.new_compact_vdf, - pmt.request_mempool_transactions, + pmt.coin_state_update, ] """ @@ -28,11 +28,20 @@ VALID_REPLY_MESSAGE_MAP = { pmt.request_blocks: [pmt.respond_blocks, pmt.reject_blocks], pmt.request_unfinished_block: [pmt.respond_unfinished_block], pmt.request_block_header: [pmt.respond_block_header, pmt.reject_header_request], + pmt.request_removals: [pmt.respond_removals, pmt.reject_removals_request], + pmt.request_additions: [pmt.respond_additions, pmt.reject_additions_request], pmt.request_signage_point_or_end_of_sub_slot: [pmt.respond_signage_point, pmt.respond_end_of_sub_slot], pmt.request_compact_vdf: [pmt.respond_compact_vdf], pmt.request_peers: [pmt.respond_peers], pmt.request_header_blocks: [pmt.respond_header_blocks, pmt.reject_header_blocks], + pmt.register_interest_in_puzzle_hash: [pmt.respond_to_ph_update], + pmt.register_interest_in_coin: [pmt.respond_to_coin_update], + pmt.request_children: [pmt.respond_children], + pmt.request_ses_hashes: [pmt.respond_ses_hashes], pmt.request_block_headers: [pmt.respond_block_headers, pmt.reject_block_headers], + pmt.request_peers_introducer: [pmt.respond_peers_introducer], + pmt.request_puzzle_solution: [pmt.respond_puzzle_solution, pmt.reject_puzzle_solution], + pmt.send_transaction: [pmt.transaction_ack], } @@ -57,8 +66,7 @@ def message_response_ok(sent: ProtocolMessageTypes, received: ProtocolMessageTyp """ # Errors below are runtime protocol message mismatches from peers if sent in VALID_REPLY_MESSAGE_MAP: - if received not in VALID_REPLY_MESSAGE_MAP[sent]: - return False + return received in VALID_REPLY_MESSAGE_MAP[sent] return True diff --git a/tests/util/test_network_protocol_test.py b/tests/util/test_network_protocol_test.py index 4cecae3153d4..6926e736a497 100644 --- a/tests/util/test_network_protocol_test.py +++ b/tests/util/test_network_protocol_test.py @@ -33,7 +33,7 @@ def test_missing_messages_state_machine() -> None: # to the visitor in build_network_protocol_files.py and rerun it. Then # update this test assert ( - len(VALID_REPLY_MESSAGE_MAP) == 11 + len(VALID_REPLY_MESSAGE_MAP) == 20 ), "A message was added to the protocol state machine. Make sure to update the protocol message regression test to include the new message" assert ( len(NO_REPLY_EXPECTED) == 7