mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
8d8e41cd85
* call bufio.Flush * rerun ci * handle errors better * correct sleep
37 lines
914 B
Go
37 lines
914 B
Go
package eth
|
|
|
|
import (
|
|
"github.com/ledgerwatch/turbo-geth/p2p"
|
|
)
|
|
|
|
// MGR (aka Merry-Go-Round) protocol - providing capabilities of swarm-based-full-sync
|
|
// At a high level, MGR operates by enumerating the full state in a predetermined order
|
|
// and gossiping this data among the clients which are actively syncing.
|
|
// For a client to fully sync it needs to “ride” one full rotation of the merry-go-round.
|
|
|
|
const (
|
|
mgr1 = 1
|
|
)
|
|
|
|
const MGRName = "mgr" // Parity only supports 3 letter capabilities
|
|
var MGRVersions = []uint{mgr1}
|
|
var MGRLengths = map[uint]uint64{mgr1: 2}
|
|
|
|
const MGRMaxMsgSize = 10 * 1024 * 1024
|
|
|
|
const (
|
|
MGRStatus = 0x00
|
|
MGRWitness = 0x01
|
|
)
|
|
|
|
type mgrPeer struct {
|
|
*p2p.Peer
|
|
rw p2p.MsgReadWriter
|
|
}
|
|
|
|
// SendByteCode sends a BytecodeCode message.
|
|
func (p *mgrPeer) SendByteCode(id uint64, data [][]byte) error {
|
|
msg := bytecodeMsg{ID: id, Code: data}
|
|
return p2p.Send(p.rw, BytecodeCode, msg)
|
|
}
|