@@ -876,42 +876,72 @@ func TestTransactionGapFilling(t *testing.T) {
876
876
// (a) to set pool.donut = false at its start (so we can add unprotected transactions)
877
877
// (b) different functions to generate protected vs unprotected transactions, since we will
878
878
// need to update transaction() and the others to use replay protection
879
- func TestHandleDonutActivation (t * testing.T ) {
879
+ func TestPoolReAcceptingUnprotectedTxsFromEFork (t * testing.T ) {
880
880
t .Parallel ()
881
881
882
- // Create a test account and fund it
883
882
pool , key := setupTxPool ()
883
+ // Create a test account and fund it
884
884
defer pool .Stop ()
885
885
886
886
account := crypto .PubkeyToAddress (key .PublicKey )
887
887
pool .currentState .AddBalance (account , big .NewInt (1000000 ))
888
888
889
+ // flag it as before donut
890
+ pool .donut = false
891
+ pool .eHardfork = false
892
+
889
893
pool .AddRemotesSync ([]* types.Transaction {
890
894
protectedTransaction (0 , 100000 , key ),
891
895
transaction (1 , 100000 , key ),
892
- protectedTransaction (2 , 100000 , key ),
893
- transaction (7 , 100000 , key ),
894
- protectedTransaction (8 , 100000 , key ),
895
- transaction (9 , 100000 , key ),
896
- transaction (10 , 100000 , key ),
896
+
897
+ protectedTransaction (10 , 100000 , key ),
898
+ transaction (11 , 100000 , key ),
897
899
})
898
900
899
901
pending , queued := pool .Stats ()
902
+ if pending != 2 {
903
+ t .Fatalf ("before donut, pending transactions mismatched: have %d, want %d" , pending , 2 )
904
+ }
905
+ if queued != 2 {
906
+ t .Fatalf ("before donut, queued transactions mismatched: have %d, want %d" , queued , 2 )
907
+ }
908
+
909
+ // In donut fork
910
+ pool .donut = true
911
+
912
+ pool .AddRemotesSync ([]* types.Transaction {
913
+ protectedTransaction (2 , 100000 , key ),
914
+ transaction (3 , 100000 , key ),
915
+
916
+ protectedTransaction (12 , 100000 , key ),
917
+ transaction (13 , 100000 , key ),
918
+ })
919
+
920
+ pending , queued = pool .Stats ()
900
921
if pending != 3 {
901
- t .Fatalf ("pending transactions mismatched: have %d, want %d" , pending , 3 )
922
+ t .Fatalf ("after donut, pending transactions mismatched: have %d, want %d" , pending , 3 )
902
923
}
903
- if queued != 4 {
904
- t .Fatalf ("queued transactions mismatched: have %d, want %d" , queued , 4 )
924
+ if queued != 3 {
925
+ t .Fatalf ("after donut, queued transactions mismatched: have %d, want %d" , queued , 3 )
905
926
}
906
927
907
- pool .handleDonutActivation ()
928
+ // In E fork
929
+ // flag it as E hard fork
930
+ pool .eHardfork = true
931
+ pool .AddRemotesSync ([]* types.Transaction {
932
+ transaction (3 , 100000 , key ),
933
+ protectedTransaction (4 , 100000 , key ),
934
+
935
+ transaction (13 , 100000 , key ),
936
+ protectedTransaction (14 , 100000 , key ),
937
+ })
908
938
909
939
pending , queued = pool .Stats ()
910
- if pending != 1 {
911
- t .Fatalf ("pending transactions mismatched: have %d, want %d" , pending , 1 )
940
+ if pending != 5 {
941
+ t .Fatalf ("after expresso, pending transactions mismatched: have %d, want %d" , pending , 5 )
912
942
}
913
- if queued != 2 {
914
- t .Fatalf ("queued transactions mismatched: have %d, want %d" , queued , 2 )
943
+ if queued != 5 {
944
+ t .Fatalf ("after expresso, queued transactions mismatched: have %d, want %d" , queued , 5 )
915
945
}
916
946
917
947
if err := validateTxPoolInternals (pool ); err != nil {
0 commit comments