src.persistence

Functionality for storing and retrieving the miner state on disk.

Classes

ChainBuilder(protocol) The chain builder maintains the current longest confirmed (primary) block chain as well as only partially downloaded longer chains that might become the new primary block chain once completed and verified.
Condition([lock]) Class that implements a condition variable.
Persistence(path, chainbuilder) Functionality for storing and retrieving the miner state on disk.
TextIOWrapper Character and line based layer over a BufferedIOBase object, buffer.
Thread([group, target, name, args, kwargs, ...]) A class that represents a thread of control.
timedelta Difference between two datetime values.
class src.persistence.Persistence(path, chainbuilder)

Functionality for storing and retrieving the miner state on disk.

Right now, this class stores the connected peers, the blocks in the primary block chain and the unconfirmed transactions in a gzip-compressed file in JSON format. These are dumped whenever the primary block chain changes or a new unconfirmed transaction is received, but at most every PERSISTENCE_MIN_INTERVAL time steps.

Parameters:
  • path (str) – The path to the storage location.
  • chainbuilder (ChainBuilder) – The chainbuilder to persist.
load()

Loads data from disk.

store()

Asynchronously stores current data to disk.

Used as an event handler in the chainbuilder.