@@ -181,8 +181,7 @@ async def get_coin_record(self, coin_name: bytes32) -> Optional[CoinRecord]:
181
181
if row is not None :
182
182
coin = self .row_to_coin (row )
183
183
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
184
- coinbase = False if row [2 ] == 0 else True
185
- return CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ])
184
+ return CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ])
186
185
return None
187
186
188
187
async def get_coin_records (self , names : Collection [bytes32 ]) -> list [CoinRecord ]:
@@ -208,8 +207,7 @@ async def get_coin_records(self, names: Collection[bytes32]) -> list[CoinRecord]
208
207
for row in await cursor .fetchall ():
209
208
coin = self .row_to_coin (row )
210
209
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
211
- coinbase = False if row [2 ] == 0 else True
212
- record = CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ])
210
+ record = CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ])
213
211
coins .append (record )
214
212
215
213
return coins
@@ -226,8 +224,7 @@ async def get_coins_added_at_height(self, height: uint32) -> list[CoinRecord]:
226
224
for row in rows :
227
225
coin = self .row_to_coin (row )
228
226
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
229
- coinbase = False if row [2 ] == 0 else True
230
- coins .append (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
227
+ coins .append (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
231
228
return coins
232
229
233
230
async def get_coins_removed_at_height (self , height : uint32 ) -> list [CoinRecord ]:
@@ -244,8 +241,7 @@ async def get_coins_removed_at_height(self, height: uint32) -> list[CoinRecord]:
244
241
for row in await cursor .fetchall ():
245
242
if row [1 ] > 0 :
246
243
coin = self .row_to_coin (row )
247
- coinbase = False if row [2 ] == 0 else True
248
- coin_record = CoinRecord (coin , row [0 ], row [1 ], coinbase , row [6 ])
244
+ coin_record = CoinRecord (coin , row [0 ], row [1 ], row [2 ] != 0 , row [6 ])
249
245
coins .append (coin_record )
250
246
return coins
251
247
@@ -270,8 +266,7 @@ async def get_coin_records_by_puzzle_hash(
270
266
for row in await cursor .fetchall ():
271
267
coin = self .row_to_coin (row )
272
268
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
273
- coinbase = False if row [2 ] == 0 else True
274
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
269
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
275
270
return list (coins )
276
271
277
272
async def get_coin_records_by_puzzle_hashes (
@@ -300,8 +295,7 @@ async def get_coin_records_by_puzzle_hashes(
300
295
for row in await cursor .fetchall ():
301
296
coin = self .row_to_coin (row )
302
297
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
303
- coinbase = False if row [2 ] == 0 else True
304
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
298
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
305
299
return list (coins )
306
300
307
301
async def get_coin_records_by_names (
@@ -328,8 +322,7 @@ async def get_coin_records_by_names(
328
322
for row in await cursor .fetchall ():
329
323
coin = self .row_to_coin (row )
330
324
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
331
- coinbase = False if row [2 ] == 0 else True
332
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
325
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
333
326
334
327
return list (coins )
335
328
@@ -400,8 +393,7 @@ async def get_coin_records_by_parent_ids(
400
393
async for row in cursor :
401
394
coin = self .row_to_coin (row )
402
395
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
403
- coinbase = False if row [2 ] == 0 else True
404
- coins .add (CoinRecord (coin , row [0 ], spent_index , coinbase , row [6 ]))
396
+ coins .add (CoinRecord (coin , row [0 ], spent_index , row [2 ] != 0 , row [6 ]))
405
397
406
398
return list (coins )
407
399
@@ -575,8 +567,7 @@ async def rollback_to_block(self, block_index: int) -> dict[bytes32, CoinRecord]
575
567
for row in rows :
576
568
coin = self .row_to_coin (row )
577
569
spent_index = uint32 (0 ) if row [1 ] <= 0 else uint32 (row [1 ])
578
- coinbase = False if row [2 ] == 0 else True
579
- record = CoinRecord (coin , uint32 (0 ), spent_index , coinbase , uint64 (0 ))
570
+ record = CoinRecord (coin , uint32 (0 ), spent_index , row [2 ] != 0 , uint64 (0 ))
580
571
coin_name = bytes32 (row [7 ])
581
572
coin_changes [coin_name ] = record
582
573
@@ -591,8 +582,7 @@ async def rollback_to_block(self, block_index: int) -> dict[bytes32, CoinRecord]
591
582
)
592
583
for row in rows :
593
584
coin = self .row_to_coin (row )
594
- coinbase = False if row [2 ] == 0 else True
595
- record = CoinRecord (coin , row [0 ], uint32 (0 ), coinbase , row [6 ])
585
+ record = CoinRecord (coin , row [0 ], uint32 (0 ), row [2 ] != 0 , row [6 ])
596
586
coin_name = bytes32 (row [7 ])
597
587
if coin_name not in coin_changes :
598
588
coin_changes [coin_name ] = record
0 commit comments