@@ -271,32 +271,31 @@ def add_transaction(self, transaction):
271
271
assert self .head_candidate is not None
272
272
_log = log .bind (tx_hash = transaction )
273
273
_log .debug ("add transaction" )
274
- with self .lock :
275
- old_state_root = self .head_candidate .state_root
276
- # revert finalization
277
- self .head_candidate .state_root = self .pre_finalize_state_root
278
- try :
279
- success , output = processblock .apply_transaction (self .head_candidate , transaction )
280
- except processblock .InvalidTransaction as e :
281
- # if unsuccessful the prerequisites were not fullfilled
282
- # and the tx is invalid, state must not have changed
283
- log .debug ('invalid tx' , tx_hash = transaction , errors = e )
284
- success = False
285
-
286
- # finalize
287
- self .pre_finalize_state_root = self .head_candidate .state_root
288
- self .head_candidate .finalize ()
289
-
290
- if not success :
291
- log .debug ('tx not applied' , tx_hash = transaction )
292
- assert old_state_root == self .head_candidate .state_root
293
- return False
294
- else :
295
- assert transaction in self .get_transactions ()
296
- log .debug ('transaction applied' , tx_hash = transaction ,
297
- block_hash = self .head_candidate , result = output )
298
- assert old_state_root != self .head_candidate .state_root
299
- return True
274
+ old_state_root = self .head_candidate .state_root
275
+ # revert finalization
276
+ self .head_candidate .state_root = self .pre_finalize_state_root
277
+ try :
278
+ success , output = processblock .apply_transaction (self .head_candidate , transaction )
279
+ except processblock .InvalidTransaction as e :
280
+ # if unsuccessful the prerequisites were not fullfilled
281
+ # and the tx is invalid, state must not have changed
282
+ log .debug ('invalid tx' , tx_hash = transaction , errors = e )
283
+ success = False
284
+
285
+ # finalize
286
+ self .pre_finalize_state_root = self .head_candidate .state_root
287
+ self .head_candidate .finalize ()
288
+
289
+ if not success :
290
+ log .debug ('tx not applied' , tx_hash = transaction )
291
+ assert old_state_root == self .head_candidate .state_root
292
+ return False
293
+ else :
294
+ assert transaction in self .get_transactions ()
295
+ log .debug ('transaction applied' , tx_hash = transaction ,
296
+ block_hash = self .head_candidate , result = output )
297
+ assert old_state_root != self .head_candidate .state_root
298
+ return True
300
299
301
300
def get_transactions (self ):
302
301
"""Get a list of new transactions not yet included in a mined block
0 commit comments