mirror of
https://github.com/muun/recovery.git
synced 2025-11-11 22:40:16 -05:00
Release v0.3.0
This commit is contained in:
15
vendor/github.com/btcsuite/btcd/peer/peer.go
generated
vendored
15
vendor/github.com/btcsuite/btcd/peer/peer.go
generated
vendored
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/go-socks/socks"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/decred/dcrd/lru"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -82,7 +83,7 @@ var (
|
||||
|
||||
// sentNonces houses the unique nonces that are generated when pushing
|
||||
// version messages that are used to detect self connections.
|
||||
sentNonces = newMruNonceMap(50)
|
||||
sentNonces = lru.NewCache(50)
|
||||
|
||||
// allowSelfConns is only used to allow the tests to bypass the self
|
||||
// connection detecting and disconnect logic since they intentionally
|
||||
@@ -450,7 +451,7 @@ type Peer struct {
|
||||
|
||||
wireEncoding wire.MessageEncoding
|
||||
|
||||
knownInventory *mruInventoryMap
|
||||
knownInventory lru.Cache
|
||||
prevGetBlocksMtx sync.Mutex
|
||||
prevGetBlocksBegin *chainhash.Hash
|
||||
prevGetBlocksStop *chainhash.Hash
|
||||
@@ -1626,7 +1627,7 @@ out:
|
||||
|
||||
// Don't send inventory that became known after
|
||||
// the initial check.
|
||||
if p.knownInventory.Exists(iv) {
|
||||
if p.knownInventory.Contains(iv) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -1832,7 +1833,7 @@ func (p *Peer) QueueMessageWithEncoding(msg wire.Message, doneChan chan<- struct
|
||||
func (p *Peer) QueueInventory(invVect *wire.InvVect) {
|
||||
// Don't add the inventory to the send queue if the peer is already
|
||||
// known to have it.
|
||||
if p.knownInventory.Exists(invVect) {
|
||||
if p.knownInventory.Contains(invVect) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1891,7 +1892,7 @@ func (p *Peer) readRemoteVersionMsg() error {
|
||||
}
|
||||
|
||||
// Detect self connections.
|
||||
if !allowSelfConns && sentNonces.Exists(msg.Nonce) {
|
||||
if !allowSelfConns && sentNonces.Contains(msg.Nonce) {
|
||||
return errors.New("disconnecting peer connected to self")
|
||||
}
|
||||
|
||||
@@ -2097,7 +2098,7 @@ func (p *Peer) negotiateInboundProtocol() error {
|
||||
return p.readRemoteVerAckMsg()
|
||||
}
|
||||
|
||||
// negotiateOutoundProtocol performs the negotiation protocol for an outbound
|
||||
// negotiateOutboundProtocol performs the negotiation protocol for an outbound
|
||||
// peer. The events should occur in the following order, otherwise an error is
|
||||
// returned:
|
||||
//
|
||||
@@ -2224,7 +2225,7 @@ func newPeerBase(origCfg *Config, inbound bool) *Peer {
|
||||
p := Peer{
|
||||
inbound: inbound,
|
||||
wireEncoding: wire.BaseEncoding,
|
||||
knownInventory: newMruInventoryMap(maxKnownInventory),
|
||||
knownInventory: lru.NewCache(maxKnownInventory),
|
||||
stallControl: make(chan stallControlMsg, 1), // nonblocking sync
|
||||
outputQueue: make(chan outMsg, outputBufferSize),
|
||||
sendQueue: make(chan outMsg, 1), // nonblocking sync
|
||||
|
||||
Reference in New Issue
Block a user