mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Cleanups mostly.
This commit is contained in:
20
src/Peer.cpp
20
src/Peer.cpp
@@ -493,18 +493,15 @@ void Peer::recvHello(newcoin::TMHello& packet)
|
||||
std::cerr << "Recv(Hello): Disconnect: Bad node public key." << std::endl;
|
||||
}
|
||||
else if (!mNodePublic.verifyNodePublic(mCookieHash, packet.nodeproof()))
|
||||
{
|
||||
// Unable to verify they have private key for claimed public key.
|
||||
{ // Unable to verify they have private key for claimed public key.
|
||||
std::cerr << "Recv(Hello): Disconnect: Failed to verify session." << std::endl;
|
||||
}
|
||||
else if (!theApp->getConnectionPool().peerConnected(shared_from_this(), mNodePublic))
|
||||
{
|
||||
// Already connected, self, or some other reason.
|
||||
{ // Already connected, self, or some other reason.
|
||||
std::cerr << "Recv(Hello): Disconnect: Extraneous connection." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Successful connection.
|
||||
{ // Successful connection.
|
||||
|
||||
// Cancel verification timeout.
|
||||
(void) mVerifyTimer.cancel();
|
||||
@@ -642,11 +639,11 @@ void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
|
||||
ledger=theApp->getMasterLedger().getCurrentLedger();
|
||||
else if(packet.has_ltype() && (packet.ltype() == newcoin::ltCLOSING) )
|
||||
{
|
||||
ledger=theApp->getMasterLedger().getClosingLedger();
|
||||
ledger = theApp->getMasterLedger().getClosedLedger();
|
||||
}
|
||||
else if(packet.has_ltype() && (packet.ltype() == newcoin::ltCLOSED) )
|
||||
{
|
||||
ledger=theApp->getMasterLedger().getClosingLedger();
|
||||
ledger = theApp->getMasterLedger().getClosedLedger();
|
||||
if(ledger && !ledger->isClosed())
|
||||
ledger = theApp->getMasterLedger().getLedgerBySeq(ledger->getLedgerSeq() - 1);
|
||||
}
|
||||
@@ -776,11 +773,12 @@ void Peer::sendHello()
|
||||
h->set_nodeproof(&vchSig[0], vchSig.size());
|
||||
h->set_ipv4port(theConfig.PEER_PORT);
|
||||
|
||||
Ledger::pointer closingLedger=theApp->getMasterLedger().getClosingLedger();
|
||||
if(closingLedger->isClosed())
|
||||
Ledger::pointer closedLedger = theApp->getMasterLedger().getClosedLedger();
|
||||
assert(closedLedger && closedLedger->isClosed());
|
||||
if(closedLedger->isClosed())
|
||||
{
|
||||
Serializer s(128);
|
||||
closingLedger->addRaw(s);
|
||||
closedLedger->addRaw(s);
|
||||
h->set_closedledger(s.getDataPtr(), s.getLength());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ protected:
|
||||
std::vector<uint8_t> mReadbuf;
|
||||
std::list<PackedMessage::pointer> mSendQ;
|
||||
PackedMessage::pointer mSendingPacket;
|
||||
std::bitset<32> mPeerBits;
|
||||
|
||||
Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user