diff --git a/lib/functions.py b/lib/functions.py index c7124db412ea0429d095d15c5043a61ddb60bb63..2c92def6215c570a7d627a33892f7ab9e57b970a 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -10,7 +10,7 @@ from adapters.duniter_v18.wallets import LevelDBWalletsRepository from adapters.duniter_v18.ud_value import LevelDBUDValueRepository # Constant to estimate cert interval -CERT_PERIOD = 432000 # 5 * 24 * 3600 # 5 days +CERT_PERIOD = 432000 # 5 * 24 * 3600 # 5 days # when iterating on blocks, log current block every NOTIF_INTERVAL NOTIF_INTERVAL = 100000 @@ -91,7 +91,6 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple # add missing money to treasury treasury += missing_money - # TODO make sure that index respects order of arrival # Get identities names by pubkey for pubkey, identity in identities_repository: index = identity["wotb_id"] + 1 @@ -172,11 +171,12 @@ def get_blocks(leveldb_path: str) -> list: True and not block.get("certifications") and not block.get("transactions") - and not block.get("joiners") # TODO membership events - and not block.get("leavers") # TODO membership events - and not block.get("revoked") # TODO membership events - and not block.get("actives") # TODO membership events - and not block.get("excluded") # TODO membership events + # TODO handle membership events below + and not block.get("joiners") + and not block.get("leavers") + and not block.get("revoked") + and not block.get("actives") + and not block.get("excluded") ) sample = { "height": block.get("number"), @@ -246,12 +246,14 @@ def get_cert(leveldb_path: str) -> list: For this, re-index the blockchain v1 """ # initialize - CERTVALIDITY = 63115200 # 3600 * 24 * 365.25 * 2 validity of certification in seconds (2 years) - cert_should_expire = {} # maps (issuer, receiver) to expiration timestamp - may_expire = collections.deque() # queue of (expire, (issuer, receiver)), should be ordered by expire timestamp - cert_events = [] # cert events returned by this function (Creation, Renewal, Removal) - identity_id = {} # maps pubkey to identity index - blockMedianTime = [] # medianTime of the block n at position n + CERTVALIDITY = 63115200 # 3600 * 24 * 365.25 * 2 validity of certification in seconds (2 years) + cert_should_expire = {} # maps (issuer, receiver) to expiration timestamp + # queue of (expire, (issuer, receiver)), should be ordered by expire timestamp + may_expire = collections.deque() + # cert events returned by this function (Creation, Renewal, Removal) + cert_events = [] + identity_id = {} # maps pubkey to identity index + blockMedianTime = [] # medianTime of the block n at position n # repos blocks_repo = LevelDBBlocksRepository(leveldb_path) identities_repository = LevelDBIdentitiesRepository(leveldb_path) @@ -322,4 +324,4 @@ def get_cert(leveldb_path: str) -> list: "type": optype, } cert_events.append(sample) - return cert_events \ No newline at end of file + return cert_events