@@ -110,6 +110,41 @@ def run(args):
110110 assert new_node
111111 network .wait_for_node_commit_sync (args .consensus )
112112
113+ LOG .info ("Remove first code id" )
114+ network .consortium .retire_code (new_node , first_code_id )
115+
116+ with new_node .client () as uc :
117+ r = uc .get ("/node/code" )
118+ versions = sorted (r .body ["versions" ], key = lambda x : x ["digest" ])
119+ expected = sorted (
120+ [
121+ {"digest" : first_code_id , "status" : "RETIRED" },
122+ {"digest" : new_code_id , "status" : "ACCEPTED" },
123+ ],
124+ key = lambda x : x ["digest" ],
125+ )
126+ assert versions == expected , versions
127+
128+ LOG .info (f"Adding a node with retired code id { first_code_id } " )
129+ code_not_found_exception = None
130+ try :
131+ network .create_and_add_pending_node (
132+ args .package , "localhost" , args , timeout = 3
133+ )
134+ except infra .network .CodeIdRetired as err :
135+ code_not_found_exception = err
136+
137+ assert (
138+ code_not_found_exception is not None
139+ ), f"Adding a node with unsupported code id { new_code_id } should fail"
140+
141+ LOG .info ("Adding another node with the new code to the network" )
142+ new_node = network .create_and_trust_node (
143+ args .patched_file_name , "localhost" , args
144+ )
145+ assert new_node
146+ network .wait_for_node_commit_sync (args .consensus )
147+
113148
114149if __name__ == "__main__" :
115150
0 commit comments