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:
|
ProtocolConfiguration:
|
||||||
Magic: 1951352142
|
Magic: 894448462
|
||||||
MaxTraceableBlocks: 2102400
|
MaxTraceableBlocks: 2102400
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
MemPoolSize: 50000
|
MemPoolSize: 50000
|
||||||
|
|
|
@ -86,6 +86,7 @@ type (
|
||||||
transactions chan *transaction.Transaction
|
transactions chan *transaction.Transaction
|
||||||
|
|
||||||
consensusStarted *atomic.Bool
|
consensusStarted *atomic.Bool
|
||||||
|
canHandleExtens *atomic.Bool
|
||||||
|
|
||||||
oracle *oracle.Oracle
|
oracle *oracle.Oracle
|
||||||
|
|
||||||
|
@ -131,6 +132,7 @@ func newServerFromConstructors(config ServerConfig, chain blockchainer.Blockchai
|
||||||
unregister: make(chan peerDrop),
|
unregister: make(chan peerDrop),
|
||||||
peers: make(map[Peer]bool),
|
peers: make(map[Peer]bool),
|
||||||
consensusStarted: atomic.NewBool(false),
|
consensusStarted: atomic.NewBool(false),
|
||||||
|
canHandleExtens: atomic.NewBool(false),
|
||||||
extensiblePool: extpool.New(chain),
|
extensiblePool: extpool.New(chain),
|
||||||
log: log,
|
log: log,
|
||||||
transactions: make(chan *transaction.Transaction, 64),
|
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.
|
// handleExtensibleCmd processes received extensible payload.
|
||||||
func (s *Server) handleExtensibleCmd(e *payload.Extensible) error {
|
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)
|
ok, err := s.extensiblePool.Add(e)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -796,6 +804,7 @@ func (s *Server) handleExtensibleCmd(e *payload.Extensible) error {
|
||||||
switch e.Category {
|
switch e.Category {
|
||||||
case consensus.Category:
|
case consensus.Category:
|
||||||
s.consensus.OnPayload(e)
|
s.consensus.OnPayload(e)
|
||||||
|
case "StateService": // no-op for now
|
||||||
default:
|
default:
|
||||||
return errors.New("invalid category")
|
return errors.New("invalid category")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue