-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
110 lines (93 loc) · 2.47 KB
/
server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package main
import (
"btc-node/addrmgr"
"btc-node/blockchain"
"btc-node/blockchain/indexers"
"btc-node/chaincfg"
"btc-node/chaincfg/chainhash"
"btc-node/connmgr"
"btc-node/database"
"btc-node/mempool"
"btc-node/mining/cpuminer"
"btc-node/netsync.go"
"btc-node/peer"
"btc-node/txscript"
"btc-node/wire"
"sync"
"github.com/btcsuite/btcutil/bloom"
)
type serverPeer struct {
feeFilter int64
*peer.Peer
connReq *connmgr.ConnReq
server *server
persistent bool
continueHash chainhash.Hash
relayMtx sync.Mutex
disableRelayTx bool
sentAddrs bool
isWhitelisted bool
filter *bloom.Filter
addressesMtx sync.Mutex
knownAddresses map[string]struct{}
banScore connmgr.DynamicBanScore
quit chan struct{}
txProcessed chan struct{}
blockProcessed chan struct{}
}
type broadcastMsg struct {
message wire.Message
excludePeers []*serverPeer
}
type relayMsg struct {
invVect *wire.InvVect
data interface{}
}
type updatePeerHeightsMsg struct {
newHash *chainhash.Hash
newHeight int32
originPeer *peer.Peer
}
type cfHeaderKV struct {
blockHash chainhash.Hash
filterHeader chainhash.Hash
}
type server struct {
bytesReceived uint64
bytesSent uint64
started int32
shutdown int32
shutdownSched int32
startupTime int64
chainParams *chaincfg.Params
addrManager *addrmgr.AddrManager
connManager *connmgr.ConnManager
sigCache *txscript.SigCache
hashCache *txscript.HashCache
syncManager *netsync.SyncManager
chain *blockchain.BlockChain
txMemPool *mempool.TxPool
cpuminer *cpuminer.CPUMiner
modifyRebroadcastInv chan interface{}
newPeers chan *serverPeer
donePeers chan *serverPeer
banPeers chan *serverPeer
query chan interface{}
relayInv chan relayMsg
broadcast chan broadcastMsg
updatePeerHeightsMsg chan updatePeerHeightsMsg
wg sync.WaitGroup
quit chan struct{}
nat NAT
db database.DB
timeSource blockchain.MedianTimeSource
services wire.ServiceFlag
txIndex *indexers.TxIndex
addrIndex *indexers.AddrIndex
cfIndex *indexers.CfIndex
feeEstimator *mempool.FeeEstimator
cfCheckptCaches map[wire.FilterType][]cfHeaderKV
cfCheckptCachesMtx sync.RWMutex
agentBlacklist []string
agentWhitelist []string
}