mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Track the suppression in the ledger proposal.
This commit is contained in:
@@ -18,7 +18,7 @@ class LedgerProposal : private IS_INSTANCE(LedgerProposal)
|
||||
{
|
||||
protected:
|
||||
|
||||
uint256 mPreviousLedger, mCurrentHash;
|
||||
uint256 mPreviousLedger, mCurrentHash, mSuppression;
|
||||
uint32 mCloseTime, mProposeSeq;
|
||||
|
||||
uint160 mPeerID;
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
// proposal from peer
|
||||
LedgerProposal(const uint256& prevLgr, uint32 proposeSeq, const uint256& propose,
|
||||
uint32 closeTime, const RippleAddress& naPeerPublic);
|
||||
uint32 closeTime, const RippleAddress& naPeerPublic, const uint256& suppress);
|
||||
|
||||
// our first proposal
|
||||
LedgerProposal(const RippleAddress& pubKey, const RippleAddress& privKey,
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
const uint160& getPeerID() const { return mPeerID; }
|
||||
const uint256& getCurrentHash() const { return mCurrentHash; }
|
||||
const uint256& getPrevLedger() const { return mPreviousLedger; }
|
||||
const uint256& getSuppression() const { return mSuppression; }
|
||||
uint32 getProposeSeq() const { return mProposeSeq; }
|
||||
uint32 getCloseTime() const { return mCloseTime; }
|
||||
const RippleAddress& peekPublic() const { return mPublicKey; }
|
||||
|
||||
@@ -168,8 +168,7 @@ public:
|
||||
const std::vector<unsigned char>& myNode, std::list< std::vector<unsigned char> >& newNodes);
|
||||
|
||||
// ledger proposal/close functions
|
||||
void processTrustedProposal(uint256 supression, LedgerProposal::pointer proposal,
|
||||
boost::shared_ptr<ripple::TMProposeSet> set,
|
||||
void processTrustedProposal(LedgerProposal::pointer proposal, boost::shared_ptr<ripple::TMProposeSet> set,
|
||||
RippleAddress nodePublic, uint256 checkLedger, bool sigGood);
|
||||
bool gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
|
||||
|
||||
30
src/Peer.cpp
30
src/Peer.cpp
@@ -776,9 +776,8 @@ void Peer::recvTransaction(ripple::TMTransaction& packet)
|
||||
}
|
||||
|
||||
static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packet,
|
||||
uint256 suppression, LedgerProposal::pointer proposal, uint256 consensusLCL,
|
||||
RippleAddress nodePublic, boost::weak_ptr<Peer> peer)
|
||||
{ // FIXME: Suppress relaying proposals with incorrect LCLs
|
||||
LedgerProposal::pointer proposal, uint256 consensusLCL, RippleAddress nodePublic, boost::weak_ptr<Peer> peer)
|
||||
{
|
||||
bool sigGood = false;
|
||||
bool isTrusted = (job.getType() == jtPROPOSAL_t);
|
||||
|
||||
@@ -818,16 +817,18 @@ static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packe
|
||||
if (isTrusted)
|
||||
{
|
||||
theApp->getIOService().post(boost::bind(&NetworkOPs::processTrustedProposal, &theApp->getOPs(),
|
||||
suppression, proposal, packet, nodePublic, prevLedger, sigGood));
|
||||
proposal, packet, nodePublic, prevLedger, sigGood));
|
||||
}
|
||||
else
|
||||
{ // untrusted proposal, just relay it
|
||||
else if (sigGood && (prevLedger == consensusLCL))
|
||||
{ // relay untrusted proposal
|
||||
cLog(lsTRACE) << "relaying untrusted proposal";
|
||||
std::set<uint64> peers;
|
||||
theApp->getSuppression().swapSet(suppression, peers, SF_RELAYED);
|
||||
std::set<uint64> peers;
|
||||
theApp->getSuppression().swapSet(proposal->getSuppression(), peers, SF_RELAYED);
|
||||
PackedMessage::pointer message = boost::make_shared<PackedMessage>(set, ripple::mtPROPOSE_LEDGER);
|
||||
theApp->getConnectionPool().relayMessageBut(peers, message);
|
||||
}
|
||||
else
|
||||
cLog(lsDEBUG) << "Not relaying untrusted proposal";
|
||||
}
|
||||
|
||||
void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet)
|
||||
@@ -839,19 +840,20 @@ void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet)
|
||||
(set.signature().size() < 56) || (set.nodepubkey().size() > 128) || (set.signature().size() > 128))
|
||||
{
|
||||
cLog(lsWARNING) << "Received proposal is malformed";
|
||||
punishPeer(PP_INVALID_REQUEST);
|
||||
return;
|
||||
}
|
||||
|
||||
if (set.has_previousledger() && (set.previousledger().size() != 32))
|
||||
{
|
||||
cLog(lsWARNING) << "Received proposal is malformed";
|
||||
punishPeer(PP_INVALID_REQUEST);
|
||||
return;
|
||||
}
|
||||
|
||||
uint256 proposeHash, prevLedger;
|
||||
memcpy(proposeHash.begin(), set.currenttxhash().data(), 32);
|
||||
|
||||
if ((set.has_previousledger()) && (set.previousledger().size() == 32))
|
||||
if (set.has_previousledger())
|
||||
memcpy(prevLedger.begin(), set.previousledger().data(), 32);
|
||||
|
||||
Serializer s(512);
|
||||
@@ -882,10 +884,10 @@ void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet)
|
||||
uint256 consensusLCL = theApp->getOPs().getConsensusLCL();
|
||||
LedgerProposal::pointer proposal = boost::make_shared<LedgerProposal>(
|
||||
prevLedger.isNonZero() ? prevLedger : consensusLCL,
|
||||
set.proposeseq(), proposeHash, set.closetime(), signerPublic);
|
||||
set.proposeseq(), proposeHash, set.closetime(), signerPublic, suppression);
|
||||
|
||||
theApp->getJobQueue().addJob(isTrusted ? jtPROPOSAL_t : jtPROPOSAL_ut,
|
||||
boost::bind(&checkPropose, _1, packet, suppression, proposal, consensusLCL,
|
||||
boost::bind(&checkPropose, _1, packet, proposal, consensusLCL,
|
||||
mNodePublic, boost::weak_ptr<Peer>(shared_from_this())));
|
||||
}
|
||||
|
||||
@@ -1157,7 +1159,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet)
|
||||
reply.set_requestcookie(packet.requestcookie());
|
||||
|
||||
if (packet.itype() == ripple::liTS_CANDIDATE)
|
||||
{ // Request is for a transaction candidate set
|
||||
{ // Request is for a transaction candidate set
|
||||
cLog(lsINFO) << "Received request for TX candidate set data " << getIP();
|
||||
if ((!packet.has_ledgerhash() || packet.ledgerhash().size() != 32))
|
||||
{
|
||||
@@ -1488,7 +1490,7 @@ Json::Value Peer::getJson()
|
||||
|
||||
if (mHello.has_protoversion() &&
|
||||
(mHello.protoversion() != MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR)))
|
||||
ret["protocol"] = boost::lexical_cast<std::string>(GET_VERSION_MAJOR(mHello.protoversion())) + "." +
|
||||
ret["protocol"] = boost::lexical_cast<std::string>(GET_VERSION_MAJOR(mHello.protoversion())) + "." +
|
||||
boost::lexical_cast<std::string>(GET_VERSION_MINOR(mHello.protoversion()));
|
||||
|
||||
if (!!mClosedLedgerHash)
|
||||
|
||||
Reference in New Issue
Block a user