Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 The Bitcoin Core developers | ||||
// Copyright (c) 2017-2019 The Bitcoin developers | // Copyright (c) 2017-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_NET_H | #ifndef BITCOIN_NET_H | ||||
#define BITCOIN_NET_H | #define BITCOIN_NET_H | ||||
#include <addrdb.h> | #include <addrdb.h> | ||||
#include <addrman.h> | #include <addrman.h> | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <avalanche/proofid.h> | #include <avalanche/proofid.h> | ||||
#include <avalanche/proofradixtreeadapter.h> | |||||
#include <bloom.h> | #include <bloom.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <compat.h> | #include <compat.h> | ||||
#include <crypto/siphash.h> | #include <crypto/siphash.h> | ||||
#include <hash.h> | #include <hash.h> | ||||
#include <i2p.h> | #include <i2p.h> | ||||
#include <net_permissions.h> | #include <net_permissions.h> | ||||
#include <netaddress.h> | #include <netaddress.h> | ||||
#include <nodeid.h> | #include <nodeid.h> | ||||
#include <protocol.h> | #include <protocol.h> | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <radix.h> | |||||
#include <random.h> | #include <random.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <threadinterrupt.h> | #include <threadinterrupt.h> | ||||
#include <uint256.h> | #include <uint256.h> | ||||
#include <util/check.h> | #include <util/check.h> | ||||
#include <validation.h> // For cs_main | #include <validation.h> // For cs_main | ||||
▲ Show 20 Lines • Show All 614 Lines • ▼ Show 20 Lines | public: | ||||
struct ProofRelay { | struct ProofRelay { | ||||
mutable RecursiveMutex cs_proof_inventory; | mutable RecursiveMutex cs_proof_inventory; | ||||
std::set<avalanche::ProofId> | std::set<avalanche::ProofId> | ||||
setInventoryProofToSend GUARDED_BY(cs_proof_inventory); | setInventoryProofToSend GUARDED_BY(cs_proof_inventory); | ||||
// Prevent sending proof invs if the peer already knows about them | // Prevent sending proof invs if the peer already knows about them | ||||
CRollingBloomFilter filterProofKnown GUARDED_BY(cs_proof_inventory){ | CRollingBloomFilter filterProofKnown GUARDED_BY(cs_proof_inventory){ | ||||
10000, 0.000001}; | 10000, 0.000001}; | ||||
std::chrono::microseconds nextInvSend{0}; | std::chrono::microseconds nextInvSend{0}; | ||||
RadixTree<const avalanche::Proof, avalanche::ProofRadixTreeAdapter> | |||||
sharedProofs; | |||||
}; | }; | ||||
// m_proof_relay == nullptr if we're not relaying proofs with this peer | // m_proof_relay == nullptr if we're not relaying proofs with this peer | ||||
const std::unique_ptr<ProofRelay> m_proof_relay; | const std::unique_ptr<ProofRelay> m_proof_relay; | ||||
class AvalancheState { | class AvalancheState { | ||||
/** | /** | ||||
* The inventories polled and voted couters since last score | * The inventories polled and voted couters since last score | ||||
▲ Show 20 Lines • Show All 848 Lines • Show Last 20 Lines |