@@ -2076,8 +2076,7 @@ async def test_timelock_conditions(
2076
2076
2077
2077
if expected == AddBlockResult .NEW_PEAK :
2078
2078
# ensure coin was in fact spent
2079
- recs = await b .consensus_store .get_coin_records ([coin .name ()])
2080
- c = recs [0 ] if len (recs ) > 0 else None
2079
+ c = await b .consensus_store .get_coin_record (coin .name ())
2081
2080
assert c is not None and c .spent
2082
2081
2083
2082
@pytest .mark .anyio
@@ -2287,12 +2286,10 @@ async def test_ephemeral_timelock(
2287
2286
2288
2287
if expected == AddBlockResult .NEW_PEAK :
2289
2288
# ensure coin1 was in fact spent
2290
- recs1 = await b .consensus_store .get_coin_records ([coin1 .name ()])
2291
- c = recs1 [0 ] if len (recs1 ) > 0 else None
2289
+ c = await b .consensus_store .get_coin_record (coin1 .name ())
2292
2290
assert c is not None and c .spent
2293
2291
# ensure coin2 was NOT spent
2294
- recs2 = await b .consensus_store .get_coin_records ([coin2 .name ()])
2295
- c = recs2 [0 ] if len (recs2 ) > 0 else None
2292
+ c = await b .consensus_store .get_coin_record (coin2 .name ())
2296
2293
assert c is not None and not c .spent
2297
2294
2298
2295
@pytest .mark .anyio
@@ -3106,11 +3103,9 @@ async def test_double_spent_in_reorg(self, empty_blockchain: Blockchain, bt: Blo
3106
3103
)
3107
3104
3108
3105
# ephemeral coin is spent
3109
- recs_first = await b .consensus_store .get_coin_records ([new_coin .name ()])
3110
- first_coin = recs_first [0 ] if len (recs_first ) > 0 else None
3106
+ first_coin = await b .consensus_store .get_coin_record (new_coin .name ())
3111
3107
assert first_coin is not None and first_coin .spent
3112
- recs_second = await b .consensus_store .get_coin_records ([tx_2 .additions ()[0 ].name ()])
3113
- second_coin = recs_second [0 ] if len (recs_second ) > 0 else None
3108
+ second_coin = await b .consensus_store .get_coin_record (tx_2 .additions ()[0 ].name ())
3114
3109
assert second_coin is not None and not second_coin .spent
3115
3110
3116
3111
farmer_coin = create_farmer_coin (
@@ -3126,8 +3121,7 @@ async def test_double_spent_in_reorg(self, empty_blockchain: Blockchain, bt: Blo
3126
3121
)
3127
3122
await _validate_and_add_block (b , blocks_reorg [- 1 ])
3128
3123
3129
- recs_farmer = await b .consensus_store .get_coin_records ([farmer_coin .name ()])
3130
- farmer_coin_record = recs_farmer [0 ] if len (recs_farmer ) > 0 else None
3124
+ farmer_coin_record = await b .consensus_store .get_coin_record (farmer_coin .name ())
3131
3125
assert farmer_coin_record is not None and farmer_coin_record .spent
3132
3126
3133
3127
@pytest .mark .anyio
@@ -3882,14 +3876,14 @@ async def test_chain_failed_rollback(empty_blockchain: Blockchain, bt: BlockTool
3882
3876
await _validate_and_add_block (b , block , expected_result = AddBlockResult .ADDED_AS_ORPHAN , fork_info = fork_info )
3883
3877
3884
3878
# Incorrectly set the height as spent in DB to trigger an error
3885
- recs_dbg1 = await b .consensus_store .get_coin_records ([ spend_bundle .coin_spends [0 ].coin .name ()] )
3886
- print (f"{ recs_dbg1 [ 0 ] if len ( recs_dbg1 ) > 0 else None } " )
3879
+ coin_record_dbg1 = await b .consensus_store .get_coin_record ( spend_bundle .coin_spends [0 ].coin .name ())
3880
+ print (f"{ coin_record_dbg1 } " )
3887
3881
print (spend_bundle .coin_spends [0 ].coin .name ())
3888
3882
# await b.consensus_store._set_spent([spend_bundle.coin_spends[0].coin.name()], 8)
3889
3883
async with b .consensus_store as writer :
3890
3884
await writer .rollback_to_block (2 )
3891
- recs_dbg2 = await b .consensus_store .get_coin_records ([ spend_bundle .coin_spends [0 ].coin .name ()] )
3892
- print (f"{ recs_dbg2 [ 0 ] if len ( recs_dbg2 ) > 0 else None } " )
3885
+ coin_record_dbg2 = await b .consensus_store .get_coin_record ( spend_bundle .coin_spends [0 ].coin .name ())
3886
+ print (f"{ coin_record_dbg2 } " )
3893
3887
3894
3888
fork_block = blocks_reorg_chain [10 - 1 ]
3895
3889
# fork_info = ForkInfo(fork_block.height, fork_block.height, fork_block.header_hash)
0 commit comments