This commit is contained in:
JoelKatz
2012-05-28 17:25:51 -07:00
parent 32534e8d0d
commit 06535a1a43
2 changed files with 8 additions and 7 deletions

View File

@@ -386,14 +386,14 @@ int NetworkOPs::beginConsensus(Ledger::pointer closingLedger, bool isEarly)
return mConsensus->startup();
}
bool NetworkOPs::proposeLedger(uint32 closingSeq, uint32 proposeSeq, const uint256& proposeHash,
bool NetworkOPs::proposeLedger(const uint256& prevLgr, uint32 proposeSeq, const uint256& proposeHash,
const std::string& pubKey, const std::string& signature)
{
if (mMode != omFULL)
return true;
LedgerProposal::pointer proposal =
boost::make_shared<LedgerProposal>(closingSeq, proposeSeq, proposeHash, pubKey);
boost::make_shared<LedgerProposal>(prevLgr, proposeSeq, proposeHash, pubKey);
if (!proposal->checkSign(signature))
{
std::cerr << "Ledger proposal fails signature check" << std::endl;

View File

@@ -612,15 +612,16 @@ void Peer::recvTransaction(newcoin::TMTransaction& packet)
void Peer::recvPropose(newcoin::TMProposeSet& packet)
{
if ((packet.currenttxhash().size() != 32) || (packet.nodepubkey().size() < 28) ||
(packet.signature().size() < 56))
if ((packet.currenttxhash().size() != 32) || (packet.prevclosedhash().size() != 32) ||
(packet.nodepubkey().size() < 28) || (packet.signature().size() < 56))
return;
uint32 closingSeq = packet.closingseq(), proposeSeq = packet.proposeseq();
uint256 currentTxHash;
uint32 proposeSeq = packet.proposeseq();
uint256 currentTxHash, prevLgrHash;
memcpy(currentTxHash.begin(), packet.currenttxhash().data(), 32);
memcpy(prevLgrHash.begin(), packet.prevclosedhash().data(), 32);
if(theApp->getOPs().proposeLedger(closingSeq, proposeSeq, currentTxHash,
if(theApp->getOPs().proposeLedger(prevLgrHash, proposeSeq, currentTxHash,
packet.nodepubkey(), packet.signature()))
{ // FIXME: Not all nodes will want proposals
PackedMessage::pointer message = boost::make_shared<PackedMessage>(packet, newcoin::mtPROPOSE_LEDGER);