瀏覽代碼

RPC: get chain only once, for thread safety

Malte Kraus 8 年之前
父節點
當前提交
de39eba80e
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      miner.py

+ 3 - 2
miner.py

@@ -85,13 +85,14 @@ def rpc_server(port, chainbuilder, persist):
         key = Signing(flask.request.data)
         transactions = set()
         outputs = set()
-        for b in chainbuilder.primary_block_chain.blocks:
+        chain = chainbuilder.primary_block_chain
+        for b in chain.blocks:
             for t in b.transactions:
                 for i, target in enumerate(t.targets):
                     if target.recipient_pk == key:
                         transactions.add(t)
                         outputs.add(TransactionInput(t.get_hash(), i))
-        for b in chainbuilder.primary_block_chain.blocks:
+        for b in chain.blocks:
             for t in b.transactions:
                 for inp in t.inputs:
                     if inp in outputs: