@@ -531,28 +531,30 @@ async def rollback_to_block(self, block_index: int) -> list[CoinRecord]:
531
531
async with self .db_wrapper .writer_maybe_transaction () as conn :
532
532
async with conn .execute (
533
533
"SELECT confirmed_index, spent_index, coinbase, puzzle_hash, "
534
- "coin_parent, amount, timestamp FROM coin_record WHERE confirmed_index>?" ,
534
+ "coin_parent, amount, timestamp, coin_name FROM coin_record WHERE confirmed_index>?" ,
535
535
(block_index ,),
536
536
) as cursor :
537
537
for row in await cursor .fetchall ():
538
538
coin = self .row_to_coin (row )
539
539
record = CoinRecord (coin , uint32 (0 ), row [1 ], row [2 ], uint64 (0 ))
540
- coin_changes [record .name ] = record
540
+ coin_name = bytes32 (row [7 ])
541
+ coin_changes [coin_name ] = record
541
542
542
543
# Delete reverted blocks from storage
543
544
await conn .execute ("DELETE FROM coin_record WHERE confirmed_index>?" , (block_index ,))
544
545
545
546
# Add coins that are confirmed in the reverted blocks to the list of changed coins.
546
547
async with conn .execute (
547
548
"SELECT confirmed_index, spent_index, coinbase, puzzle_hash, "
548
- "coin_parent, amount, timestamp FROM coin_record WHERE spent_index>?" ,
549
+ "coin_parent, amount, timestamp, coin_name FROM coin_record WHERE spent_index>?" ,
549
550
(block_index ,),
550
551
) as cursor :
551
552
for row in await cursor .fetchall ():
552
553
coin = self .row_to_coin (row )
553
554
record = CoinRecord (coin , row [0 ], uint32 (0 ), row [2 ], row [6 ])
554
- if record .name not in coin_changes :
555
- coin_changes [record .name ] = record
555
+ coin_name = bytes32 (row [7 ])
556
+ if coin_name not in coin_changes :
557
+ coin_changes [coin_name ] = record
556
558
557
559
await conn .execute ("UPDATE coin_record SET spent_index=0 WHERE spent_index>?" , (block_index ,))
558
560
return list (coin_changes .values ())
0 commit comments