@@ -1011,56 +1011,6 @@ func (p *BlobPool) reinject(addr common.Address, txhash common.Hash) error {
1011
1011
return nil
1012
1012
}
1013
1013
1014
- func (p * BlobPool ) flushTransactionsBelowTip (tip * uint256.Int ) {
1015
- for addr , txs := range p .index {
1016
- for i , tx := range txs {
1017
- if tx .execTipCap .Cmp (tip ) < 0 {
1018
- // Drop the offending transaction
1019
- var (
1020
- ids = []uint64 {tx .id }
1021
- nonces = []uint64 {tx .nonce }
1022
- )
1023
- p .spent [addr ] = new (uint256.Int ).Sub (p .spent [addr ], txs [i ].costCap )
1024
- p .stored -= uint64 (tx .size )
1025
- delete (p .lookup , tx .hash )
1026
- txs [i ] = nil
1027
-
1028
- // Drop everything afterwards, no gaps allowed
1029
- for j , tx := range txs [i + 1 :] {
1030
- ids = append (ids , tx .id )
1031
- nonces = append (nonces , tx .nonce )
1032
-
1033
- p .spent [addr ] = new (uint256.Int ).Sub (p .spent [addr ], tx .costCap )
1034
- p .stored -= uint64 (tx .size )
1035
- delete (p .lookup , tx .hash )
1036
- txs [i + 1 + j ] = nil
1037
- }
1038
- // Clear out the dropped transactions from the index
1039
- if i > 0 {
1040
- p .index [addr ] = txs [:i ]
1041
- heap .Fix (p .evict , p .evict .index [addr ])
1042
- } else {
1043
- delete (p .index , addr )
1044
- delete (p .spent , addr )
1045
-
1046
- heap .Remove (p .evict , p .evict .index [addr ])
1047
- p .reserve (addr , false )
1048
- }
1049
- // Clear out the transactions from the data store
1050
- log .Warn ("Dropping underpriced blob transaction" , "from" , addr , "rejected" , tx .nonce , "tip" , tx .execTipCap , "want" , tip , "drop" , nonces , "ids" , ids )
1051
- dropUnderpricedMeter .Mark (int64 (len (ids )))
1052
-
1053
- for _ , id := range ids {
1054
- if err := p .store .Delete (id ); err != nil {
1055
- log .Error ("Failed to delete dropped transaction" , "id" , id , "err" , err )
1056
- }
1057
- }
1058
- break
1059
- }
1060
- }
1061
- }
1062
- }
1063
-
1064
1014
// SetGasTip implements txpool.SubPool, allowing the blob pool's gas requirements
1065
1015
// to be kept in sync with the main transaction pool's gas requirements.
1066
1016
func (p * BlobPool ) SetGasTip (tip * big.Int ) {
@@ -1073,20 +1023,59 @@ func (p *BlobPool) SetGasTip(tip *big.Int) {
1073
1023
1074
1024
// If the min miner fee increased, remove transactions below the new threshold
1075
1025
if old == nil || p .gasTip .Cmp (old ) > 0 {
1076
- p .flushTransactionsBelowTip (p .gasTip )
1026
+ for addr , txs := range p .index {
1027
+ for i , tx := range txs {
1028
+ if tx .execTipCap .Cmp (p .gasTip ) < 0 {
1029
+ // Drop the offending transaction
1030
+ var (
1031
+ ids = []uint64 {tx .id }
1032
+ nonces = []uint64 {tx .nonce }
1033
+ )
1034
+ p .spent [addr ] = new (uint256.Int ).Sub (p .spent [addr ], txs [i ].costCap )
1035
+ p .stored -= uint64 (tx .size )
1036
+ delete (p .lookup , tx .hash )
1037
+ txs [i ] = nil
1038
+
1039
+ // Drop everything afterwards, no gaps allowed
1040
+ for j , tx := range txs [i + 1 :] {
1041
+ ids = append (ids , tx .id )
1042
+ nonces = append (nonces , tx .nonce )
1043
+
1044
+ p .spent [addr ] = new (uint256.Int ).Sub (p .spent [addr ], tx .costCap )
1045
+ p .stored -= uint64 (tx .size )
1046
+ delete (p .lookup , tx .hash )
1047
+ txs [i + 1 + j ] = nil
1048
+ }
1049
+ // Clear out the dropped transactions from the index
1050
+ if i > 0 {
1051
+ p .index [addr ] = txs [:i ]
1052
+ heap .Fix (p .evict , p .evict .index [addr ])
1053
+ } else {
1054
+ delete (p .index , addr )
1055
+ delete (p .spent , addr )
1056
+
1057
+ heap .Remove (p .evict , p .evict .index [addr ])
1058
+ p .reserve (addr , false )
1059
+ }
1060
+ // Clear out the transactions from the data store
1061
+ log .Warn ("Dropping underpriced blob transaction" , "from" , addr , "rejected" , tx .nonce , "tip" , tx .execTipCap , "want" , tip , "drop" , nonces , "ids" , ids )
1062
+ dropUnderpricedMeter .Mark (int64 (len (ids )))
1063
+
1064
+ for _ , id := range ids {
1065
+ if err := p .store .Delete (id ); err != nil {
1066
+ log .Error ("Failed to delete dropped transaction" , "id" , id , "err" , err )
1067
+ }
1068
+ }
1069
+ break
1070
+ }
1071
+ }
1072
+ }
1077
1073
}
1078
1074
log .Debug ("Blobpool tip threshold updated" , "tip" , tip )
1079
1075
pooltipGauge .Update (tip .Int64 ())
1080
1076
p .updateStorageMetrics ()
1081
1077
}
1082
1078
1083
- func (p * BlobPool ) FlushAllTransactions () {
1084
- maxUint256 := uint256 .MustFromBig (new (big.Int ).Sub (new (big.Int ).Lsh (common .Big1 , 256 ), common .Big1 ))
1085
- p .lock .Lock ()
1086
- defer p .lock .Unlock ()
1087
- p .flushTransactionsBelowTip (maxUint256 )
1088
- }
1089
-
1090
1079
// validateTx checks whether a transaction is valid according to the consensus
1091
1080
// rules and adheres to some heuristic limits of the local node (price and size).
1092
1081
func (p * BlobPool ) validateTx (tx * types.Transaction ) error {
0 commit comments