Announce --testnet in Hello.

This commit is contained in:
Arthur Britto
2013-01-02 22:54:29 -08:00
parent 3781555bda
commit dfccda5ba8
2 changed files with 10 additions and 1 deletions

View File

@@ -627,7 +627,14 @@ void Peer::recvHello(ripple::TMHello& packet)
}
#endif
if (packet.has_nettime() && ((packet.nettime() < minTime) || (packet.nettime() > maxTime)))
if ((packet.has_testnet() && packet.testnet()) != theConfig.TESTNET)
{
// Format: actual/requested.
cLog(lsINFO) << boost::str(boost::format("Recv(Hello): Network mismatch: %d/%d")
% packet.testnet()
% theConfig.TESTNET);
}
else if (packet.has_nettime() && ((packet.nettime() < minTime) || (packet.nettime() > maxTime)))
{
if (packet.nettime() > maxTime)
{
@@ -1619,6 +1626,7 @@ void Peer::sendHello()
h.set_nodeproof(&vchSig[0], vchSig.size());
h.set_ipv4port(theConfig.PEER_PORT);
h.set_nodeprivate(theConfig.PEER_PRIVATE);
h.set_testnet(theConfig.TESTNET);
Ledger::pointer closedLedger = theApp->getLedgerMaster().getClosedLedger();
if (closedLedger && closedLedger->isClosed())

View File

@@ -71,6 +71,7 @@ message TMHello {
optional bytes ledgerPrevious = 10; // the ledger before the last closed ledger
optional bool nodePrivate = 11; // Request to not forward IP.
optional TMProofWork proofOfWork = 12; // request/provide proof of work
optional bool testNet = 13; // Running as testnet.
}