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