20
20
from chia .consensus .block_body_validation import ForkInfo
21
21
from chia .consensus .block_height_map import BlockHeightMap
22
22
from chia .consensus .blockchain import AddBlockResult , Blockchain
23
+ from chia .consensus .consensus_store import ConsensusStore
23
24
from chia .consensus .default_constants import DEFAULT_CONSTANTS
24
25
from chia .consensus .full_block_to_block_record import header_block_to_sub_block_record
25
26
from chia .full_node .block_store import BlockStore
@@ -74,7 +75,8 @@ async def test_block_store(tmp_dir: Path, db_version: int, bt: BlockTools, use_c
74
75
coin_store_2 = await CoinStore .create (db_wrapper_2 )
75
76
store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
76
77
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
77
- bc = await Blockchain .create (coin_store_2 , store_2 , height_map , bt .constants , 2 )
78
+ consensus_store = await ConsensusStore .create (store_2 , coin_store_2 , height_map )
79
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
78
80
79
81
store = await BlockStore .create (db_wrapper , use_cache = use_cache )
80
82
await BlockStore .create (db_wrapper_2 )
@@ -150,7 +152,8 @@ async def test_get_full_blocks_at(
150
152
coin_store = await CoinStore .create (db_wrapper )
151
153
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
152
154
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
153
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
155
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
156
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
154
157
155
158
count = 0
156
159
fork_info = ForkInfo (- 1 , - 1 , bt .constants .GENESIS_CHALLENGE )
@@ -178,7 +181,8 @@ async def test_get_block_records_in_range(
178
181
coin_store = await CoinStore .create (db_wrapper )
179
182
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
180
183
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
181
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
184
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
185
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
182
186
183
187
count = 0
184
188
fork_info = ForkInfo (- 1 , - 1 , bt .constants .GENESIS_CHALLENGE )
@@ -208,7 +212,8 @@ async def test_get_block_bytes_in_range_in_main_chain(
208
212
coin_store = await CoinStore .create (db_wrapper )
209
213
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
210
214
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
211
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
215
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
216
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
212
217
count = 0
213
218
fork_info = ForkInfo (- 1 , - 1 , bt .constants .GENESIS_CHALLENGE )
214
219
for b1 , b2 in zip (blocks , alt_blocks ):
@@ -237,7 +242,8 @@ async def test_deadlock(tmp_dir: Path, db_version: int, bt: BlockTools, use_cach
237
242
coin_store_2 = await CoinStore .create (wrapper_2 )
238
243
store_2 = await BlockStore .create (wrapper_2 )
239
244
height_map = await BlockHeightMap .create (tmp_dir , wrapper_2 )
240
- bc = await Blockchain .create (coin_store_2 , store_2 , height_map , bt .constants , 2 )
245
+ consensus_store = await ConsensusStore .create (store_2 , coin_store_2 , height_map )
246
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
241
247
block_records = []
242
248
for block in blocks :
243
249
await _validate_and_add_block (bc , block )
@@ -268,7 +274,8 @@ async def test_rollback(bt: BlockTools, tmp_dir: Path, use_cache: bool, default_
268
274
coin_store = await CoinStore .create (db_wrapper )
269
275
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
270
276
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
271
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
277
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
278
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
272
279
273
280
# insert all blocks
274
281
count = 0
@@ -331,7 +338,8 @@ async def test_count_compactified_blocks(bt: BlockTools, tmp_dir: Path, db_versi
331
338
coin_store = await CoinStore .create (db_wrapper )
332
339
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
333
340
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
334
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
341
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
342
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
335
343
336
344
count = await block_store .count_compactified_blocks ()
337
345
assert count == 0
@@ -352,7 +360,8 @@ async def test_count_uncompactified_blocks(bt: BlockTools, tmp_dir: Path, db_ver
352
360
coin_store = await CoinStore .create (db_wrapper )
353
361
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
354
362
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
355
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
363
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
364
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
356
365
357
366
count = await block_store .count_uncompactified_blocks ()
358
367
assert count == 0
@@ -380,7 +389,8 @@ def rand_vdf_proof() -> VDFProof:
380
389
coin_store = await CoinStore .create (db_wrapper )
381
390
block_store = await BlockStore .create (db_wrapper , use_cache = use_cache )
382
391
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper )
383
- bc = await Blockchain .create (coin_store , block_store , height_map , bt .constants , 2 )
392
+ consensus_store = await ConsensusStore .create (block_store , coin_store , height_map )
393
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
384
394
for block in blocks :
385
395
await _validate_and_add_block (bc , block )
386
396
@@ -461,7 +471,8 @@ async def test_get_blocks_by_hash(tmp_dir: Path, bt: BlockTools, db_version: int
461
471
coin_store_2 = await CoinStore .create (db_wrapper_2 )
462
472
store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
463
473
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
464
- bc = await Blockchain .create (coin_store_2 , store_2 , height_map , bt .constants , 2 )
474
+ consensus_store = await ConsensusStore .create (store_2 , coin_store_2 , height_map )
475
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
465
476
466
477
store = await BlockStore .create (db_wrapper , use_cache = use_cache )
467
478
await BlockStore .create (db_wrapper_2 )
@@ -501,7 +512,8 @@ async def test_get_block_bytes_in_range(tmp_dir: Path, bt: BlockTools, db_versio
501
512
coin_store_2 = await CoinStore .create (db_wrapper_2 )
502
513
store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
503
514
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
504
- bc = await Blockchain .create (coin_store_2 , store_2 , height_map , bt .constants , 2 )
515
+ consensus_store = await ConsensusStore .create (store_2 , coin_store_2 , height_map )
516
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
505
517
506
518
await BlockStore .create (db_wrapper_2 )
507
519
@@ -574,7 +586,8 @@ async def test_get_prev_hash(tmp_dir: Path, bt: BlockTools, db_version: int, use
574
586
coin_store_2 = await CoinStore .create (db_wrapper_2 )
575
587
store_2 = await BlockStore .create (db_wrapper_2 , use_cache = use_cache )
576
588
height_map = await BlockHeightMap .create (tmp_dir , db_wrapper_2 )
577
- bc = await Blockchain .create (coin_store_2 , store_2 , height_map , bt .constants , 2 )
589
+ consensus_store = await ConsensusStore .create (store_2 , coin_store_2 , height_map )
590
+ bc = await Blockchain .create (consensus_store , bt .constants , 2 )
578
591
579
592
store = await BlockStore .create (db_wrapper , use_cache = use_cache )
580
593
await BlockStore .create (db_wrapper_2 )
0 commit comments