@@ -173,8 +173,7 @@ async def get_coin_record(self, coin_name: bytes32) -> Optional[CoinRecord]:
173
173
if row is not None :
174
174
coin = self .row_to_coin (row )
175
175
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
176
- coinbase = False if row [2 ] == 0 else True
177
- return CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ])
176
+ return CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ])
178
177
return None
179
178
180
179
async def get_coin_records (self , names : Collection [bytes32 ]) -> list [CoinRecord ]:
@@ -200,8 +199,7 @@ async def get_coin_records(self, names: Collection[bytes32]) -> list[CoinRecord]
200
199
for row in await cursor .fetchall ():
201
200
coin = self .row_to_coin (row )
202
201
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
203
- coinbase = False if row [2 ] == 0 else True
204
- record = CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ])
202
+ record = CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ])
205
203
coins .append (record )
206
204
207
205
return coins
@@ -218,8 +216,7 @@ async def get_coins_added_at_height(self, height: uint32) -> list[CoinRecord]:
218
216
for row in rows :
219
217
coin = self .row_to_coin (row )
220
218
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
221
- coinbase = False if row [2 ] == 0 else True
222
- coins .append (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
219
+ coins .append (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
223
220
return coins
224
221
225
222
async def get_coins_removed_at_height (self , height : uint32 ) -> list [CoinRecord ]:
@@ -236,8 +233,7 @@ async def get_coins_removed_at_height(self, height: uint32) -> list[CoinRecord]:
236
233
for row in await cursor .fetchall ():
237
234
if row [1 ] > 0 :
238
235
coin = self .row_to_coin (row )
239
- coinbase = False if row [2 ] == 0 else True
240
- coin_record = CoinRecord (coin , row [0 ], row [1 ], coinbase , row [6 ])
236
+ coin_record = CoinRecord (coin , row [0 ], row [1 ], row [2 ] != 0 , row [6 ])
241
237
coins .append (coin_record )
242
238
return coins
243
239
@@ -262,8 +258,7 @@ async def get_coin_records_by_puzzle_hash(
262
258
for row in await cursor .fetchall ():
263
259
coin = self .row_to_coin (row )
264
260
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
265
- coinbase = False if row [2 ] == 0 else True
266
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
261
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
267
262
return list (coins )
268
263
269
264
async def get_coin_records_by_puzzle_hashes (
@@ -292,8 +287,7 @@ async def get_coin_records_by_puzzle_hashes(
292
287
for row in await cursor .fetchall ():
293
288
coin = self .row_to_coin (row )
294
289
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
295
- coinbase = False if row [2 ] == 0 else True
296
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
290
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
297
291
return list (coins )
298
292
299
293
async def get_coin_records_by_names (
@@ -320,8 +314,7 @@ async def get_coin_records_by_names(
320
314
for row in await cursor .fetchall ():
321
315
coin = self .row_to_coin (row )
322
316
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
323
- coinbase = False if row [2 ] == 0 else True
324
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
317
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
325
318
326
319
return list (coins )
327
320
@@ -392,8 +385,7 @@ async def get_coin_records_by_parent_ids(
392
385
async for row in cursor :
393
386
coin = self .row_to_coin (row )
394
387
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
395
- coinbase = False if row [2 ] == 0 else True
396
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
388
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
397
389
398
390
return list (coins )
399
391
@@ -567,8 +559,7 @@ async def rollback_to_block(self, block_index: int) -> dict[bytes32, CoinRecord]
567
559
for row in rows :
568
560
coin = self .row_to_coin (row )
569
561
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
570
- coinbase = False if row [2 ] == 0 else True
571
- record = CoinRecord (coin , uint32 (0 ), spent_index , coinbase , uint64 (0 ))
562
+ record = CoinRecord (coin , uint32 (0 ), spent_index , row [2 ] != 0 , uint64 (0 ))
572
563
coin_name = bytes32 (row [7 ])
573
564
coin_changes [coin_name ] = record
574
565
@@ -583,8 +574,7 @@ async def rollback_to_block(self, block_index: int) -> dict[bytes32, CoinRecord]
583
574
)
584
575
for row in rows :
585
576
coin = self .row_to_coin (row )
586
- coinbase = False if row [2 ] == 0 else True
587
- record = CoinRecord (coin , row [0 ], uint32 (0 ), coinbase , row [6 ])
577
+ record = CoinRecord (coin , row [0 ], uint32 (0 ), row [2 ] != 0 , row [6 ])
588
578
coin_name = bytes32 (row [7 ])
589
579
if coin_name not in coin_changes :
590
580
coin_changes [coin_name ] = record
0 commit comments