mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-16 21:16:30 +00:00
Merge pull request #2758 from nspcc-dev/check-inflight-tx-invs
network: check inv against currently processed transactions
This commit is contained in:
commit
f42b8e78fc
1 changed files with 7 additions and 2 deletions
|
@ -111,7 +111,7 @@ type (
|
|||
txCallback func(*transaction.Transaction)
|
||||
txCbEnabled atomic.Bool
|
||||
|
||||
txInLock sync.Mutex
|
||||
txInLock sync.RWMutex
|
||||
txin chan *transaction.Transaction
|
||||
txInMap map[util.Uint256]struct{}
|
||||
|
||||
|
@ -760,7 +760,12 @@ func (s *Server) handlePong(p Peer, pong *payload.Ping) error {
|
|||
func (s *Server) handleInvCmd(p Peer, inv *payload.Inventory) error {
|
||||
var reqHashes = inv.Hashes[:0]
|
||||
var typExists = map[payload.InventoryType]func(util.Uint256) bool{
|
||||
payload.TXType: s.mempool.ContainsKey,
|
||||
payload.TXType: func(h util.Uint256) bool {
|
||||
s.txInLock.RLock()
|
||||
_, ok := s.txInMap[h]
|
||||
s.txInLock.RUnlock()
|
||||
return ok || s.mempool.ContainsKey(h)
|
||||
},
|
||||
payload.BlockType: s.chain.HasBlock,
|
||||
payload.ExtensibleType: func(h util.Uint256) bool {
|
||||
cp := s.extensiblePool.Get(h)
|
||||
|
|
Loading…
Add table
Reference in a new issue