Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | List of all members
coordinator.null_contribution_handler.NullContributionHandler Class Reference
Inheritance diagram for coordinator.null_contribution_handler.NullContributionHandler:
Inheritance graph
[legend]
Collaboration diagram for coordinator.null_contribution_handler.NullContributionHandler:
Collaboration graph
[legend]

Public Member Functions

str get_current_challenge_file (self, int _next_contributor_idx)
 
bool process_contribution (self, int _contributionn_idx, str file_name)
 
None on_completed (self)
 

Detailed Description

A null handler that accepts contributions and simply stores them as
subsequent challenges. When the MPC has completed, the latest contribution
is moved to 'final-upload'. Can be used for testing coordinator
configuration (certificate setup, etc).

Definition at line 16 of file null_contribution_handler.py.

Member Function Documentation

◆ get_current_challenge_file()

str coordinator.null_contribution_handler.NullContributionHandler.get_current_challenge_file (   self,
int  contributor_idx 
)
Return the location of the current challenge to serve.

Reimplemented from coordinator.icontributionhandler.IContributionHandler.

Definition at line 24 of file null_contribution_handler.py.

24  def get_current_challenge_file(self, _next_contributor_idx: int) -> str:
25  return CONTRIBUTION_FILE_NAME
26 

◆ on_completed()

None coordinator.null_contribution_handler.NullContributionHandler.on_completed (   self)
All contributions have been received and the MPC is complete.

Reimplemented from coordinator.icontributionhandler.IContributionHandler.

Definition at line 32 of file null_contribution_handler.py.

32  def on_completed(self) -> None:
33  assert not os.path.exists(FINAL_FILE_NAME)
34  if os.path.exists(CONTRIBUTION_FILE_NAME):
35  os.rename(CONTRIBUTION_FILE_NAME, FINAL_FILE_NAME)
36  else:
37  print("WARNING: no contributions found")

◆ process_contribution()

bool coordinator.null_contribution_handler.NullContributionHandler.process_contribution (   self,
int  contribution_idx,
str  file_name 
)
Process the given uploaded file as a contribution. If any errors are
found, throw an exception with an appropriate message, or return false.

Reimplemented from coordinator.icontributionhandler.IContributionHandler.

Definition at line 27 of file null_contribution_handler.py.

27  def process_contribution(
28  self, _contributionn_idx: int, file_name: str) -> bool:
29  os.rename(file_name, CONTRIBUTION_FILE_NAME)
30  return True
31 

The documentation for this class was generated from the following file: