From c70f66b286da1c1287e82d3265d360312e2de58b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 23 Jun 2012 22:16:33 -0700 Subject: [PATCH] Fix a bug I just introduced. --- src/NetworkOPs.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 7931e0bf2c..786641ceb5 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -521,12 +521,13 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, // XXX Validate key. // XXX Take a vuc for pubkey. - NewcoinAddress naPeerPublic = NewcoinAddress::createNodePublic(strCopy(pubKey)); - LedgerProposal::pointer proposal = - boost::make_shared(mConsensus->getLCL(), proposeSeq, proposeHash, naPeerPublic); - uint256 signingHash = proposal->getSigningHash(); - if (!theApp->isNew(signingHash)) + // Get a preliminary hash to use to suppress duplicates + Serializer s; + s.add32(proposeSeq); + s.add32(getCurrentLedgerID()); + s.addRaw(pubKey); + if (!theApp->isNew(s.getSHA512Half())) return false; if ((mMode != omFULL) && (mMode != omTRACKING)) @@ -541,7 +542,10 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, return false; } - if (!proposal->checkSign(signature, signingHash)) + NewcoinAddress naPeerPublic = NewcoinAddress::createNodePublic(strCopy(pubKey)); + LedgerProposal::pointer proposal = + boost::make_shared(mConsensus->getLCL(), proposeSeq, proposeHash, naPeerPublic); + if (!proposal->checkSign(signature)) { // Note that if the LCL is different, the signature check will fail Log(lsWARNING) << "Ledger proposal fails signature check"; return false;