mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 01:35:20 +00:00
discard channel updates too far in the future, or too close apart (see #6124)
This commit is contained in:
parent
1322fa6a08
commit
ac67f7ae30
1 changed files with 3 additions and 1 deletions
|
@ -404,6 +404,8 @@ class ChannelDB(SqlDB):
|
||||||
timestamp = payload['timestamp']
|
timestamp = payload['timestamp']
|
||||||
if max_age and now - timestamp > max_age:
|
if max_age and now - timestamp > max_age:
|
||||||
return UpdateStatus.EXPIRED
|
return UpdateStatus.EXPIRED
|
||||||
|
if timestamp - now > 60:
|
||||||
|
return UpdateStatus.DEPRECATED
|
||||||
channel_info = self._channels.get(short_channel_id)
|
channel_info = self._channels.get(short_channel_id)
|
||||||
if not channel_info:
|
if not channel_info:
|
||||||
return UpdateStatus.ORPHANED
|
return UpdateStatus.ORPHANED
|
||||||
|
@ -417,7 +419,7 @@ class ChannelDB(SqlDB):
|
||||||
short_channel_id = ShortChannelID(payload['short_channel_id'])
|
short_channel_id = ShortChannelID(payload['short_channel_id'])
|
||||||
key = (start_node, short_channel_id)
|
key = (start_node, short_channel_id)
|
||||||
old_policy = self._policies.get(key)
|
old_policy = self._policies.get(key)
|
||||||
if old_policy and timestamp <= old_policy.timestamp:
|
if old_policy and timestamp <= old_policy.timestamp + 60:
|
||||||
return UpdateStatus.DEPRECATED
|
return UpdateStatus.DEPRECATED
|
||||||
if verify:
|
if verify:
|
||||||
self.verify_channel_update(payload)
|
self.verify_channel_update(payload)
|
||||||
|
|
Loading…
Add table
Reference in a new issue