Skip to content

Commit

Permalink
Make tx relay expiration configurable with 3 hour default, relay to a…
Browse files Browse the repository at this point in the history
…ll nodes.
  • Loading branch information
projectmemetic committed Feb 9, 2019
1 parent 5163adb commit b7e19de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ std::string HelpMessage()
strUsage += " -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n";
strUsage += " -synctimeout=<n> " + _("Specify block download timeout in seconds (default: 60)") + "\n";
strUsage += " -syncspan=<n> " + _("Specify last block age in minutes after which node goes into syncing mode (default: 90)") + "\n";
strUsage += " -txrelayexpiration=<n> " + _("Specify age in minutes after which transactions expire from the relay pool (default: 180)") + "\n";
strUsage += " -externalip=<ip> " + _("Specify your own public address") + "\n";
strUsage += " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n";
strUsage += " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n";
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4128,8 +4128,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
vRecv >> pfrom->strSubVer;
if (!vRecv.empty())
vRecv >> pfrom->nStartingHeight;
if (!vRecv.empty())
pfrom->fRelayTxes = true;

pfrom->fRelayTxes = true;

pfrom->cleanSubVer = SanitizeString(pfrom->strSubVer);

Expand Down
5 changes: 3 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void CNode::PushVersion()
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), addrYou.ToString(), addr.ToString());
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight, true);
}


Expand Down Expand Up @@ -1765,8 +1765,9 @@ void RelayTransaction(const CTransaction& tx, const uint256& hash, const CDataSt
}

// Save original serialized message so newer versions are preserved
int nTransactionExpiration = GetArg("-txrelayexpiration", 180);
mapRelay.insert(std::make_pair(inv, ss));
vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv));
vRelayExpiration.push_back(std::make_pair(GetTime() + nTransactionExpiration * 60, inv));
}

RelayInventory(inv);
Expand Down

0 comments on commit b7e19de

Please sign in to comment.