mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-06 22:26:47 +00:00

* [NOD-669] Remove the "get" from getBlueBlocksBetween. * [NOD-669] Remove the "Get" from GetBlueBlocksHeadersBetween. * [NOD-669] In blueBlocksBetween, rename startHash to lowHash and stopHash to highHash. * [NOD-669] Rename startHash to lowHash and stopHash to highHash in blockLocator logic. * [NOD-669] Remove zeroHash logic in blockLocator. * [NOD-669] Finish renaming startHash and stopHash in blockdag. * [NOD-669] Rename startHash and stopHash in blockdag where I previously missed it. * [NOD-669] Rename startHash and stopHash in blockdag where I previously missed it some more. * [NOD-669] Rename startHash and stopHash in blockdag where I previously missed it some more some more. * [NOD-669] Fix bad grammar in method names. * [NOD-669] Rename lowHash to blockHash in SelectedParentChain. * [NOD-669] Fix a comment.
31 lines
820 B
Go
31 lines
820 B
Go
package p2p
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/peer"
|
|
"github.com/kaspanet/kaspad/wire"
|
|
)
|
|
|
|
// OnGetBlockLocator is invoked when a peer receives a getlocator kaspa
|
|
// message.
|
|
func (sp *Peer) OnGetBlockLocator(_ *peer.Peer, msg *wire.MsgGetBlockLocator) {
|
|
locator, err := sp.server.DAG.BlockLocatorFromHashes(msg.HighHash, msg.LowHash)
|
|
if err != nil || len(locator) == 0 {
|
|
warning := fmt.Sprintf("Couldn't build a block locator between blocks "+
|
|
"%s and %s that was requested from peer %s", msg.HighHash, msg.LowHash, sp)
|
|
if err != nil {
|
|
warning = fmt.Sprintf("%s: %s", warning, err)
|
|
}
|
|
peerLog.Warnf(warning)
|
|
sp.Disconnect()
|
|
return
|
|
}
|
|
|
|
err = sp.PushBlockLocatorMsg(locator)
|
|
if err != nil {
|
|
peerLog.Errorf("Failed to send block locator message to peer %s: %s",
|
|
sp, err)
|
|
return
|
|
}
|
|
}
|