mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-16 18:37:51 +01:00
Send Announcement instead of ping in case blockchain info was not refreshed within a certain threshold. This helps to keep the global blockchain cache active, with no additional overhead. Close #78
This commit is contained in:
@@ -180,6 +180,7 @@ func (nets *Networks) packetWorker() {
|
||||
isBlockchainUpdate := peer.BlockchainHeight != announce.BlockchainHeight || peer.BlockchainVersion != announce.BlockchainVersion
|
||||
peer.BlockchainHeight = announce.BlockchainHeight
|
||||
peer.BlockchainVersion = announce.BlockchainVersion
|
||||
peer.blockchainLastRefresh = time.Now()
|
||||
|
||||
Filters.MessageIn(peer, raw, announce)
|
||||
|
||||
@@ -215,6 +216,7 @@ func (nets *Networks) packetWorker() {
|
||||
isBlockchainUpdate := peer.BlockchainHeight != response.BlockchainHeight || peer.BlockchainVersion != response.BlockchainVersion
|
||||
peer.BlockchainHeight = response.BlockchainHeight
|
||||
peer.BlockchainVersion = response.BlockchainVersion
|
||||
peer.blockchainLastRefresh = time.Now()
|
||||
|
||||
Filters.MessageIn(peer, raw, response)
|
||||
|
||||
@@ -235,6 +237,7 @@ func (nets *Networks) packetWorker() {
|
||||
isBlockchainUpdate := peer.BlockchainHeight != announce.BlockchainHeight || peer.BlockchainVersion != announce.BlockchainVersion
|
||||
peer.BlockchainHeight = announce.BlockchainHeight
|
||||
peer.BlockchainVersion = announce.BlockchainVersion
|
||||
peer.blockchainLastRefresh = time.Now()
|
||||
|
||||
Filters.MessageIn(peer, raw, announce)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user