Skip to content

Commit

Permalink
Several bugfixes:
Browse files Browse the repository at this point in the history
- do not forget to read the validation marker from disk;
- do not disconnect peers with headers too far behind for now (TODO:
port bitcoin#10345 instead);
- partly fix an out-of-tree build.
  • Loading branch information
caraphinneth committed Oct 2, 2019
1 parent e901d1e commit 956438e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
12 changes: 6 additions & 6 deletions animecoin-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ else
DEFINES += DISABLE_ZMQ
}

QMAKE_CFLAGS+="-O2 -march=native -ftree-vectorize -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block"
QMAKE_CXXFLAGS+="-O2 -march=native -ftree-vectorize -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -Wno-deprecated-copy"
QMAKE_CFLAGS+="-Og -march=native -ftree-vectorize"
QMAKE_CXXFLAGS+="-Og -march=native -ftree-vectorize -Wno-deprecated-copy"
#QMAKE_LFLAGS+="-flto"

# for boost 1.37, add -mt to the boost libraries
Expand Down Expand Up @@ -247,15 +247,15 @@ LIBS += $$PWD/src/secp256k1/src/libsecp256k1_la-secp256k1.o

#Build univalue
INCLUDEPATH += src/univalue/include
LIBS += $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o
LIBS += $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_get.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o
# we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences
genunivalue.commands = cd $$PWD/src/univalue && ./autogen.sh && ./configure && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\"
genunivalue.target = $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o
genunivalue.target = $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_get.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o
genunivalue.depends = FORCE
PRE_TARGETDEPS += $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o
PRE_TARGETDEPS += $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_get.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o
QMAKE_EXTRA_TARGETS += genunivalue
# Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it.
QMAKE_CLEAN += $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o; cd $$PWD/src/univalue; $(MAKE) clean
QMAKE_CLEAN += $$PWD/src/univalue/lib/libunivalue_la-univalue.o $$PWD/src/univalue/lib/libunivalue_la-univalue_get.o $$PWD/src/univalue/lib/libunivalue_la-univalue_read.o $$PWD/src/univalue/lib/libunivalue_la-univalue_write.o; cd $$PWD/src/univalue; $(MAKE) clean

# regenerate src/build.h
!win32:contains(USE_BUILD_INFO, 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/blockencodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class CBlockHeaderAndShortTxIDs {

size_t BlockTxCount() const { return shorttxids.size() + prefilledtxn.size(); }

ADD_SERIALIZE_METHODS;
ADD_SERIALIZE_METHODS

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
Expand Down
20 changes: 6 additions & 14 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5063,6 +5063,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BlockTransactionsRequest req;
vRecv >> req;

LOCK(cs_main);
BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) {
Misbehaving(pfrom->GetId(), 100);
Expand Down Expand Up @@ -5515,6 +5516,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
ReadCompactSize(vRecv); // ignore tx count; assume it is 0.
}

if (nCount == 0) {
// Nothing interesting. Stop asking this peers for more headers.
return true;
}

const CBlockIndex *pindexLast = nullptr;
{
LOCK(cs_main);
Expand Down Expand Up @@ -5586,20 +5592,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// from there instead.
LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight);
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexLast), uint256()));
} else {
if (chainparams.DelayGetHeadersTime() != 0 && pindexBestHeader->GetBlockTime() < GetAdjustedTime() - chainparams.DelayGetHeadersTime()) {
// peer has sent us a HEADERS message below maximum size and we are still quite far from being fully
// synced, this means we probably got a bad peer for initial sync and need to continue with another one.
// By disconnecting we force to start a new iteration of initial headers sync in SendMessages
// TODO should we handle whitelisted peers here as we do in headers sync timeout handling?
pfrom->fDisconnect = true;
return error("detected bad peer for initial headers sync, disconnecting %d", pfrom->id);
}

if (nCount == 0) {
// Nothing interesting. Stop asking this peers for more headers.
return true;
}
}

bool fCanDirectFetch = CanDirectFetch(chainparams.GetConsensus());
Expand Down
4 changes: 4 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include "wallet/wallet.h"

#if !defined(HAVE_CONFIG_H)
#define PACKAGE_NAME "Animecoin"
#endif

#include "auxiliaryblockrequest.h"
#include "base58.h"
#include "checkpoints.h"
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ class CWalletTx : public CMerkleTx
ReadOrderPos(nOrderPos, mapValue);

nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0;
fValidated = (mapValue.count("validated") && mapValue["validated"] == "yes") ? true : false;
}

mapValue.erase("fromaccount");
Expand Down

0 comments on commit 956438e

Please sign in to comment.