Skip to content

Commit 69489b2

Browse files
committed
#1003 move bite2patch condition to BlockSignBroadcastMessage
1 parent aa755af commit 69489b2

3 files changed

Lines changed: 5 additions & 19 deletions

File tree

protocols/blockconsensus/BlockConsensusAgent.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,27 +213,19 @@ void BlockConsensusAgent::decideBlock(
213213
<< to_string( _sChainIndex ) << ":BID:" + to_string( _blockId ) << ":STATS:|"
214214
<< _stats << "| Now signing block ..." );
215215

216-
217-
#ifdef BITE2
218-
bool isBite2PatchEnabled = getSchain()->bite2Patch( getSchain()->getLastCommittedBlockTimeStamp().getS() );
219-
#endif
220-
221216
auto msg = make_shared< BlockSignBroadcastMessage >(
222217
_blockId,
223218
#ifdef BITE
224219
getSchain()->getNode()->getCurrentEpochId(),
225220
#endif
226-
_sChainIndex, Time::getCurrentTimeMs(), *this
227-
#ifdef BITE2
228-
, isBite2PatchEnabled
229-
#endif
230-
);
221+
_sChainIndex, Time::getCurrentTimeMs(), *this );
231222

232223
auto signature = getSchain()->getNode()->getBlockSigShareDB()->checkAndSaveShareInMemory(
233224
msg->getSigShare(), getSchain()->getCryptoManager(), _sChainIndex );
234225

235226

236227
#ifdef BITE2
228+
bool isBite2PatchEnabled = getSchain()->bite2Patch( getSchain()->getLastCommittedBlockTimeStamp().getS() );
237229
ptr<ThresholdSignature> reencryptionSignature;
238230
if ( isBite2PatchEnabled ) {
239231
reencryptionSignature = getSchain()->getNode()->getOffchainBlockSigShareDB()->checkAndSaveShareInMemory(

protocols/blockconsensus/BlockSignBroadcastMessage.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ BlockSignBroadcastMessage::BlockSignBroadcastMessage( block_id _blockID,
5858
epoch_id _epochID,
5959
#endif
6060
schain_index _blockProposerIndex, uint64_t _time, ProtocolInstance& _sourceProtocolInstance
61-
#ifdef BITE2
62-
, bool _includeReencryptionSigShare
63-
#endif
6461
)
6562
: NetworkMessage( MSG_BLOCK_SIGN_BROADCAST, _blockID,
6663
#ifdef BITE
@@ -78,7 +75,8 @@ BlockSignBroadcastMessage::BlockSignBroadcastMessage( block_id _blockID,
7875
this->sigShareString = sigShare->toString();
7976

8077
#ifdef BITE2
81-
if ( _includeReencryptionSigShare ) {
78+
bool isBite2PatchEnabled = schain->bite2Patch( schain->getLastCommittedBlockTimeStamp().getS() );
79+
if ( isBite2PatchEnabled ) {
8280
// compute additional offchain signature using domain separation.
8381
// This signature will be used to derive a random value seen only by validators.
8482
auto& signatureDomain = blockconsensus::REENCRYPTION_RANDOM_DOMAIN;

protocols/blockconsensus/BlockSignBroadcastMessage.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ class BlockSignBroadcastMessage : public NetworkMessage {
4343
epoch_id _epochID,
4444
#endif
4545
schain_index _blockProposerIndex, uint64_t _time,
46-
ProtocolInstance& _sourceProtocolInstance
47-
#ifdef BITE2
48-
, bool _includeReencryptionSigShare = false
49-
#endif
50-
);
46+
ProtocolInstance& _sourceProtocolInstance );
5147

5248
BlockSignBroadcastMessage( node_id _srcNodeID, block_id _blockID,
5349
#ifdef BITE

0 commit comments

Comments
 (0)