diff --git a/depends/packages/libsnark.mk b/depends/packages/libsnark.mk index d0d31097e..26d8f6677 100644 --- a/depends/packages/libsnark.mk +++ b/depends/packages/libsnark.mk @@ -1,10 +1,10 @@ package=libsnark $(package)_version=0.1 -$(package)_download_path=https://github.com/radix42/$(package)/archive/ +$(package)_download_path=https://supernetorg.bintray.com/misc/ $(package)_file_name=$(package)-$($(package)_git_commit).tar.gz -$(package)_download_file=$($(package)_git_commit).tar.gz -$(package)_sha256_hash=9dbd5b44d3443e86463e934bfe1023cab4ca5948f8d74c23a67d9535c28d2584 -$(package)_git_commit=9be18569b8abcda1245c3912877075259599c0f1 +$(package)_download_file=$(package)-$($(package)_git_commit).tar.gz +$(package)_sha256_hash=47478adc2ae88c448dc736d59dfe007de6478e41e88d2d4d2ff4135a17ee6f90 +$(package)_git_commit=3854b20c25e8bc567aab2b558dec84d45f4a3e73 $(package)_dependencies=libgmp libsodium diff --git a/src/komodo.h b/src/komodo.h index e81522eb5..e1e40448d 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -16,6 +16,10 @@ #ifndef H_KOMODO_H #define H_KOMODO_H +#ifdef _WIN32 +#define printf(...) +#endif + // Todo: // verify: reorgs diff --git a/src/main.cpp b/src/main.cpp index c14fd7995..1e9be1a06 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,6 +49,7 @@ using namespace std; */ CCriticalSection cs_main; +extern uint8_t NOTARY_PUBKEY33[33]; BlockMap mapBlockIndex; CChain chainActive; @@ -4494,7 +4495,14 @@ void static ProcessGetData(CNode* pfrom) else { if (inv.type == MSG_BLOCK) + { + //uint256 hash; int32_t z; + //hash = block.GetHash(); + //for (z=31; z>=0; z--) + // fprintf(stderr,"%02x",((uint8_t *)&hash)[z]); + //fprintf(stderr," send block %d\n",komodo_block2height(&block)); pfrom->PushMessage("block", block); + } else // MSG_FILTERED_BLOCK) { LOCK(pfrom->cs_filter); @@ -4583,6 +4591,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, { const CChainParams& chainparams = Params(); LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id); + //fprintf(stderr, "recv: %s peer=%d\n", SanitizeString(strCommand).c_str(), (int32_t)pfrom->GetId()); if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) { LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n"); @@ -4956,13 +4965,19 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, vector vHeaders; int nLimit = MAX_HEADERS_RESULTS; LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id); - for (; pindex; pindex = chainActive.Next(pindex)) + if ( pfrom->lasthdrsreq >= chainActive.Height()-MAX_HEADERS_RESULTS || pfrom->lasthdrsreq != (int32_t)(pindex ? pindex->nHeight : -1) ) { - vHeaders.push_back(pindex->GetBlockHeader()); - if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop) - break; + pfrom->lasthdrsreq = (int32_t)(pindex ? pindex->nHeight : -1); + for (; pindex; pindex = chainActive.Next(pindex)) + { + vHeaders.push_back(pindex->GetBlockHeader()); + if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop) + break; + } + pfrom->PushMessage("headers", vHeaders); } - pfrom->PushMessage("headers", vHeaders); + else if ( NOTARY_PUBKEY33[0] != 0 ) + fprintf(stderr,"you can ignore redundant getheaders from peer.%d %d prev.%d\n",(int32_t)pfrom->id,(int32_t)(pindex ? pindex->nHeight : -1),pfrom->lasthdrsreq); } @@ -5143,8 +5158,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // Headers message had its maximum size; the peer may have more headers. // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // from there instead. - LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); - pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); + if ( pfrom->sendhdrsreq >= chainActive.Height()-MAX_HEADERS_RESULTS || pindexLast->nHeight != pfrom->sendhdrsreq ) + { + pfrom->sendhdrsreq = (int32_t)pindexLast->nHeight; + LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); + pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); + } } CheckBlockIndex(); diff --git a/src/net.h b/src/net.h index f7ebf11f6..bb79acf17 100644 --- a/src/net.h +++ b/src/net.h @@ -264,6 +264,7 @@ public: std::string addrName; CService addrLocal; int nVersion; + int lasthdrsreq,sendhdrsreq; // strSubVer is whatever byte array we read from the wire. However, this field is intended // to be printed out, displayed to humans in various forms and so on. So we sanitize it and // store the sanitized version in cleanSubVer. The original should be used when dealing with diff --git a/src/util.cpp b/src/util.cpp index 4c901d586..c2d299e20 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -604,7 +604,14 @@ boost::filesystem::path GetConfigFile() char confname[512]; if ( ASSETCHAINS_SYMBOL[0] != 0 ) sprintf(confname,"%s.conf",ASSETCHAINS_SYMBOL); - else strcpy(confname,"komodo.conf"); + else + { +#ifdef __APPLE__ + strcpy(confname,"Komodo.conf"); +#else + strcpy(confname,"komodo.conf"); +#endif + } boost::filesystem::path pathConfigFile(GetArg("-conf",confname)); if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile;