mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
net: Add fRelayTxes flag
Add a fRelayTxes to keep track of the relay transaction flag we send to other peers.
This commit is contained in:
parent
169d379c98
commit
581ddff05c
@ -1102,6 +1102,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
fListen = GetBoolArg("-listen", DEFAULT_LISTEN);
|
fListen = GetBoolArg("-listen", DEFAULT_LISTEN);
|
||||||
fDiscover = GetBoolArg("-discover", true);
|
fDiscover = GetBoolArg("-discover", true);
|
||||||
fNameLookup = GetBoolArg("-dns", DEFAULT_NAME_LOOKUP);
|
fNameLookup = GetBoolArg("-dns", DEFAULT_NAME_LOOKUP);
|
||||||
|
fRelayTxes = !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
|
||||||
|
|
||||||
bool fBound = false;
|
bool fBound = false;
|
||||||
if (fListen) {
|
if (fListen) {
|
||||||
|
@ -4751,7 +4751,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
return error("message inv size() = %u", vInv.size());
|
return error("message inv size() = %u", vInv.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fBlocksOnly = GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
|
bool fBlocksOnly = !fRelayTxes;
|
||||||
|
|
||||||
// Allow whitelisted peers to send data other than blocks in blocks only mode if whitelistrelay is true
|
// Allow whitelisted peers to send data other than blocks in blocks only mode if whitelistrelay is true
|
||||||
if (pfrom->fWhitelisted && GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY))
|
if (pfrom->fWhitelisted && GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY))
|
||||||
@ -4934,7 +4934,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
{
|
{
|
||||||
// Stop processing the transaction early if
|
// Stop processing the transaction early if
|
||||||
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
|
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
|
||||||
if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
|
if (!fRelayTxes && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
|
||||||
{
|
{
|
||||||
LogPrint("net", "transaction sent in violation of protocol peer=%d\n", pfrom->id);
|
LogPrint("net", "transaction sent in violation of protocol peer=%d\n", pfrom->id);
|
||||||
return true;
|
return true;
|
||||||
|
@ -77,6 +77,7 @@ const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
|
|||||||
bool fDiscover = true;
|
bool fDiscover = true;
|
||||||
bool fListen = true;
|
bool fListen = true;
|
||||||
uint64_t nLocalServices = NODE_NETWORK;
|
uint64_t nLocalServices = NODE_NETWORK;
|
||||||
|
bool fRelayTxes = true;
|
||||||
CCriticalSection cs_mapLocalHost;
|
CCriticalSection cs_mapLocalHost;
|
||||||
map<CNetAddr, LocalServiceInfo> mapLocalHost;
|
map<CNetAddr, LocalServiceInfo> mapLocalHost;
|
||||||
static bool vfLimited[NET_MAX] = {};
|
static bool vfLimited[NET_MAX] = {};
|
||||||
@ -454,7 +455,7 @@ void CNode::PushVersion()
|
|||||||
else
|
else
|
||||||
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
|
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
|
||||||
PushMessage(NetMsgType::VERSION, PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
|
PushMessage(NetMsgType::VERSION, PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
|
||||||
nLocalHostNonce, strSubVersion, nBestHeight, !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY));
|
nLocalHostNonce, strSubVersion, nBestHeight, fRelayTxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,6 +153,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer = NULL);
|
|||||||
extern bool fDiscover;
|
extern bool fDiscover;
|
||||||
extern bool fListen;
|
extern bool fListen;
|
||||||
extern uint64_t nLocalServices;
|
extern uint64_t nLocalServices;
|
||||||
|
extern bool fRelayTxes;
|
||||||
extern uint64_t nLocalHostNonce;
|
extern uint64_t nLocalHostNonce;
|
||||||
extern CAddrMan addrman;
|
extern CAddrMan addrman;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user