@@ -178,39 +178,31 @@ async def test_set_spent(db_version: int, bt: BlockTools) -> None:
178
178
179
179
# Save/get block
180
180
for block in blocks :
181
- if block .is_transaction_block ():
182
- removals : list [bytes32 ] = []
183
- additions : list [Coin ] = []
184
- async with db_wrapper .writer ():
185
- if block .is_transaction_block ():
186
- assert block .foliage_transaction_block is not None
187
- await coin_store .new_block (
188
- block .height ,
189
- block .foliage_transaction_block .timestamp ,
190
- block .get_included_reward_coins (),
191
- additions ,
192
- removals ,
193
- )
194
-
195
- coins = block .get_included_reward_coins ()
196
- records = [await coin_store .get_coin_record (coin .name ()) for coin in coins ]
181
+ if not block .is_transaction_block ():
182
+ continue
183
+ assert block .foliage_transaction_block is not None
184
+ await coin_store .new_block (
185
+ block .height , block .foliage_transaction_block .timestamp , block .get_included_reward_coins (), [], []
186
+ )
187
+ coins = block .get_included_reward_coins ()
188
+ records = [await coin_store .get_coin_record (coin .name ()) for coin in coins ]
197
189
198
- await coin_store ._set_spent ([r .name for r in records if r is not None ], block .height )
190
+ await coin_store ._set_spent ([r .name for r in records if r is not None ], block .height )
199
191
200
- if len (records ) > 0 :
201
- for r in records :
202
- assert r is not None
203
- assert (await coin_store .get_coin_record (r .name )) is not None
192
+ if len (records ) > 0 :
193
+ for r in records :
194
+ assert r is not None
195
+ assert (await coin_store .get_coin_record (r .name )) is not None
204
196
205
- # Check that we can't spend a coin twice in DB
206
- with pytest .raises (ValueError , match = "Invalid operation to set spent" ):
207
- await coin_store ._set_spent ([r .name for r in records if r is not None ], block .height )
197
+ # Check that we can't spend a coin twice in DB
198
+ with pytest .raises (ValueError , match = "Invalid operation to set spent" ):
199
+ await coin_store ._set_spent ([r .name for r in records if r is not None ], block .height )
208
200
209
- records = [await coin_store .get_coin_record (coin .name ()) for coin in coins ]
210
- for record in records :
211
- assert record is not None
212
- assert record .spent
213
- assert record .spent_block_index == block .height
201
+ records = [await coin_store .get_coin_record (coin .name ()) for coin in coins ]
202
+ for record in records :
203
+ assert record is not None
204
+ assert record .spent
205
+ assert record .spent_block_index == block .height
214
206
215
207
216
208
@pytest .mark .limit_consensus_modes (reason = "save time" )
0 commit comments