Skip to content

Commit

Permalink
Changes for Darkcoin
Browse files Browse the repository at this point in the history
  • Loading branch information
schinzelh committed Jul 5, 2014
1 parent 8d12fd6 commit 7b99597
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
litecoin-seeder
darkcoin-seeder
===============

Litecoin-seeder is a crawler for the Litecoin network, which exposes a list
Darkcoin-seeder is a crawler for the Darkcoin network, which exposes a list
of reliable nodes via a built-in DNS server.

Features:
* regularly revisits known nodes to check their availability
* bans nodes after enough failures, or bad behaviour
* accepts nodes down to v0.5.0 to request new IP addresses from,
but only reports good post-v0.6.9 nodes.
* accepts nodes down to v0.9.11.5 to request new IP addresses from,
but only reports good post-v0.9.11.5 nodes.
* keeps statistics over (exponential) windows of 2 hours, 8 hours,
1 day and 1 week, to base decisions on.
* very low memory (a few tens of megabytes) and cpu requirements.
Expand Down
4 changes: 2 additions & 2 deletions bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class CNode {
CAddress me(CService("0.0.0.0"));
BeginMessage("version");
int nBestHeight = GetRequireHeight();
string ver = "/litecoin-seeder:0.01/";
string ver = "/darkcoin-seeder:0.1.2/";
vSend << PROTOCOL_VERSION << nLocalServices << nTime << you << me << nLocalNonce << ver << nBestHeight;
EndMessage();
}
Expand Down Expand Up @@ -296,7 +296,7 @@ bool TestNode(const CService &cip, int &ban, int &clientV, std::string &clientSV

/*
int main(void) {
CService ip("litecointools.com", 9333, true);
CService ip("darkcoin.io", 9999, true);
vector<CAddress> vAddr;
vAddr.clear();
int ban = 0;
Expand Down
2 changes: 1 addition & 1 deletion combine.pl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sub combine {
}

for my $addr (sort { $res->{$b} <=> $res->{$a} } (keys %{$res})) {
if ($addr =~ /\A(\d+)\.(\d+)\.(\d+)\.(\d+):9333/) {
if ($addr =~ /\A(\d+)\.(\d+)\.(\d+)\.(\d+):9999/) {
my $a = $1*0x1000000 + $2*0x10000 + $3*0x100 + $4;
printf "0x%08x %s %g%%\n",$a,$addr,(1-((1-$res->{$addr}) ** (1/$n)))*100;
}
Expand Down
6 changes: 3 additions & 3 deletions db.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

#define MIN_RETRY 1000

#define REQUIRE_VERSION 70002
#define REQUIRE_VERSION 70018

static inline int GetRequireHeight(const bool testnet = fTestNet)
{
return testnet ? 0 : 470000;
return testnet ? 0 : 96900;
}

std::string static inline ToString(const CService &ip) {
Expand Down Expand Up @@ -119,7 +119,7 @@ class CAddrInfo {
}
int GetBanTime() const {
if (IsGood()) return 0;
if (clientVersion && clientVersion < 50000) { return 604800; }
if (clientVersion && clientVersion < 91100) { return 604800; }
if (stat1M.reliability - stat1M.weight + 1.0 < 0.15 && stat1M.count > 32) { return 30*86400; }
if (stat1W.reliability - stat1W.weight + 1.0 < 0.10 && stat1W.count > 16) { return 7*86400; }
if (stat1D.reliability - stat1D.weight + 1.0 < 0.05 && stat1D.count > 8) { return 1*86400; }
Expand Down
16 changes: 8 additions & 8 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CDnsSeedOpts {
CDnsSeedOpts() : nThreads(96), nDnsThreads(4), nPort(53), mbox(NULL), ns(NULL), host(NULL), tor(NULL), fUseTestNet(false), fWipeBan(false), fWipeIgnore(false) {}

void ParseCommandLine(int argc, char **argv) {
static const char *help = "Litecoin-seeder\n"
static const char *help = "Darkcoin-seeder\n"
"Usage: %s -h <host> -n <ns> [-m <mbox>] [-t <threads>] [-p <port>]\n"
"\n"
"Options:\n"
Expand Down Expand Up @@ -342,13 +342,13 @@ extern "C" void* ThreadStats(void*) {
} while(1);
}

static const string mainnet_seeds[] = {"dnsseed.litecointools.com", "dnsseed.litecoinpool.org", "dnsseed.ltc.xurious.com", ""};
static const string testnet_seeds[] = {"testnet-seed.litecointools.com", ""};
static const string mainnet_seeds[] = {"static-dnsseed.darkcoin.io", "static-dnsseed.darkcoin.qa", ""};
static const string testnet_seeds[] = {"static-testnet-seed.darkcoin.io", "static-testnet-seed.darkcoin.qa", ""};
static const string *seeds = mainnet_seeds;

extern "C" void* ThreadSeeder(void*) {
if (!fTestNet){
db.Add(CService("kjy2eqzk4zwi5zd3.onion", 9333), true);
db.Add(CService("kjy2eqzk4zwi5zd3.onion", 9999), true);
}
do {
for (int i=0; seeds[i] != ""; i++) {
Expand Down Expand Up @@ -377,10 +377,10 @@ int main(int argc, char **argv) {
bool fDNS = true;
if (opts.fUseTestNet) {
printf("Using testnet.\n");
pchMessageStart[0] = 0xfc;
pchMessageStart[1] = 0xc1;
pchMessageStart[2] = 0xb7;
pchMessageStart[3] = 0xdc;
pchMessageStart[0] = 0xce;
pchMessageStart[1] = 0xe2;
pchMessageStart[2] = 0xca;
pchMessageStart[3] = 0xff;
seeds = testnet_seeds;
fTestNet = true;
}
Expand Down
2 changes: 1 addition & 1 deletion protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static const char* ppszTypeName[] =
"block",
};

unsigned char pchMessageStart[4] = { 0xfb, 0xc0, 0xb6, 0xdb };
unsigned char pchMessageStart[4] = { 0xbf, 0x0c, 0x6b, 0xbd };

CMessageHeader::CMessageHeader()
{
Expand Down
2 changes: 1 addition & 1 deletion protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
extern bool fTestNet;
static inline unsigned short GetDefaultPort(const bool testnet = fTestNet)
{
return testnet ? 19333 : 9333;
return testnet ? 19999 : 9999;
}

//
Expand Down
2 changes: 1 addition & 1 deletion serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CDataStream;
class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000;

static const int PROTOCOL_VERSION = 70002;
static const int PROTOCOL_VERSION = 70018;

// Used to bypass the rule against non-const reference to temporary
// where it makes sense with wrappers such as CFlatData or CTxDB
Expand Down

0 comments on commit 7b99597

Please sign in to comment.