Skip to content

Commit

Permalink
Changes for Ferritecoin
Browse files Browse the repository at this point in the history
  • Loading branch information
koh-gt committed Sep 8, 2024
1 parent a389ade commit cc120d6
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
litecoin-seeder
ferrite-seeder
===============

Litecoin-seeder is a crawler for the Litecoin network, which exposes a list
ferrite-seeder is a crawler for the Ferritecoin 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 v3.0.0 to request new IP addresses from,
but only reports good post-v3.1.3 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.
* crawlers run in parallel (by default 96 threads simultaneously).
* crawlers run in parallel (by default 192 threads simultaneously).

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 = "/FerriteSeeder:0.01/";
uint8_t fRelayTxs = 0;
vSend << PROTOCOL_VERSION << nLocalServices << nTime << you << me << nLocalNonce << ver << nBestHeight << fRelayTxs;
EndMessage();
Expand Down Expand Up @@ -306,7 +306,7 @@ bool TestNode(const CService &cip, int &ban, int &clientV, std::string &clientSV

/*
int main(void) {
CService ip("litecointools.com", 9333, true);
CService ip("ferritecoin.org", 9574, 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+):9574/) {
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,12 +12,12 @@

#define MIN_RETRY 1000

#define REQUIRE_VERSION 70002
#define REQUIRE_VERSION 30000

extern int nMinimumHeight;
static inline int GetRequireHeight(const bool testnet = fTestNet)
{
return nMinimumHeight ? nMinimumHeight : (testnet ? 3220000 : 2660000);
return nMinimumHeight ? nMinimumHeight : (testnet ? 5000 : 195000);
}

std::string static inline ToString(const CService &ip) {
Expand Down Expand Up @@ -120,7 +120,7 @@ class CAddrInfo {
}
int GetBanTime() const {
if (IsGood()) return 0;
if (clientVersion && clientVersion < 50000) { return 604800; }
if (clientVersion && clientVersion < 30000) { 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
14 changes: 7 additions & 7 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CDnsSeedOpts {
CDnsSeedOpts() : nThreads(96), nDnsThreads(4), ip_addr("::"), nPort(53), nP2Port(0), nMinimumHeight(0), mbox(NULL), ns(NULL), host(NULL), tor(NULL), fUseTestNet(false), fWipeBan(false), fWipeIgnore(false), ipv4_proxy(NULL), ipv6_proxy(NULL), magic(NULL) {}

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

static const string mainnet_seeds[] = {"dnsseed.litecoinpool.org", "seed-a.litecoin.loshan.co.uk", "dnsseed.thrasher.io", ""};
static const string testnet_seeds[] = {"seed-b.litecoin.loshan.co.uk", "dnsseed-testnet.thrasher.io", ""};
static const string mainnet_seeds[] = {"node1.ferritecoin.org", "node2.ferritecoin.org", "node3.ferritecoin.org", ""};
static const string testnet_seeds[] = {"test1.ferritecoin.org", "test2.ferritecoin.org", "test3.ferritecoin.org", ""};
static const string *seeds = mainnet_seeds;
static vector<string> vSeeds;

Expand Down Expand Up @@ -545,10 +545,10 @@ int main(int argc, char **argv) {
bool fDNS = true;
if (opts.fUseTestNet) {
printf("Using testnet.\n");
pchMessageStart[0] = 0xfd;
pchMessageStart[1] = 0xd2;
pchMessageStart[2] = 0xc8;
pchMessageStart[3] = 0xf1;
pchMessageStart[0] = 0xba;
pchMessageStart[1] = 0x76;
pchMessageStart[2] = 0xab;
pchMessageStart[3] = 0x8a;
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 @@ -24,7 +24,7 @@ static const char* ppszTypeName[] =

unsigned short nDefaultP2Port = 0;

unsigned char pchMessageStart[4] = { 0xfb, 0xc0, 0xb6, 0xdb };
unsigned char pchMessageStart[4] = { 0x4a, 0x82, 0x10, 0xd9 };

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

//
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 = 30000;

// 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 cc120d6

Please sign in to comment.