Procházet zdrojové kódy

notary: delay Rejected messages instead of dropping (#4522)

John Saigle před 1 měsícem
rodič
revize
f83066034a
2 změnil soubory, kde provedl 12 přidání a 9 odebrání
  1. 4 4
      node/pkg/notary/notary.go
  2. 8 5
      node/pkg/notary/notary_test.go

+ 4 - 4
node/pkg/notary/notary.go

@@ -189,12 +189,12 @@ func (n *Notary) ProcessMsg(msg *common.MessagePublication) (v Verdict, err erro
 	}
 
 	switch msg.VerificationState() {
-	case common.Anomalous:
+	// Both Anomalous and Rejected messages are delayed. In the future, we could consider blackholing
+	// rejected messages, but for now, we are choosing the cautious approach of delaying VAA production
+	// rather than rejecting them permanently.
+	case common.Anomalous, common.Rejected:
 		err = n.delay(msg, DelayFor)
 		v = Delay
-	case common.Rejected:
-		err = n.blackhole(msg)
-		v = Blackhole
 	case common.Valid:
 		v = Approve
 	case common.CouldNotVerify, common.NotVerified, common.NotApplicable:

+ 8 - 5
node/pkg/notary/notary_test.go

@@ -66,9 +66,10 @@ func TestNotary_ProcessMessageCorrectVerdict(t *testing.T) {
 			common.CouldNotVerify,
 			Approve,
 		},
-		"blackhole rejected": {
+		// Blackhole verdict is not being used for Rejected messages in the initial implementation
+		"delay rejected": {
 			common.Rejected,
-			Blackhole,
+			Delay,
 		},
 		"delay anomalous": {
 			common.Anomalous,
@@ -134,11 +135,13 @@ func TestNotary_ProcessMsgUpdatesCollections(t *testing.T) {
 				blackholed: 0,
 			},
 		},
-		"Rejected gets blackholed": {
+
+		// Blackhole verdict is not being used for Rejected messages in the initial implementation
+		"Rejected gets delayed": {
 			common.Rejected,
 			expectedSizes{
-				delayed:    0,
-				blackholed: 1,
+				delayed:    1,
+				blackholed: 0,
 			},
 		},
 	}