18
18
from chia ._tests .blockchain .blockchain_test_utils import _validate_and_add_block
19
19
from chia ._tests .util .db_connection import DBConnection , PathDBConnection
20
20
from chia .consensus .block_body_validation import ForkInfo
21
- from chia .consensus .block_height_map import BlockHeightMap
22
21
from chia .consensus .blockchain import AddBlockResult , Blockchain
23
22
from chia .consensus .default_constants import DEFAULT_CONSTANTS
24
23
from chia .consensus .full_block_to_block_record import header_block_to_sub_block_record
25
24
from chia .full_node .block_store import BlockStore
26
- from chia .full_node .coin_store import CoinStore
27
25
from chia .full_node .consensus_store_sqlite3 import ConsensusStoreSQLite3
28
26
from chia .full_node .full_block_utils import GeneratorBlockInfo
29
27
from chia .simulator .block_tools import BlockTools
@@ -72,10 +70,7 @@ async def test_block_store(tmp_dir: Path, db_version: int, bt: BlockTools, use_c
72
70
73
71
async with DBConnection (db_version ) as db_wrapper , DBConnection (db_version ) as db_wrapper_2 :
74
72
# Use a different file for the blockchain
75
- coin_store_2 = await CoinStore .create (db_wrapper_2 )
76
- store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
77
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
78
- consensus_store = ConsensusStoreSQLite3 (store_2 , coin_store_2 , height_map )
73
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper_2 , tmp_dir , use_cache = use_cache )
79
74
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
80
75
81
76
store = await BlockStore .create (db_wrapper , use_cache = use_cache )
@@ -233,10 +228,7 @@ async def test_deadlock(tmp_dir: Path, db_version: int, bt: BlockTools, use_cach
233
228
234
229
async with PathDBConnection (db_version ) as wrapper , PathDBConnection (db_version ) as wrapper_2 :
235
230
store = await BlockStore .create (wrapper , use_cache = use_cache )
236
- coin_store_2 = await CoinStore .create (wrapper_2 )
237
- store_2 = await BlockStore .create (wrapper_2 )
238
- height_map = await BlockHeightMap .create (tmp_dir , wrapper_2 )
239
- consensus_store = ConsensusStoreSQLite3 (store_2 , coin_store_2 , height_map )
231
+ consensus_store = await ConsensusStoreSQLite3 .create (wrapper_2 , tmp_dir , use_cache = use_cache )
240
232
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
241
233
block_records = []
242
234
for block in blocks :
@@ -327,10 +319,8 @@ async def test_count_compactified_blocks(bt: BlockTools, tmp_dir: Path, db_versi
327
319
blocks = bt .get_consecutive_blocks (10 )
328
320
329
321
async with DBConnection (db_version ) as db_wrapper :
330
- coin_store = await CoinStore .create (db_wrapper )
331
- block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
332
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
333
- consensus_store = ConsensusStoreSQLite3 (block_store , coin_store , height_map )
322
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper , tmp_dir , use_cache = use_cache )
323
+ block_store = consensus_store .block_store
334
324
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
335
325
336
326
count = await block_store .count_compactified_blocks ()
@@ -349,10 +339,8 @@ async def test_count_uncompactified_blocks(bt: BlockTools, tmp_dir: Path, db_ver
349
339
blocks = bt .get_consecutive_blocks (10 )
350
340
351
341
async with DBConnection (db_version ) as db_wrapper :
352
- coin_store = await CoinStore .create (db_wrapper )
353
- block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
354
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
355
- consensus_store = ConsensusStoreSQLite3 (block_store , coin_store , height_map )
342
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper , tmp_dir , use_cache = use_cache )
343
+ block_store = consensus_store .block_store
356
344
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
357
345
358
346
count = await block_store .count_uncompactified_blocks ()
@@ -378,10 +366,8 @@ def rand_vdf_proof() -> VDFProof:
378
366
)
379
367
380
368
async with DBConnection (db_version ) as db_wrapper :
381
- coin_store = await CoinStore .create (db_wrapper )
382
- block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
383
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
384
- consensus_store = ConsensusStoreSQLite3 (block_store , coin_store , height_map )
369
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper , tmp_dir , use_cache = use_cache )
370
+ block_store = consensus_store .block_store
385
371
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
386
372
for block in blocks :
387
373
await _validate_and_add_block (bc , block )
@@ -460,10 +446,7 @@ async def test_get_blocks_by_hash(tmp_dir: Path, bt: BlockTools, db_version: int
460
446
461
447
async with DBConnection (db_version ) as db_wrapper , DBConnection (db_version ) as db_wrapper_2 :
462
448
# Use a different file for the blockchain
463
- coin_store_2 = await CoinStore .create (db_wrapper_2 )
464
- store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
465
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
466
- consensus_store = ConsensusStoreSQLite3 (store_2 , coin_store_2 , height_map )
449
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper_2 , tmp_dir , use_cache = use_cache )
467
450
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
468
451
469
452
store = await BlockStore .create (db_wrapper , use_cache = use_cache )
@@ -501,10 +484,8 @@ async def test_get_block_bytes_in_range(tmp_dir: Path, bt: BlockTools, db_versio
501
484
502
485
async with DBConnection (db_version ) as db_wrapper_2 :
503
486
# Use a different file for the blockchain
504
- coin_store_2 = await CoinStore .create (db_wrapper_2 )
505
- store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
506
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
507
- consensus_store = ConsensusStoreSQLite3 (store_2 , coin_store_2 , height_map )
487
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper_2 , tmp_dir , use_cache = use_cache )
488
+ store_2 = consensus_store .block_store
508
489
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
509
490
510
491
await BlockStore .create (db_wrapper_2 )
@@ -575,10 +556,7 @@ async def test_get_prev_hash(tmp_dir: Path, bt: BlockTools, db_version: int, use
575
556
576
557
async with DBConnection (db_version ) as db_wrapper , DBConnection (db_version ) as db_wrapper_2 :
577
558
# Use a different file for the blockchain
578
- coin_store_2 = await CoinStore .create (db_wrapper_2 )
579
- store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
580
- height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
581
- consensus_store = ConsensusStoreSQLite3 (store_2 , coin_store_2 , height_map )
559
+ consensus_store = await ConsensusStoreSQLite3 .create (db_wrapper_2 , tmp_dir , use_cache = use_cache )
582
560
bc = await Blockchain .create (consensus_store , bt .constants , 2 )
583
561
584
562
store = await BlockStore .create (db_wrapper , use_cache = use_cache )
0 commit comments