This commit is contained in:
Amaury Chamayou 2021-04-29 09:08:48 +01:00 коммит произвёл GitHub
Родитель 2d5c03a936
Коммит d93d02c549
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -1 +1 @@
quack coal

Просмотреть файл

@ -29,7 +29,7 @@ class Consortium:
share_script, share_script,
members_info=None, members_info=None,
curve=None, curve=None,
network=None, public_state=None,
authenticate_session=True, authenticate_session=True,
): ):
self.common_dir = common_dir self.common_dir = common_dir
@ -77,10 +77,8 @@ class Consortium:
f"Successfully recovered member {local_id}: {new_member.service_id}" f"Successfully recovered member {local_id}: {new_member.service_id}"
) )
# Retrieve state of service directly from ledger
latest_public_state, _ = network.get_latest_ledger_public_state()
self.recovery_threshold = json.loads( self.recovery_threshold = json.loads(
latest_public_state["public:ccf.gov.service.config"][ public_state["public:ccf.gov.service.config"][
ccf.ledger.WELL_KNOWN_SINGLETON_TABLE_KEY ccf.ledger.WELL_KNOWN_SINGLETON_TABLE_KEY
] ]
)["recovery_threshold"] )["recovery_threshold"]
@ -89,7 +87,7 @@ class Consortium:
LOG.warning("No consortium member to recover") LOG.warning("No consortium member to recover")
return return
for id_bytes, info_bytes in latest_public_state[ for id_bytes, info_bytes in public_state[
"public:ccf.gov.members.info" "public:ccf.gov.members.info"
].items(): ].items():
member_id = id_bytes.decode() member_id = id_bytes.decode()

Просмотреть файл

@ -10,7 +10,7 @@ import infra.path
import infra.proc import infra.proc
import infra.node import infra.node
import infra.consortium import infra.consortium
from ccf.ledger import NodeStatus from ccf.ledger import NodeStatus, Ledger
from ccf.tx_status import TxStatus from ccf.tx_status import TxStatus
from ccf.tx_id import TxID from ccf.tx_id import TxID
import random import random
@ -430,6 +430,12 @@ class Network:
self.common_dir = common_dir or get_common_folder_name( self.common_dir = common_dir or get_common_folder_name(
args.workspace, args.label args.workspace, args.label
) )
ledger_dirs = [ledger_dir]
if committed_ledger_dir:
ledger_dirs.append(committed_ledger_dir)
ledger = Ledger(ledger_dirs, committed_only=False)
public_state, _ = ledger.get_latest_public_state()
primary = self._start_all_nodes( primary = self._start_all_nodes(
args, args,
@ -442,7 +448,10 @@ class Network:
# If a common directory was passed in, initialise the consortium from it # If a common directory was passed in, initialise the consortium from it
if common_dir is not None: if common_dir is not None:
self.consortium = infra.consortium.Consortium( self.consortium = infra.consortium.Consortium(
common_dir, self.key_generator, self.share_script, network=self common_dir,
self.key_generator,
self.share_script,
public_state=public_state,
) )
for node in self.get_joined_nodes(): for node in self.get_joined_nodes():