67
67
68
68
if let Some ( shallow_update) = self . shallow_verify_memo ( zalsa, database_key_index, memo)
69
69
{
70
- if self . validate_may_be_provisional ( db , zalsa , database_key_index , memo ) {
70
+ if !memo . may_be_provisional ( ) {
71
71
self . update_shallow ( db, zalsa, database_key_index, memo, shallow_update) ;
72
72
73
73
return if memo. revisions . changed_at > revision {
@@ -236,9 +236,11 @@ where
236
236
}
237
237
}
238
238
239
- /// Validates this memo if it is a provisional memo. Returns true for non provisional memos or
240
- /// if the provisional memo has been successfully marked as verified final, that is, its
241
- /// cycle heads have all been finalized.
239
+ /// Validates this memo if it is a provisional memo. Returns true for:
240
+ /// * non provisional memos
241
+ /// * provisional memos that have been successfully marked as verified final, that is, its
242
+ /// cycle heads have all been finalized.
243
+ /// * provisional memos that have been created in the same revision and iteration and are part of the same cycle.
242
244
#[ inline]
243
245
pub ( super ) fn validate_may_be_provisional (
244
246
& self ,
@@ -247,9 +249,9 @@ where
247
249
database_key_index : DatabaseKeyIndex ,
248
250
memo : & Memo < C :: Output < ' _ > > ,
249
251
) -> bool {
250
- // Wouldn't it be nice if rust had an implication operator ...
251
- // may_be_provisional -> validate_provisional
252
- !memo . may_be_provisional ( ) || self . validate_provisional ( db, zalsa , database_key_index, memo)
252
+ !memo . may_be_provisional ( )
253
+ || self . validate_provisional ( db , zalsa , database_key_index , memo )
254
+ || self . validate_same_iteration ( db, database_key_index, memo)
253
255
}
254
256
255
257
/// Check if this memo's cycle heads have all been finalized. If so, mark it verified final and
@@ -353,9 +355,7 @@ where
353
355
let shallow_update = self . shallow_verify_memo ( zalsa, database_key_index, old_memo) ;
354
356
let shallow_update_possible = shallow_update. is_some ( ) ;
355
357
if let Some ( shallow_update) = shallow_update {
356
- if self . validate_may_be_provisional ( db, zalsa, database_key_index, old_memo)
357
- || self . validate_same_iteration ( db, database_key_index, old_memo)
358
- {
358
+ if self . validate_may_be_provisional ( db, zalsa, database_key_index, old_memo) {
359
359
self . update_shallow ( db, zalsa, database_key_index, old_memo, shallow_update) ;
360
360
361
361
return VerifyResult :: unchanged ( ) ;
0 commit comments