fix estimate_timestamp
This commit is contained in:
parent
a86388f6de
commit
ac01a17214
2 changed files with 5 additions and 1 deletions
|
@ -22,7 +22,8 @@ class ElasticSyncDB(SecondaryDB):
|
||||||
if height in self.block_timestamp_cache:
|
if height in self.block_timestamp_cache:
|
||||||
return self.block_timestamp_cache[height]
|
return self.block_timestamp_cache[height]
|
||||||
header = self.prefix_db.header.get(height, deserialize_value=False)
|
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
|
self.block_timestamp_cache[height] = timestamp
|
||||||
return timestamp
|
return timestamp
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,9 @@ class LBCMainNet:
|
||||||
proportionalDelayFactor = 32
|
proportionalDelayFactor = 32
|
||||||
maxTakeoverDelay = 4032
|
maxTakeoverDelay = 4032
|
||||||
|
|
||||||
|
averageBlockOffset = 160.31130145580738
|
||||||
|
genesisTime = 1466660400
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def sanitize_url(cls, url):
|
def sanitize_url(cls, url):
|
||||||
# Remove surrounding ws and trailing /s
|
# Remove surrounding ws and trailing /s
|
||||||
|
|
Loading…
Reference in a new issue