mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
A bit of a painful PackedMessage change, but this simplifies a lot of code.
It's worth it to take the pain now.
This commit is contained in:
@@ -117,9 +117,9 @@ void LedgerAcquire::trigger(Peer::pointer peer)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << "need base" << std::endl;
|
std::cerr << "need base" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>();
|
newcoin::TMGetLedger tmGL;
|
||||||
tmGL->set_ledgerhash(mHash.begin(), mHash.size());
|
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||||
tmGL->set_itype(newcoin::liBASE);
|
tmGL.set_itype(newcoin::liBASE);
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
sendRequest(tmGL, peer);
|
sendRequest(tmGL, peer);
|
||||||
@@ -136,11 +136,11 @@ void LedgerAcquire::trigger(Peer::pointer peer)
|
|||||||
assert(mLedger);
|
assert(mLedger);
|
||||||
if (mLedger->peekTransactionMap()->getHash().isZero())
|
if (mLedger->peekTransactionMap()->getHash().isZero())
|
||||||
{ // we need the root node
|
{ // we need the root node
|
||||||
boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>();
|
newcoin::TMGetLedger tmGL;
|
||||||
tmGL->set_ledgerhash(mHash.begin(), mHash.size());
|
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||||
tmGL->set_ledgerseq(mLedger->getLedgerSeq());
|
tmGL.set_ledgerseq(mLedger->getLedgerSeq());
|
||||||
tmGL->set_itype(newcoin::liTX_NODE);
|
tmGL.set_itype(newcoin::liTX_NODE);
|
||||||
*(tmGL->add_nodeids()) = SHAMapNode().getRawString();
|
*(tmGL.add_nodeids()) = SHAMapNode().getRawString();
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
sendRequest(tmGL, peer);
|
sendRequest(tmGL, peer);
|
||||||
@@ -164,12 +164,12 @@ void LedgerAcquire::trigger(Peer::pointer peer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>();
|
newcoin::TMGetLedger tmGL;
|
||||||
tmGL->set_ledgerhash(mHash.begin(), mHash.size());
|
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||||
tmGL->set_ledgerseq(mLedger->getLedgerSeq());
|
tmGL.set_ledgerseq(mLedger->getLedgerSeq());
|
||||||
tmGL->set_itype(newcoin::liTX_NODE);
|
tmGL.set_itype(newcoin::liTX_NODE);
|
||||||
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
||||||
*(tmGL->add_nodeids()) = it->getRawString();
|
*(tmGL.add_nodeids()) = it->getRawString();
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
sendRequest(tmGL, peer);
|
sendRequest(tmGL, peer);
|
||||||
@@ -188,11 +188,11 @@ void LedgerAcquire::trigger(Peer::pointer peer)
|
|||||||
assert(mLedger);
|
assert(mLedger);
|
||||||
if (mLedger->peekAccountStateMap()->getHash().isZero())
|
if (mLedger->peekAccountStateMap()->getHash().isZero())
|
||||||
{ // we need the root node
|
{ // we need the root node
|
||||||
boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>();
|
newcoin::TMGetLedger tmGL;
|
||||||
tmGL->set_ledgerhash(mHash.begin(), mHash.size());
|
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||||
tmGL->set_ledgerseq(mLedger->getLedgerSeq());
|
tmGL.set_ledgerseq(mLedger->getLedgerSeq());
|
||||||
tmGL->set_itype(newcoin::liAS_NODE);
|
tmGL.set_itype(newcoin::liAS_NODE);
|
||||||
*(tmGL->add_nodeids()) = SHAMapNode().getRawString();
|
*(tmGL.add_nodeids()) = SHAMapNode().getRawString();
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
sendRequest(tmGL, peer);
|
sendRequest(tmGL, peer);
|
||||||
@@ -216,12 +216,12 @@ void LedgerAcquire::trigger(Peer::pointer peer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>();
|
newcoin::TMGetLedger tmGL;
|
||||||
tmGL->set_ledgerhash(mHash.begin(), mHash.size());
|
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||||
tmGL->set_ledgerseq(mLedger->getLedgerSeq());
|
tmGL.set_ledgerseq(mLedger->getLedgerSeq());
|
||||||
tmGL->set_itype(newcoin::liAS_NODE);
|
tmGL.set_itype(newcoin::liAS_NODE);
|
||||||
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
||||||
*(tmGL->add_nodeids()) = it->getRawString();
|
*(tmGL.add_nodeids()) = it->getRawString();
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
sendRequest(tmGL, peer);
|
sendRequest(tmGL, peer);
|
||||||
@@ -238,12 +238,12 @@ void LedgerAcquire::trigger(Peer::pointer peer)
|
|||||||
resetTimer();
|
resetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerSet::sendRequest(boost::shared_ptr<newcoin::TMGetLedger> tmGL, Peer::pointer peer)
|
void PeerSet::sendRequest(const newcoin::TMGetLedger& tmGL, Peer::pointer peer)
|
||||||
{
|
{
|
||||||
peer->sendPacket(boost::make_shared<PackedMessage>(tmGL, newcoin::mtGET_LEDGER));
|
peer->sendPacket(boost::make_shared<PackedMessage>(tmGL, newcoin::mtGET_LEDGER));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerSet::sendRequest(boost::shared_ptr<newcoin::TMGetLedger> tmGL)
|
void PeerSet::sendRequest(const newcoin::TMGetLedger& tmGL)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
if (mPeers.empty()) return;
|
if (mPeers.empty()) return;
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ protected:
|
|||||||
PeerSet(const uint256& hash, int interval);
|
PeerSet(const uint256& hash, int interval);
|
||||||
virtual ~PeerSet() { ; }
|
virtual ~PeerSet() { ; }
|
||||||
|
|
||||||
void sendRequest(boost::shared_ptr<newcoin::TMGetLedger> message);
|
void sendRequest(const newcoin::TMGetLedger& message);
|
||||||
void sendRequest(boost::shared_ptr<newcoin::TMGetLedger> message, Peer::pointer peer);
|
void sendRequest(const newcoin::TMGetLedger& message, Peer::pointer peer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const uint256& getHash() const { return mHash; }
|
const uint256& getHash() const { return mHash; }
|
||||||
|
|||||||
@@ -89,16 +89,15 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
|
|||||||
// no cache the account balance information and always get it from the current ledger
|
// no cache the account balance information and always get it from the current ledger
|
||||||
// theApp->getWallet().applyTransaction(trans);
|
// theApp->getWallet().applyTransaction(trans);
|
||||||
|
|
||||||
boost::shared_ptr<newcoin::TMTransaction> tx = boost::make_shared<newcoin::TMTransaction>();
|
newcoin::TMTransaction tx;
|
||||||
|
|
||||||
Serializer s;
|
Serializer s;
|
||||||
trans->getSTransaction()->getTransaction(s, false);
|
trans->getSTransaction()->getTransaction(s, false);
|
||||||
tx->set_rawtransaction(&s.getData().front(), s.getLength());
|
tx.set_rawtransaction(&s.getData().front(), s.getLength());
|
||||||
tx->set_status(newcoin::tsCURRENT);
|
tx.set_status(newcoin::tsCURRENT);
|
||||||
tx->set_receivetimestamp(getNetworkTimeNC());
|
tx.set_receivetimestamp(getNetworkTimeNC());
|
||||||
tx->set_ledgerindexpossible(trans->getLedger());
|
tx.set_ledgerindexpossible(trans->getLedger());
|
||||||
|
|
||||||
PackedMessage::pointer packet(new PackedMessage(PackedMessage::MessagePointer(tx), newcoin::mtTRANSACTION));
|
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(tx, newcoin::mtTRANSACTION);
|
||||||
theApp->getConnectionPool().relayMessage(source, packet);
|
theApp->getConnectionPool().relayMessage(source, packet);
|
||||||
|
|
||||||
return trans;
|
return trans;
|
||||||
@@ -375,14 +374,13 @@ int NetworkOPs::beginConsensus(Ledger::pointer closingLedger, bool isEarly)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << "Broadcasting ledger close" << std::endl;
|
std::cerr << "Broadcasting ledger close" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
boost::shared_ptr<newcoin::TMStatusChange> s = boost::make_shared<newcoin::TMStatusChange>();
|
newcoin::TMStatusChange s;
|
||||||
s->set_newevent(newcoin::neCLOSING_LEDGER);
|
s.set_newevent(newcoin::neCLOSING_LEDGER);
|
||||||
s->set_ledgerseq(closingLedger->getLedgerSeq());
|
s.set_ledgerseq(closingLedger->getLedgerSeq());
|
||||||
s->set_networktime(getNetworkTimeNC());
|
s.set_networktime(getNetworkTimeNC());
|
||||||
uint256 plhash = closingLedger->getParentHash();
|
uint256 plhash = closingLedger->getParentHash();
|
||||||
s->set_previousledgerhash(plhash.begin(), plhash.size());
|
s.set_previousledgerhash(plhash.begin(), plhash.size());
|
||||||
PackedMessage::pointer packet =
|
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(s, newcoin::mtSTATUS_CHANGE);
|
||||||
boost::make_shared<PackedMessage>(PackedMessage::MessagePointer(s), newcoin::mtSTATUS_CHANGE);
|
|
||||||
theApp->getConnectionPool().relayMessage(NULL, packet);
|
theApp->getConnectionPool().relayMessage(NULL, packet);
|
||||||
|
|
||||||
return mConsensus->startup();
|
return mConsensus->startup();
|
||||||
|
|||||||
@@ -12,16 +12,15 @@ void PackedMessage::encodeHeader(unsigned size, int type)
|
|||||||
mBuffer[5] = static_cast<boost::uint8_t>(type & 0xFF);
|
mBuffer[5] = static_cast<boost::uint8_t>(type & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PackedMessage::PackedMessage(const ::google::protobuf::Message &message, int type)
|
||||||
PackedMessage::PackedMessage(MessagePointer msg, int type) : mMsg(msg)
|
|
||||||
{
|
{
|
||||||
unsigned msg_size = mMsg->ByteSize();
|
unsigned msg_size = message.ByteSize();
|
||||||
assert(msg_size);
|
assert(msg_size);
|
||||||
mBuffer.resize(HEADER_SIZE + msg_size);
|
mBuffer.resize(HEADER_SIZE + msg_size);
|
||||||
encodeHeader(msg_size, type);
|
encodeHeader(msg_size, type);
|
||||||
if (msg_size)
|
if (msg_size)
|
||||||
{
|
{
|
||||||
mMsg->SerializeToArray(&mBuffer[HEADER_SIZE], msg_size);
|
message.SerializeToArray(&mBuffer[HEADER_SIZE], msg_size);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << "PackedMessage: type=" << type << ", datalen=" << msg_size << std::endl;
|
std::cerr << "PackedMessage: type=" << type << ", datalen=" << msg_size << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ public:
|
|||||||
typedef boost::shared_ptr< ::google::protobuf::Message > MessagePointer;
|
typedef boost::shared_ptr< ::google::protobuf::Message > MessagePointer;
|
||||||
typedef boost::shared_ptr<PackedMessage> pointer;
|
typedef boost::shared_ptr<PackedMessage> pointer;
|
||||||
|
|
||||||
MessagePointer mMsg;
|
PackedMessage(const ::google::protobuf::Message& message, int type);
|
||||||
PackedMessage(MessagePointer msg, int type);
|
|
||||||
|
|
||||||
std::vector<uint8_t>& getBuffer() { return(mBuffer); }
|
std::vector<uint8_t>& getBuffer() { return(mBuffer); }
|
||||||
|
|
||||||
|
|||||||
63
src/Peer.cpp
63
src/Peer.cpp
@@ -45,7 +45,7 @@ void Peer::handle_write(const boost::system::error_code& error, size_t bytes_tra
|
|||||||
|
|
||||||
if (!mSendQ.empty())
|
if (!mSendQ.empty())
|
||||||
{
|
{
|
||||||
PackedMessage::pointer packet=mSendQ.front();
|
PackedMessage::pointer packet = mSendQ.front();
|
||||||
if(packet)
|
if(packet)
|
||||||
{
|
{
|
||||||
sendPacketForce(packet);
|
sendPacketForce(packet);
|
||||||
@@ -232,7 +232,7 @@ void Peer::connected(const boost::system::error_code& error)
|
|||||||
|
|
||||||
void Peer::sendPacketForce(PackedMessage::pointer packet)
|
void Peer::sendPacketForce(PackedMessage::pointer packet)
|
||||||
{
|
{
|
||||||
mSendingPacket=packet;
|
mSendingPacket = packet;
|
||||||
boost::asio::async_write(mSocketSsl, boost::asio::buffer(packet->getBuffer()),
|
boost::asio::async_write(mSocketSsl, boost::asio::buffer(packet->getBuffer()),
|
||||||
boost::bind(&Peer::handle_write, shared_from_this(),
|
boost::bind(&Peer::handle_write, shared_from_this(),
|
||||||
boost::asio::placeholders::error,
|
boost::asio::placeholders::error,
|
||||||
@@ -419,8 +419,8 @@ void Peer::processReadBuffer()
|
|||||||
|
|
||||||
case newcoin::mtPROPOSE_LEDGER:
|
case newcoin::mtPROPOSE_LEDGER:
|
||||||
{
|
{
|
||||||
boost::shared_ptr<newcoin::TMProposeSet> msg = boost::make_shared<newcoin::TMProposeSet>();
|
newcoin::TMProposeSet msg;
|
||||||
if(msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
|
if(msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
|
||||||
recvPropose(msg);
|
recvPropose(msg);
|
||||||
else std::cerr << "parse error: " << type << std::endl;
|
else std::cerr << "parse error: " << type << std::endl;
|
||||||
}
|
}
|
||||||
@@ -610,18 +610,18 @@ void Peer::recvTransaction(newcoin::TMTransaction& packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Peer::recvPropose(boost::shared_ptr<newcoin::TMProposeSet> packet)
|
void Peer::recvPropose(newcoin::TMProposeSet& packet)
|
||||||
{
|
{
|
||||||
if ((packet->currenttxhash().size() != 32) || (packet->nodepubkey().size() < 28) ||
|
if ((packet.currenttxhash().size() != 32) || (packet.nodepubkey().size() < 28) ||
|
||||||
(packet->signature().size() < 56))
|
(packet.signature().size() < 56))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 closingSeq = packet->closingseq(), proposeSeq = packet->proposeseq();
|
uint32 closingSeq = packet.closingseq(), proposeSeq = packet.proposeseq();
|
||||||
uint256 currentTxHash;
|
uint256 currentTxHash;
|
||||||
memcpy(currentTxHash.begin(), packet->currenttxhash().data(), 32);
|
memcpy(currentTxHash.begin(), packet.currenttxhash().data(), 32);
|
||||||
|
|
||||||
if(theApp->getOPs().proposeLedger(closingSeq, proposeSeq, currentTxHash,
|
if(theApp->getOPs().proposeLedger(closingSeq, proposeSeq, currentTxHash,
|
||||||
packet->nodepubkey(), packet->signature()))
|
packet.nodepubkey(), packet.signature()))
|
||||||
{ // FIXME: Not all nodes will want proposals
|
{ // FIXME: Not all nodes will want proposals
|
||||||
PackedMessage::pointer message = boost::make_shared<PackedMessage>(packet, newcoin::mtPROPOSE_LEDGER);
|
PackedMessage::pointer message = boost::make_shared<PackedMessage>(packet, newcoin::mtPROPOSE_LEDGER);
|
||||||
theApp->getConnectionPool().relayMessage(this, message);
|
theApp->getConnectionPool().relayMessage(this, message);
|
||||||
@@ -718,7 +718,7 @@ void Peer::recvStatus(newcoin::TMStatusChange& packet)
|
|||||||
void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
|
void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
|
||||||
{
|
{
|
||||||
SHAMap::pointer map;
|
SHAMap::pointer map;
|
||||||
boost::shared_ptr<newcoin::TMLedgerData> reply = boost::make_shared<newcoin::TMLedgerData>();
|
newcoin::TMLedgerData reply;
|
||||||
|
|
||||||
if (packet.itype() == newcoin::liTS_CANDIDATE)
|
if (packet.itype() == newcoin::liTS_CANDIDATE)
|
||||||
{ // Request is for a transaction candidate set
|
{ // Request is for a transaction candidate set
|
||||||
@@ -736,8 +736,8 @@ void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
|
|||||||
punishPeer(PP_INVALID_REQUEST);
|
punishPeer(PP_INVALID_REQUEST);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reply->set_ledgerhash(txHash.begin(), txHash.size());
|
reply.set_ledgerhash(txHash.begin(), txHash.size());
|
||||||
reply->set_type(newcoin::liTS_CANDIDATE);
|
reply.set_type(newcoin::liTS_CANDIDATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Figure out what ledger they want
|
{ // Figure out what ledger they want
|
||||||
@@ -777,17 +777,16 @@ void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
|
|||||||
|
|
||||||
// Fill out the reply
|
// Fill out the reply
|
||||||
uint256 lHash = ledger->getHash();
|
uint256 lHash = ledger->getHash();
|
||||||
reply->set_ledgerhash(lHash.begin(), lHash.size());
|
reply.set_ledgerhash(lHash.begin(), lHash.size());
|
||||||
reply->set_ledgerseq(ledger->getLedgerSeq());
|
reply.set_ledgerseq(ledger->getLedgerSeq());
|
||||||
reply->set_type(packet.itype());
|
reply.set_type(packet.itype());
|
||||||
|
|
||||||
if(packet.itype() == newcoin::liBASE)
|
if(packet.itype() == newcoin::liBASE)
|
||||||
{ // they want the ledger base data
|
{ // they want the ledger base data
|
||||||
Serializer nData(128);
|
Serializer nData(128);
|
||||||
ledger->addRaw(nData);
|
ledger->addRaw(nData);
|
||||||
reply->add_nodes()->set_nodedata(nData.getDataPtr(), nData.getLength());
|
reply.add_nodes()->set_nodedata(nData.getDataPtr(), nData.getLength());
|
||||||
PackedMessage::pointer oPacket = boost::make_shared<PackedMessage>
|
PackedMessage::pointer oPacket = boost::make_shared<PackedMessage>(reply, newcoin::mtLEDGER);
|
||||||
(PackedMessage::MessagePointer(reply), newcoin::mtLEDGER);
|
|
||||||
sendPacket(oPacket);
|
sendPacket(oPacket);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -822,14 +821,13 @@ void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
|
|||||||
{
|
{
|
||||||
Serializer nID(33);
|
Serializer nID(33);
|
||||||
nodeIDIterator->addIDRaw(nID);
|
nodeIDIterator->addIDRaw(nID);
|
||||||
newcoin::TMLedgerNode* node = reply->add_nodes();
|
newcoin::TMLedgerNode* node = reply.add_nodes();
|
||||||
node->set_nodeid(nID.getDataPtr(), nID.getLength());
|
node->set_nodeid(nID.getDataPtr(), nID.getLength());
|
||||||
node->set_nodedata(&rawNodeIterator->front(), rawNodeIterator->size());
|
node->set_nodedata(&rawNodeIterator->front(), rawNodeIterator->size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PackedMessage::pointer oPacket = boost::make_shared<PackedMessage>
|
PackedMessage::pointer oPacket = boost::make_shared<PackedMessage>(reply, newcoin::mtLEDGER);
|
||||||
(PackedMessage::MessagePointer(reply), newcoin::mtLEDGER);
|
|
||||||
sendPacket(oPacket);
|
sendPacket(oPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,27 +913,26 @@ void Peer::sendHello()
|
|||||||
|
|
||||||
theApp->getWallet().getNodePrivate().signNodePrivate(mCookieHash, vchSig);
|
theApp->getWallet().getNodePrivate().signNodePrivate(mCookieHash, vchSig);
|
||||||
|
|
||||||
boost::shared_ptr<newcoin::TMHello> h = boost::make_shared<newcoin::TMHello>();
|
newcoin::TMHello h;
|
||||||
|
|
||||||
h->set_version(theConfig.VERSION);
|
h.set_version(theConfig.VERSION);
|
||||||
h->set_ledgerindex(theApp->getOPs().getCurrentLedgerID());
|
h.set_ledgerindex(theApp->getOPs().getCurrentLedgerID());
|
||||||
h->set_nettime(theApp->getOPs().getNetworkTimeNC());
|
h.set_nettime(theApp->getOPs().getNetworkTimeNC());
|
||||||
h->set_nodepublic(theApp->getWallet().getNodePublic().humanNodePublic());
|
h.set_nodepublic(theApp->getWallet().getNodePublic().humanNodePublic());
|
||||||
h->set_nodeproof(&vchSig[0], vchSig.size());
|
h.set_nodeproof(&vchSig[0], vchSig.size());
|
||||||
h->set_ipv4port(theConfig.PEER_PORT);
|
h.set_ipv4port(theConfig.PEER_PORT);
|
||||||
|
|
||||||
Ledger::pointer closedLedger = theApp->getMasterLedger().getClosedLedger();
|
Ledger::pointer closedLedger = theApp->getMasterLedger().getClosedLedger();
|
||||||
assert(closedLedger && closedLedger->isClosed());
|
assert(closedLedger && closedLedger->isClosed());
|
||||||
if (closedLedger->isClosed())
|
if (closedLedger->isClosed())
|
||||||
{
|
{
|
||||||
uint256 hash = closedLedger->getHash();
|
uint256 hash = closedLedger->getHash();
|
||||||
h->set_closedledger(hash.begin(), hash.GetSerializeSize());
|
h.set_closedledger(hash.begin(), hash.GetSerializeSize());
|
||||||
hash = closedLedger->getParentHash();
|
hash = closedLedger->getParentHash();
|
||||||
h->set_previousledger(hash.begin(), hash.GetSerializeSize());
|
h.set_previousledger(hash.begin(), hash.GetSerializeSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
PackedMessage::pointer packet = boost::make_shared<PackedMessage>
|
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(h, newcoin::mtHELLO);
|
||||||
(PackedMessage::MessagePointer(h), newcoin::mtHELLO);
|
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ protected:
|
|||||||
void recvGetLedger(newcoin::TMGetLedger& packet);
|
void recvGetLedger(newcoin::TMGetLedger& packet);
|
||||||
void recvLedger(newcoin::TMLedgerData& packet);
|
void recvLedger(newcoin::TMLedgerData& packet);
|
||||||
void recvStatus(newcoin::TMStatusChange& packet);
|
void recvStatus(newcoin::TMStatusChange& packet);
|
||||||
void recvPropose(boost::shared_ptr<newcoin::TMProposeSet> packet);
|
void recvPropose(newcoin::TMProposeSet& packet);
|
||||||
void recvHaveTxSet(newcoin::TMHaveTransactionSet& packet);
|
void recvHaveTxSet(newcoin::TMHaveTransactionSet& packet);
|
||||||
|
|
||||||
void getSessionCookie(std::string& strDst);
|
void getSessionCookie(std::string& strDst);
|
||||||
|
|||||||
Reference in New Issue
Block a user