Fix proposal relaying (RIPD-1057):

Stash the signature so we can relay a proposal later
This commit is contained in:
JoelKatz
2015-12-07 12:06:19 -08:00
committed by Nik Bougalis
parent bb944466f2
commit 4f40e94c99
4 changed files with 52 additions and 13 deletions

View File

@@ -1324,7 +1324,7 @@ void LedgerConsensusImp::propose ()
Blob const pubKey = mValPublic.getNodePublic ();
prop.set_nodepubkey (&pubKey[0], pubKey.size ());
Blob const sig = mOurPosition->sign (mValPrivate);
Blob const& sig = mOurPosition->sign (mValPrivate);
prop.set_signature (&sig[0], sig.size ());
app_.overlay().send(prop);
@@ -1650,7 +1650,28 @@ void LedgerConsensusImp::playbackProposals ()
if (proposal->isPrevLedger (mPrevLedgerHash) &&
peerPosition (proposal))
{
// FIXME: Should do delayed relay
// Now that we know this proposal
// is useful, relay it
protocol::TMProposeSet prop;
prop.set_proposeseq (
proposal->getProposeSeq ());
prop.set_closetime (
proposal->getCloseTime ().time_since_epoch().count());
prop.set_currenttxhash (
proposal->getCurrentHash().begin(), 256 / 8);
prop.set_previousledger (
proposal->getPrevLedger().begin(), 256 / 8);
auto const pubKey = proposal->getPublicKey().getNodePublic ();
prop.set_nodepubkey (&pubKey[0], pubKey.size());
auto const& signature = proposal->getSignature();
prop.set_signature (&signature[0], signature.size());
app_.overlay().relay (
prop, proposal->getSuppressionID ());
}
});
}