mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-23 22:42:32 +00:00

* [NOD-1191] Convert wire protocol to 100% protobuf * [NOD-1191] Simplify wire interface and remove redundant messages * [NOD-1191] Map all proto to wire conversions * [NOD-1203] Create netadapter outside of protocol manager * [NOD-1191] Fix nil errors * [NOD-1191] Fix comments * [NOD-1191] Add converter interface * [NOD-1191] Add missing GetBlockLocator message * [NOD-1191] Change message names that starts with 'get' to 'request' * [NOD-1191] Change message commands values * [NOD-1191] Remove redundant methods * [NOD-1191] Rename message constructors * [NOD-1191] Change message commands to use iota * [NOD-1191] Add missing outputs to protobuf conversion * [NOD-1191] Make block header a required field * [NOD-1191] Rename variables * [NOD-1212] Fix test names * [NOD-1191] Rename flow names * [NOD-1191] Fix infinite loop
31 lines
919 B
Go
31 lines
919 B
Go
package wire
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/util/daghash"
|
|
)
|
|
|
|
// MaxBlockLocatorsPerMsg is the maximum number of block locator hashes allowed
|
|
// per message.
|
|
const MaxBlockLocatorsPerMsg = 500
|
|
|
|
// MsgBlockLocator implements the Message interface and represents a kaspa
|
|
// locator message. It is used to find the blockLocator of a peer that is
|
|
// syncing with you.
|
|
type MsgBlockLocator struct {
|
|
BlockLocatorHashes []*daghash.Hash
|
|
}
|
|
|
|
// Command returns the protocol command string for the message. This is part
|
|
// of the Message interface implementation.
|
|
func (msg *MsgBlockLocator) Command() MessageCommand {
|
|
return CmdBlockLocator
|
|
}
|
|
|
|
// NewMsgBlockLocator returns a new kaspa locator message that conforms to
|
|
// the Message interface. See MsgBlockLocator for details.
|
|
func NewMsgBlockLocator(locatorHashes []*daghash.Hash) *MsgBlockLocator {
|
|
return &MsgBlockLocator{
|
|
BlockLocatorHashes: locatorHashes,
|
|
}
|
|
}
|