Skip to content

Commit f500090

Browse files
committed
drop b-cash nodes
1 parent 07b3eaf commit f500090

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

BRPeer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ extern "C" {
6060

6161
#define SERVICES_NODE_NETWORK 0x01 // services value indicating a node carries full blocks, not just headers
6262
#define SERVICES_NODE_BLOOM 0x04 // BIP111: https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki
63-
63+
#define SERVICES_NODE_BCASH 0x20 // https://github.com/Bitcoin-UAHF/spec/blob/master/uahf-technical-spec.md
64+
6465
#define BR_VERSION "0.6.2"
6566
#define USER_AGENT "/breadwallet:" BR_VERSION "/"
6667

BRPeerManager.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,22 @@ static void _peerConnected(void *info)
805805
pthread_mutex_lock(&manager->lock);
806806
if (peer->timestamp > now + 2*60*60 || peer->timestamp < now - 2*60*60) peer->timestamp = now; // sanity check
807807

808-
// drop peers that don't carry full blocks, or aren't synced yet
809808
// TODO: XXX does this work with 0.11 pruned nodes?
810-
if (! (peer->services & SERVICES_NODE_NETWORK) ||
811-
BRPeerLastBlock(peer) + 10 < manager->lastBlock->height) {
809+
if (! (peer->services & SERVICES_NODE_NETWORK)) {
810+
peer_log(peer, "node doesn't carry full blocks");
811+
BRPeerDisconnect(peer);
812+
}
813+
else if (BRPeerLastBlock(peer) + 10 < manager->lastBlock->height) {
814+
peer_log(peer, "node isn't synced");
815+
BRPeerDisconnect(peer);
816+
}
817+
else if ((peer->services & SERVICES_NODE_BCASH) == SERVICES_NODE_BCASH) {
818+
peer_log(peer, "b-cash nodes not supported");
812819
BRPeerDisconnect(peer);
813820
}
814821
else if (BRPeerVersion(peer) >= 70011 && ! (peer->services & SERVICES_NODE_BLOOM)) {
815-
BRPeerDisconnect(peer); // drop peers that don't support SPV filtering
822+
peer_log(peer, "node doesn't support SPV mode");
823+
BRPeerDisconnect(peer);
816824
}
817825
else if (manager->downloadPeer && // check if we should stick with the existing download peer
818826
(BRPeerLastBlock(manager->downloadPeer) >= BRPeerLastBlock(peer) ||

0 commit comments

Comments
 (0)