@@ -19,6 +19,7 @@ Pre_prepare::Pre_prepare(
1919 Seqno s,
2020 Req_queue& reqs,
2121 size_t & requests_in_batch,
22+ uint64_t nonce_,
2223 Prepared_cert* prepared_cert) :
2324 Message(
2425 Pre_prepare_tag,
@@ -29,14 +30,21 @@ Pre_prepare::Pre_prepare(
2930 pbft::GlobalState::get_node().auth_size() + // Merkle root signature
3031 (pbft_max_signature_size + sizeof (uint64_t )) *
3132 pbft::GlobalState::get_node()
32- .num_of_replicas()) // signatures for the previous pre_prepare
33+ .num_of_replicas()), // signatures for the previous pre_prepare
34+ nonce(nonce_)
3335{
3436 rep ().view = v;
3537 rep ().seqno = s;
3638 rep ().replicated_state_merkle_root .fill (0 );
3739 rep ().contains_gov_req = false ;
3840 rep ().last_gov_req_updated = 0 ;
3941
42+ Digest dh;
43+ Digest::Context context;
44+ dh.update_last (context, (char *)&nonce_, sizeof (uint64_t ));
45+ dh.finalize (context);
46+ rep ().hashed_nonce = dh;
47+
4048 START_CC (pp_digest_cycles);
4149 INCR_OP (pp_digest);
4250
@@ -258,6 +266,7 @@ bool Pre_prepare::calculate_digest(Digest& d)
258266 rep ().replicated_state_merkle_root .size ());
259267 d.update_last (context, (char *)&rep ().contains_gov_req , sizeof (uint64_t ));
260268 d.update_last (context, (char *)&rep ().last_gov_req_updated , sizeof (Seqno));
269+ d.update_last (context, (char *)&rep ().hashed_nonce , sizeof (uint64_t ));
261270 d.update_last (context, (char *)&rep ().ctx , sizeof (rep ().ctx ));
262271 d.update_last (context, (char *)&rep ().rset_size , sizeof (rep ().rset_size ));
263272 d.update_last (context, (char *)&rep ().n_big_reqs , sizeof (rep ().n_big_reqs ));
0 commit comments