@@ -102,16 +102,16 @@ defmodule DB.Entry do
102102 RocksDB . put ( "entry:#{ entry . hash } :root_receipts" , root_receipts , db_handle ( db_opts , :entry_meta , % { } ) )
103103 RocksDB . put ( "entry:#{ entry . hash } :root_contractstate" , root_contractstate , db_handle ( db_opts , :entry_meta , % { } ) )
104104
105+ #Build hashfilter
105106 tx_filters = RDB . build_tx_hashfilters ( entry . txs )
106107 Enum . each ( tx_filters , fn { key , hash } ->
107108 RocksDB . put ( key , hash , db_handle ( db_opts , :tx_filter , % { } ) )
108109 end )
109110
110- if entry . header . height >= 445_00000 do
111- old_cnt = RocksDB . get ( "tx_count" , db_handle ( db_opts , :sysconf , % { } ) ) || "0"
112- new_cnt = :erlang . binary_to_integer ( old_cnt ) + length ( entry . txs )
113- RocksDB . put ( "tx_count" , :erlang . integer_to_binary ( new_cnt ) , db_handle ( db_opts , :sysconf , % { } ) )
114- end
111+ #Count tx
112+ old_cnt = RocksDB . get ( "tx_count" , db_handle ( db_opts , :sysconf , % { } ) ) || "0"
113+ new_cnt = :erlang . binary_to_integer ( old_cnt ) + length ( entry . txs )
114+ RocksDB . put ( "tx_count" , :erlang . integer_to_binary ( new_cnt ) , db_handle ( db_opts , :sysconf , % { } ) )
115115
116116 receipts_by_txid = Map . new ( receipts , fn r -> { r . txid , Map . drop ( r , [ :txid ] ) } end )
117117 Enum . each ( entry . txs , fn ( txu ) ->
@@ -165,16 +165,16 @@ defmodule DB.Entry do
165165 RocksDB . delete_prefix ( "consensus:#{ hash } :" , db_handle ( db_opts , :attestation , % { } ) )
166166 RocksDB . delete_prefix ( "attestation:#{ height_padded } :#{ hash } :" , db_handle ( db_opts , :attestation , % { } ) )
167167
168+ #Delete hashfilter
168169 tx_filters = RDB . build_tx_hashfilters ( entry . txs )
169170 Enum . each ( tx_filters , fn { key , _hash } ->
170171 RocksDB . delete ( key , db_handle ( db_opts , :tx_filter , % { } ) )
171172 end )
172173
173- if entry . header . height >= 445_00000 do
174- old_cnt = RocksDB . get ( "tx_count" , db_handle ( db_opts , :sysconf , % { } ) ) || "0"
175- new_cnt = :erlang . binary_to_integer ( old_cnt ) - length ( entry . txs )
176- RocksDB . put ( "tx_count" , :erlang . integer_to_binary ( new_cnt ) , db_handle ( db_opts , :sysconf , % { } ) )
177- end
174+ #Decrement tx
175+ old_cnt = RocksDB . get ( "tx_count" , db_handle ( db_opts , :sysconf , % { } ) ) || "0"
176+ new_cnt = :erlang . binary_to_integer ( old_cnt ) - length ( entry . txs )
177+ RocksDB . put ( "tx_count" , :erlang . integer_to_binary ( new_cnt ) , db_handle ( db_opts , :sysconf , % { } ) )
178178
179179 Enum . each ( entry . txs , fn ( txu ) ->
180180 RocksDB . delete ( txu . hash , db_handle ( db_opts , :tx , % { } ) )
@@ -222,7 +222,7 @@ defmodule DB.Entry do
222222
223223 n = next ( rebuilt_up_to )
224224 if n do
225- rebuilt_up_to = RocksDB . put ( "filter_hashes_rebuilt_up_to" , next ( rebuilt_up_to ) , db_handle ( % { } , :sysconf , % { } ) ) || EntryGenesis . get ( ) . hash
225+ RocksDB . put ( "filter_hashes_rebuilt_up_to" , n , db_handle ( % { } , :sysconf , % { } ) )
226226 end
227227 end
228228end
0 commit comments