fix estimate_timestamp

This commit is contained in:
Jack Robison 2022-06-27 18:52:37 -04:00
parent a86388f6de
commit ac01a17214
2 changed files with 5 additions and 1 deletions

View file

@ -22,7 +22,8 @@ class ElasticSyncDB(SecondaryDB):
if height in self.block_timestamp_cache:
return self.block_timestamp_cache[height]
header = self.prefix_db.header.get(height, deserialize_value=False)
timestamp = int(160.6855883050695 * height) if header else int.from_bytes(header[100:104], byteorder='little')
timestamp = int(self.coin.genesisTime + (self.coin.averageBlockOffset * height)) \
if not header else int.from_bytes(header[100:104], byteorder='little')
self.block_timestamp_cache[height] = timestamp
return timestamp

View file

@ -58,6 +58,9 @@ class LBCMainNet:
proportionalDelayFactor = 32
maxTakeoverDelay = 4032
averageBlockOffset = 160.31130145580738
genesisTime = 1466660400
@classmethod
def sanitize_url(cls, url):
# Remove surrounding ws and trailing /s