Fix flood of send block on chain sync. Make net code to ignore KMD peers for LABS faster.

This commit is contained in:
blackjok3r
2018-12-28 15:42:23 +08:00
parent f128d49d2f
commit 292962b36d
3 changed files with 17 additions and 20 deletions

View File

@@ -783,6 +783,8 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
void komodo_broadcast(CBlock *pblock,int32_t limit) void komodo_broadcast(CBlock *pblock,int32_t limit)
{ {
if (IsInitialBlockDownload())
return;
int32_t n = 1; int32_t n = 1;
//fprintf(stderr,"broadcast new block t.%u\n",(uint32_t)time(NULL)); //fprintf(stderr,"broadcast new block t.%u\n",(uint32_t)time(NULL));
{ {

View File

@@ -63,6 +63,8 @@ namespace {
// Global state variables // Global state variables
// //
extern uint16_t ASSETCHAINS_P2PPORT; extern uint16_t ASSETCHAINS_P2PPORT;
extern int8_t is_STAKED(const char *chain_name);
extern char ASSETCHAINS_SYMBOL[65];
bool fDiscover = true; bool fDiscover = true;
bool fListen = true; bool fListen = true;
@@ -1262,15 +1264,6 @@ void ThreadSocketHandler()
void ThreadDNSAddressSeed() void ThreadDNSAddressSeed()
{ {
extern int8_t is_STAKED(const char *chain_name);
extern char ASSETCHAINS_SYMBOL[65];
// skip DNS seeds for staked chains.
if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 )
{
fprintf(stderr, "STAKED CHAIN DISABLED ALL SEEDS!\n");
return;
}
// goal: only query DNS seeds if address need is acute // goal: only query DNS seeds if address need is acute
if ((addrman.size() > 0) && if ((addrman.size() > 0) &&
(!GetBoolArg("-forcednsseed", false))) { (!GetBoolArg("-forcednsseed", false))) {
@@ -1380,22 +1373,20 @@ void ThreadOpenConnections()
// Add seed nodes if DNS seeds are all down (an infrastructure attack?). // Add seed nodes if DNS seeds are all down (an infrastructure attack?).
// if (addrman.size() == 0 && (GetTime() - nStart > 60)) { // if (addrman.size() == 0 && (GetTime() - nStart > 60)) {
extern int8_t is_STAKED(const char *chain_name); if (GetTime() - nStart > 60) {
extern char ASSETCHAINS_SYMBOL[65]; static bool done = false;
// skip DNS seeds for staked chains. if (!done) {
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 0 ) // skip DNS seeds for staked chains.
{ if ( is_STAKED(ASSETCHAINS_SYMBOL) == 0 ) {
if (GetTime() - nStart > 60) {
static bool done = false;
if (!done) {
//LogPrintf("Adding fixed seed nodes as DNS doesn't seem to be available.\n"); //LogPrintf("Adding fixed seed nodes as DNS doesn't seem to be available.\n");
LogPrintf("Adding fixed seed nodes.\n"); LogPrintf("Adding fixed seed nodes.\n");
addrman.Add(convertSeed6(Params().FixedSeeds()), CNetAddr("127.0.0.1")); addrman.Add(convertSeed6(Params().FixedSeeds()), CNetAddr("127.0.0.1"));
done = true;
} }
done = true;
} }
} }
// //
// Choose an address to connect to based on most recently seen // Choose an address to connect to based on most recently seen
// //
@@ -1802,6 +1793,12 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
Discover(threadGroup); Discover(threadGroup);
// skip DNS seeds for staked chains.
extern int8_t is_STAKED(const char *chain_name);
extern char ASSETCHAINS_SYMBOL[65];
if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 )
SoftSetBoolArg("-dnsseed", false);
// //
// Start threads // Start threads
// //

View File

@@ -607,8 +607,6 @@ UniValue getblockhash(const UniValue& params, bool fHelp)
} }
extern uint64_t ASSETCHAINS_STAKED; extern uint64_t ASSETCHAINS_STAKED;
int32_t komodo_isPoS(CBlock *pblock);
uint32_t komodo_segid32(char *coinaddr);
UniValue getlastsegidstakes(const UniValue& params, bool fHelp) UniValue getlastsegidstakes(const UniValue& params, bool fHelp)
{ {