Merge pull request #1709 from nspcc-dev/network-fixes-for-preview5
Network fixes for preview5
This commit is contained in:
commit
d138ed731c
2 changed files with 10 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 1951352142
|
||||
Magic: 894448462
|
||||
MaxTraceableBlocks: 2102400
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
|
|
|
@ -86,6 +86,7 @@ type (
|
|||
transactions chan *transaction.Transaction
|
||||
|
||||
consensusStarted *atomic.Bool
|
||||
canHandleExtens *atomic.Bool
|
||||
|
||||
oracle *oracle.Oracle
|
||||
|
||||
|
@ -131,6 +132,7 @@ func newServerFromConstructors(config ServerConfig, chain blockchainer.Blockchai
|
|||
unregister: make(chan peerDrop),
|
||||
peers: make(map[Peer]bool),
|
||||
consensusStarted: atomic.NewBool(false),
|
||||
canHandleExtens: atomic.NewBool(false),
|
||||
extensiblePool: extpool.New(chain),
|
||||
log: log,
|
||||
transactions: make(chan *transaction.Transaction, 64),
|
||||
|
@ -786,6 +788,12 @@ func (s *Server) handleGetHeadersCmd(p Peer, gh *payload.GetBlockByIndex) error
|
|||
|
||||
// handleExtensibleCmd processes received extensible payload.
|
||||
func (s *Server) handleExtensibleCmd(e *payload.Extensible) error {
|
||||
if !s.canHandleExtens.Load() {
|
||||
if !s.IsInSync() {
|
||||
return nil
|
||||
}
|
||||
s.canHandleExtens.Store(true)
|
||||
}
|
||||
ok, err := s.extensiblePool.Add(e)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -796,6 +804,7 @@ func (s *Server) handleExtensibleCmd(e *payload.Extensible) error {
|
|||
switch e.Category {
|
||||
case consensus.Category:
|
||||
s.consensus.OnPayload(e)
|
||||
case "StateService": // no-op for now
|
||||
default:
|
||||
return errors.New("invalid category")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue