@@ -958,22 +958,15 @@ func (t *Transitive) deliver(
958
958
// longer pending
959
959
t .removeFromPending (blk )
960
960
961
- blkID := blk .ID ()
962
- if t .isDecided (blk ) || t .Consensus .Processing (blkID ) {
963
- // If [blk] is decided, then it shouldn't be added to consensus.
964
- // Similarly, if [blkID] is already in the processing set, it shouldn't
965
- // be added to consensus again.
966
- return t .blocked .Abandon (ctx , blkID )
967
- }
968
-
969
- parentID := blk .Parent ()
970
- parent , err := t .getBlock (ctx , parentID )
971
- // Because the dependency must have been fulfilled by the time this function
972
- // is called - we don't expect [err] to be non-nil. But it is handled for
973
- // completeness and future proofing.
974
- if err != nil || ! (parent .Status () == choices .Accepted || t .Consensus .Processing (parentID )) {
975
- // if the parent isn't processing or the last accepted block, then this
976
- // block is effectively rejected
961
+ var (
962
+ parentID = blk .Parent ()
963
+ blkID = blk .ID ()
964
+ )
965
+ if ! t .canIssueChildOn (parentID ) || t .Consensus .Processing (blkID ) {
966
+ // If the parent isn't processing or the last accepted block, then this
967
+ // block is effectively rejected.
968
+ // Additionally, if [blkID] is already in the processing set, it
969
+ // shouldn't be added to consensus again.
977
970
return t .blocked .Abandon (ctx , blkID )
978
971
}
979
972
@@ -1183,6 +1176,13 @@ func (t *Transitive) getProcessingAncestor(ctx context.Context, initialVote ids.
1183
1176
}
1184
1177
}
1185
1178
1179
+ // canIssueChildOn reports true if it is valid for a child of parentID to be
1180
+ // verified and added to consensus.
1181
+ func (t * Transitive ) canIssueChildOn (parentID ids.ID ) bool {
1182
+ lastAcceptedID , _ := t .Consensus .LastAccepted ()
1183
+ return parentID == lastAcceptedID || t .Consensus .Processing (parentID )
1184
+ }
1185
+
1186
1186
// isDecided reports true if the provided block's status is Accepted, Rejected,
1187
1187
// or if the block's height implies that the block is either Accepted or
1188
1188
// Rejected.
0 commit comments