chia-blockchain 2.5.4rc2__py3-none-any.whl → 2.5.5rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chia/_tests/blockchain/blockchain_test_utils.py +2 -3
- chia/_tests/blockchain/test_augmented_chain.py +2 -3
- chia/_tests/blockchain/test_blockchain.py +261 -44
- chia/_tests/blockchain/test_blockchain_transactions.py +4 -3
- chia/_tests/blockchain/test_build_chains.py +197 -1
- chia/_tests/blockchain/test_get_block_generator.py +1 -1
- chia/_tests/blockchain/test_lookup_fork_chain.py +1 -1
- chia/_tests/clvm/benchmark_costs.py +1 -1
- chia/_tests/clvm/coin_store.py +3 -4
- chia/_tests/clvm/test_message_conditions.py +2 -2
- chia/_tests/clvm/test_puzzle_compression.py +2 -3
- chia/_tests/clvm/test_puzzles.py +1 -2
- chia/_tests/clvm/test_singletons.py +2 -3
- chia/_tests/clvm/test_spend_sim.py +7 -7
- chia/_tests/cmds/cmd_test_utils.py +30 -25
- chia/_tests/cmds/test_dev_gh.py +1 -1
- chia/_tests/cmds/test_farm_cmd.py +1 -1
- chia/_tests/cmds/test_show.py +1 -2
- chia/_tests/cmds/wallet/test_did.py +101 -56
- chia/_tests/cmds/wallet/test_nft.py +109 -84
- chia/_tests/cmds/wallet/test_notifications.py +1 -1
- chia/_tests/cmds/wallet/test_offer.toffer +1 -1
- chia/_tests/cmds/wallet/test_vcs.py +8 -8
- chia/_tests/cmds/wallet/test_wallet.py +100 -46
- chia/_tests/conftest.py +31 -20
- chia/_tests/connection_utils.py +1 -1
- chia/_tests/core/consensus/stores/__init__.py +0 -0
- chia/_tests/core/consensus/stores/test_coin_store_protocol.py +40 -0
- chia/_tests/core/consensus/test_block_creation.py +2 -31
- chia/_tests/core/consensus/test_pot_iterations.py +38 -3
- chia/_tests/core/custom_types/test_proof_of_space.py +154 -26
- chia/_tests/core/custom_types/test_spend_bundle.py +2 -3
- chia/_tests/core/daemon/test_daemon.py +80 -0
- chia/_tests/core/data_layer/test_data_layer.py +1 -1
- chia/_tests/core/data_layer/test_data_layer_util.py +1 -1
- chia/_tests/core/data_layer/test_data_rpc.py +14 -10
- chia/_tests/core/data_layer/test_data_store.py +5 -5
- chia/_tests/core/farmer/test_farmer_api.py +2 -2
- chia/_tests/core/full_node/full_sync/test_full_sync.py +446 -406
- chia/_tests/core/full_node/ram_db.py +3 -1
- chia/_tests/core/full_node/stores/test_block_store.py +28 -16
- chia/_tests/core/full_node/stores/test_coin_store.py +277 -185
- chia/_tests/core/full_node/stores/test_full_node_store.py +11 -4
- chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
- chia/_tests/core/full_node/test_address_manager.py +200 -27
- chia/_tests/core/full_node/test_block_height_map.py +2 -2
- chia/_tests/core/full_node/test_conditions.py +7 -6
- chia/_tests/core/full_node/test_full_node.py +456 -40
- chia/_tests/core/full_node/test_generator_tools.py +32 -2
- chia/_tests/core/full_node/test_hint_management.py +1 -1
- chia/_tests/core/full_node/test_node_load.py +20 -21
- chia/_tests/core/full_node/test_performance.py +3 -4
- chia/_tests/core/full_node/test_prev_tx_block.py +43 -0
- chia/_tests/core/full_node/test_subscriptions.py +1 -2
- chia/_tests/core/full_node/test_transactions.py +9 -5
- chia/_tests/core/full_node/test_tx_processing_queue.py +1 -2
- chia/_tests/core/large_block.py +1 -2
- chia/_tests/core/make_block_generator.py +3 -4
- chia/_tests/core/mempool/test_mempool.py +36 -86
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
- chia/_tests/core/mempool/test_mempool_item_queries.py +1 -3
- chia/_tests/core/mempool/test_mempool_manager.py +421 -69
- chia/_tests/core/mempool/test_mempool_performance.py +3 -2
- chia/_tests/core/mempool/test_singleton_fast_forward.py +60 -131
- chia/_tests/core/server/flood.py +1 -1
- chia/_tests/core/server/test_dos.py +1 -1
- chia/_tests/core/server/test_node_discovery.py +41 -27
- chia/_tests/core/server/test_rate_limits.py +1 -1
- chia/_tests/core/server/test_server.py +1 -1
- chia/_tests/core/services/test_services.py +5 -5
- chia/_tests/core/ssl/test_ssl.py +1 -1
- chia/_tests/core/test_cost_calculation.py +6 -6
- chia/_tests/core/test_crawler.py +2 -2
- chia/_tests/core/test_crawler_rpc.py +1 -1
- chia/_tests/core/test_db_conversion.py +3 -1
- chia/_tests/core/test_db_validation.py +5 -3
- chia/_tests/core/test_farmer_harvester_rpc.py +15 -15
- chia/_tests/core/test_filter.py +4 -1
- chia/_tests/core/test_full_node_rpc.py +99 -82
- chia/_tests/core/test_program.py +2 -2
- chia/_tests/core/util/test_block_cache.py +1 -1
- chia/_tests/core/util/test_keychain.py +2 -2
- chia/_tests/core/util/test_lockfile.py +1 -1
- chia/_tests/core/util/test_log_exceptions.py +5 -5
- chia/_tests/core/util/test_streamable.py +81 -22
- chia/_tests/db/test_db_wrapper.py +1 -3
- chia/_tests/environments/wallet.py +5 -5
- chia/_tests/farmer_harvester/test_farmer.py +9 -7
- chia/_tests/farmer_harvester/test_farmer_harvester.py +11 -4
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +6 -5
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +15 -9
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -2
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +7 -5
- chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
- chia/_tests/generator/test_compression.py +1 -2
- chia/_tests/generator/test_rom.py +8 -4
- chia/_tests/plot_sync/test_plot_sync.py +3 -3
- chia/_tests/plot_sync/test_receiver.py +3 -3
- chia/_tests/plot_sync/test_sender.py +1 -1
- chia/_tests/plot_sync/test_sync_simulated.py +3 -3
- chia/_tests/plot_sync/util.py +2 -2
- chia/_tests/pools/test_pool_cmdline.py +48 -21
- chia/_tests/pools/test_pool_puzzles_lifecycle.py +2 -3
- chia/_tests/pools/test_pool_rpc.py +237 -105
- chia/_tests/pools/test_pool_wallet.py +11 -2
- chia/_tests/pools/test_wallet_pool_store.py +5 -4
- chia/_tests/rpc/test_rpc_client.py +1 -1
- chia/_tests/simulation/test_simulation.py +13 -8
- chia/_tests/simulation/test_simulator.py +2 -2
- chia/_tests/timelord/test_new_peak.py +191 -47
- chia/_tests/timelord/test_timelord.py +1 -1
- chia/_tests/tools/test_full_sync.py +0 -2
- chia/_tests/tools/test_run_block.py +3 -1
- chia/_tests/util/benchmark_cost.py +3 -3
- chia/_tests/util/benchmarks.py +2 -2
- chia/_tests/util/blockchain.py +11 -5
- chia/_tests/util/blockchain_mock.py +1 -4
- chia/_tests/util/coin_store.py +29 -0
- chia/_tests/util/constants.py +2 -18
- chia/_tests/util/full_sync.py +3 -3
- chia/_tests/util/generator_tools_testing.py +2 -3
- chia/_tests/util/key_tool.py +2 -3
- chia/_tests/util/misc.py +33 -31
- chia/_tests/util/network_protocol_data.py +19 -17
- chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
- chia/_tests/util/protocol_messages_json.py +3 -1
- chia/_tests/util/run_block.py +2 -2
- chia/_tests/util/setup_nodes.py +7 -7
- chia/_tests/util/spend_sim.py +47 -55
- chia/_tests/util/test_condition_tools.py +5 -4
- chia/_tests/util/test_config.py +2 -2
- chia/_tests/util/test_dump_keyring.py +1 -1
- chia/_tests/util/test_full_block_utils.py +12 -14
- chia/_tests/util/test_misc.py +2 -2
- chia/_tests/util/test_paginator.py +4 -4
- chia/_tests/util/test_priority_mutex.py +2 -2
- chia/_tests/util/test_replace_str_to_bytes.py +15 -5
- chia/_tests/util/test_ssl_check.py +1 -1
- chia/_tests/util/test_testnet_overrides.py +13 -3
- chia/_tests/util/time_out_assert.py +4 -2
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +1 -2
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +352 -432
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +3 -6
- chia/_tests/wallet/cat_wallet/test_trades.py +53 -77
- chia/_tests/wallet/clawback/test_clawback_decorator.py +3 -1
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +3 -3
- chia/_tests/wallet/clawback/test_clawback_metadata.py +4 -2
- chia/_tests/wallet/conftest.py +11 -12
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +11 -4
- chia/_tests/wallet/db_wallet/test_dl_offers.py +433 -130
- chia/_tests/wallet/db_wallet/test_dl_wallet.py +3 -3
- chia/_tests/wallet/did_wallet/test_did.py +2132 -2000
- chia/_tests/wallet/nft_wallet/config.py +1 -1
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +1610 -742
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +486 -907
- chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +4 -4
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +517 -294
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +133 -62
- chia/_tests/wallet/rpc/test_wallet_rpc.py +495 -265
- chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +10 -6
- chia/_tests/wallet/sync/test_wallet_sync.py +89 -60
- chia/_tests/wallet/test_clvm_casts.py +88 -0
- chia/_tests/wallet/test_coin_management.py +1 -1
- chia/_tests/wallet/test_coin_selection.py +1 -1
- chia/_tests/wallet/test_conditions.py +1 -1
- chia/_tests/wallet/test_new_wallet_protocol.py +13 -11
- chia/_tests/wallet/test_notifications.py +5 -3
- chia/_tests/wallet/test_sign_coin_spends.py +6 -6
- chia/_tests/wallet/test_signer_protocol.py +13 -12
- chia/_tests/wallet/test_singleton.py +1 -1
- chia/_tests/wallet/test_singleton_lifecycle_fast.py +5 -7
- chia/_tests/wallet/test_util.py +2 -2
- chia/_tests/wallet/test_wallet.py +108 -29
- chia/_tests/wallet/test_wallet_action_scope.py +9 -2
- chia/_tests/wallet/test_wallet_blockchain.py +2 -3
- chia/_tests/wallet/test_wallet_key_val_store.py +1 -2
- chia/_tests/wallet/test_wallet_node.py +2 -4
- chia/_tests/wallet/test_wallet_retry.py +4 -2
- chia/_tests/wallet/test_wallet_state_manager.py +191 -5
- chia/_tests/wallet/test_wallet_test_framework.py +1 -1
- chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +8 -8
- chia/_tests/wallet/vc_wallet/test_vc_wallet.py +29 -12
- chia/_tests/wallet/wallet_block_tools.py +6 -6
- chia/_tests/weight_proof/test_weight_proof.py +10 -48
- chia/apis.py +1 -1
- chia/cmds/beta.py +1 -1
- chia/cmds/chia.py +9 -9
- chia/cmds/cmd_classes.py +12 -11
- chia/cmds/cmd_helpers.py +1 -1
- chia/cmds/cmds_util.py +12 -9
- chia/cmds/coin_funcs.py +2 -2
- chia/cmds/configure.py +2 -2
- chia/cmds/data.py +0 -2
- chia/cmds/data_funcs.py +1 -1
- chia/cmds/db_validate_func.py +1 -2
- chia/cmds/dev/__init__.py +0 -0
- chia/cmds/dev/data.py +273 -0
- chia/cmds/{gh.py → dev/gh.py} +5 -5
- chia/cmds/dev/main.py +22 -0
- chia/cmds/dev/mempool.py +78 -0
- chia/cmds/dev/mempool_funcs.py +63 -0
- chia/cmds/farm_funcs.py +5 -4
- chia/cmds/init_funcs.py +11 -11
- chia/cmds/keys.py +2 -2
- chia/cmds/keys_funcs.py +4 -4
- chia/cmds/netspace_funcs.py +1 -1
- chia/cmds/peer_funcs.py +2 -2
- chia/cmds/plotnft_funcs.py +72 -26
- chia/cmds/rpc.py +1 -1
- chia/cmds/show_funcs.py +5 -5
- chia/cmds/signer.py +8 -7
- chia/cmds/sim_funcs.py +8 -9
- chia/cmds/wallet.py +2 -2
- chia/cmds/wallet_funcs.py +165 -131
- chia/{util → consensus}/augmented_chain.py +1 -2
- chia/consensus/block_body_validation.py +54 -40
- chia/consensus/block_creation.py +42 -76
- chia/consensus/block_header_validation.py +32 -26
- chia/consensus/block_record.py +0 -3
- chia/consensus/blockchain.py +23 -32
- chia/consensus/blockchain_interface.py +1 -5
- chia/consensus/check_time_locks.py +57 -0
- chia/consensus/coin_store_protocol.py +151 -0
- chia/consensus/coinbase.py +0 -6
- chia/consensus/condition_costs.py +4 -0
- chia/{util → consensus}/condition_tools.py +4 -5
- chia/consensus/cost_calculator.py +1 -1
- chia/consensus/default_constants.py +32 -9
- chia/consensus/deficit.py +1 -3
- chia/consensus/difficulty_adjustment.py +1 -2
- chia/consensus/find_fork_point.py +1 -3
- chia/consensus/full_block_to_block_record.py +1 -6
- chia/{util → consensus}/generator_tools.py +1 -3
- chia/consensus/get_block_challenge.py +30 -7
- chia/consensus/make_sub_epoch_summary.py +1 -5
- chia/consensus/multiprocess_validation.py +21 -20
- chia/consensus/pot_iterations.py +74 -13
- chia/{util → consensus}/prev_transaction_block.py +1 -1
- chia/consensus/vdf_info_computation.py +1 -3
- chia/daemon/keychain_proxy.py +5 -5
- chia/daemon/server.py +22 -5
- chia/data_layer/data_layer.py +92 -51
- chia/{rpc → data_layer}/data_layer_rpc_api.py +1 -1
- chia/{rpc → data_layer}/data_layer_rpc_util.py +3 -6
- chia/data_layer/data_layer_util.py +4 -6
- chia/data_layer/data_layer_wallet.py +42 -69
- chia/data_layer/dl_wallet_store.py +12 -6
- chia/data_layer/download_data.py +3 -3
- chia/data_layer/s3_plugin_service.py +0 -1
- chia/farmer/farmer.py +3 -4
- chia/farmer/farmer_api.py +11 -7
- chia/{rpc → farmer}/farmer_rpc_client.py +1 -1
- chia/full_node/block_height_map.py +7 -6
- chia/full_node/block_store.py +5 -7
- chia/full_node/bundle_tools.py +1 -2
- chia/full_node/coin_store.py +143 -124
- chia/{types → full_node}/eligible_coin_spends.py +39 -70
- chia/full_node/fee_estimator.py +1 -1
- chia/full_node/fee_estimator_interface.py +0 -8
- chia/full_node/fee_tracker.py +25 -25
- chia/full_node/full_node.py +70 -53
- chia/full_node/full_node_api.py +57 -40
- chia/{rpc → full_node}/full_node_rpc_api.py +87 -8
- chia/{rpc → full_node}/full_node_rpc_client.py +7 -6
- chia/full_node/full_node_store.py +23 -8
- chia/full_node/mempool.py +206 -53
- chia/full_node/mempool_check_conditions.py +20 -63
- chia/full_node/mempool_manager.py +26 -40
- chia/full_node/subscriptions.py +1 -3
- chia/full_node/tx_processing_queue.py +50 -3
- chia/full_node/weight_proof.py +46 -37
- chia/harvester/harvester.py +1 -1
- chia/harvester/harvester_api.py +22 -7
- chia/introducer/introducer.py +1 -1
- chia/introducer/introducer_api.py +1 -1
- chia/plot_sync/exceptions.py +1 -1
- chia/plot_sync/receiver.py +1 -1
- chia/plot_sync/sender.py +2 -2
- chia/pools/pool_puzzles.py +13 -18
- chia/pools/pool_wallet.py +23 -46
- chia/protocols/farmer_protocol.py +11 -3
- chia/protocols/full_node_protocol.py +1 -4
- chia/protocols/harvester_protocol.py +3 -3
- chia/protocols/pool_protocol.py +1 -2
- chia/protocols/shared_protocol.py +3 -3
- chia/protocols/timelord_protocol.py +1 -3
- chia/protocols/wallet_protocol.py +3 -3
- chia/rpc/rpc_client.py +7 -8
- chia/rpc/rpc_server.py +3 -3
- chia/rpc/util.py +3 -1
- chia/seeder/crawler.py +1 -1
- chia/seeder/crawler_api.py +1 -1
- chia/seeder/dns_server.py +2 -0
- chia/seeder/start_crawler.py +3 -3
- chia/server/address_manager.py +286 -38
- chia/server/address_manager_store.py +0 -215
- chia/{types → server}/aliases.py +7 -7
- chia/server/api_protocol.py +1 -1
- chia/server/chia_policy.py +1 -1
- chia/server/node_discovery.py +76 -113
- chia/server/rate_limits.py +1 -1
- chia/server/resolve_peer_info.py +43 -0
- chia/server/server.py +5 -5
- chia/server/start_data_layer.py +4 -4
- chia/server/start_farmer.py +5 -4
- chia/server/start_full_node.py +5 -4
- chia/server/start_harvester.py +7 -5
- chia/server/start_introducer.py +2 -2
- chia/server/start_service.py +1 -1
- chia/server/start_timelord.py +7 -5
- chia/server/start_wallet.py +7 -5
- chia/server/ws_connection.py +1 -1
- chia/simulator/add_blocks_in_batches.py +2 -2
- chia/simulator/block_tools.py +245 -201
- chia/simulator/full_node_simulator.py +38 -10
- chia/simulator/setup_services.py +12 -12
- chia/simulator/simulator_full_node_rpc_api.py +2 -2
- chia/simulator/simulator_full_node_rpc_client.py +2 -2
- chia/simulator/simulator_test_tools.py +2 -2
- chia/simulator/start_simulator.py +1 -1
- chia/simulator/wallet_tools.py +10 -18
- chia/ssl/create_ssl.py +1 -1
- chia/timelord/iters_from_block.py +14 -14
- chia/timelord/timelord.py +15 -11
- chia/timelord/timelord_api.py +14 -2
- chia/timelord/timelord_state.py +20 -14
- chia/types/blockchain_format/program.py +53 -10
- chia/types/blockchain_format/proof_of_space.py +73 -19
- chia/types/coin_spend.py +3 -56
- chia/types/generator_types.py +28 -0
- chia/types/internal_mempool_item.py +1 -2
- chia/types/mempool_item.py +12 -7
- chia/types/unfinished_header_block.py +1 -2
- chia/types/validation_state.py +1 -2
- chia/types/weight_proof.py +1 -3
- chia/util/action_scope.py +3 -3
- chia/util/block_cache.py +1 -2
- chia/util/byte_types.py +1 -1
- chia/util/casts.py +21 -0
- chia/util/config.py +0 -37
- chia/util/db_wrapper.py +8 -1
- chia/util/errors.py +3 -2
- chia/util/initial-config.yaml +21 -5
- chia/util/keychain.py +6 -7
- chia/util/keyring_wrapper.py +5 -5
- chia/util/limited_semaphore.py +1 -1
- chia/util/priority_mutex.py +1 -1
- chia/util/streamable.py +63 -5
- chia/util/task_timing.py +1 -1
- chia/util/virtual_project_analysis.py +1 -1
- chia/wallet/cat_wallet/cat_info.py +7 -3
- chia/wallet/cat_wallet/cat_outer_puzzle.py +9 -5
- chia/wallet/cat_wallet/cat_utils.py +1 -1
- chia/wallet/cat_wallet/cat_wallet.py +44 -36
- chia/wallet/cat_wallet/lineage_store.py +7 -0
- chia/wallet/cat_wallet/r_cat_wallet.py +274 -0
- chia/wallet/conditions.py +5 -10
- chia/wallet/db_wallet/db_wallet_puzzles.py +4 -4
- chia/wallet/derivation_record.py +33 -0
- chia/wallet/derive_keys.py +3 -3
- chia/wallet/did_wallet/did_info.py +12 -3
- chia/wallet/did_wallet/did_wallet.py +132 -101
- chia/wallet/did_wallet/did_wallet_puzzles.py +9 -9
- chia/wallet/driver_protocol.py +3 -1
- chia/{types/spend_bundle.py → wallet/estimate_fees.py} +2 -7
- chia/wallet/nft_wallet/metadata_outer_puzzle.py +5 -3
- chia/wallet/nft_wallet/nft_puzzle_utils.py +1 -1
- chia/wallet/nft_wallet/nft_wallet.py +69 -112
- chia/wallet/nft_wallet/ownership_outer_puzzle.py +5 -3
- chia/wallet/nft_wallet/singleton_outer_puzzle.py +6 -4
- chia/wallet/nft_wallet/transfer_program_puzzle.py +4 -2
- chia/wallet/nft_wallet/uncurry_nft.py +4 -6
- chia/wallet/notification_manager.py +2 -3
- chia/wallet/outer_puzzles.py +7 -2
- chia/wallet/puzzle_drivers.py +1 -1
- chia/wallet/puzzles/clawback/drivers.py +5 -4
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +1 -1
- chia/wallet/puzzles/singleton_top_layer.py +2 -1
- chia/wallet/puzzles/singleton_top_layer_v1_1.py +2 -1
- chia/wallet/puzzles/tails.py +1 -3
- chia/wallet/signer_protocol.py +5 -6
- chia/wallet/singleton.py +5 -4
- chia/wallet/singleton_record.py +1 -1
- chia/wallet/trade_manager.py +18 -20
- chia/wallet/trade_record.py +3 -6
- chia/wallet/trading/offer.py +12 -13
- chia/wallet/uncurried_puzzle.py +2 -2
- chia/wallet/util/compute_additions.py +58 -0
- chia/wallet/util/compute_hints.py +3 -3
- chia/wallet/util/compute_memos.py +4 -4
- chia/wallet/util/curry_and_treehash.py +2 -1
- chia/wallet/util/debug_spend_bundle.py +1 -1
- chia/wallet/util/merkle_tree.py +1 -1
- chia/wallet/util/peer_request_cache.py +1 -2
- chia/wallet/util/tx_config.py +3 -8
- chia/wallet/util/wallet_sync_utils.py +10 -5
- chia/wallet/util/wallet_types.py +1 -0
- chia/wallet/vc_wallet/cr_cat_drivers.py +17 -18
- chia/wallet/vc_wallet/cr_cat_wallet.py +30 -28
- chia/wallet/vc_wallet/cr_outer_puzzle.py +5 -3
- chia/wallet/vc_wallet/vc_drivers.py +50 -8
- chia/wallet/vc_wallet/vc_store.py +3 -5
- chia/wallet/vc_wallet/vc_wallet.py +15 -22
- chia/wallet/wallet.py +36 -46
- chia/wallet/wallet_action_scope.py +73 -4
- chia/wallet/wallet_blockchain.py +1 -3
- chia/wallet/wallet_interested_store.py +1 -1
- chia/wallet/wallet_nft_store.py +3 -3
- chia/wallet/wallet_node.py +17 -16
- chia/wallet/wallet_node_api.py +4 -5
- chia/wallet/wallet_pool_store.py +1 -1
- chia/wallet/wallet_protocol.py +2 -0
- chia/wallet/wallet_puzzle_store.py +1 -1
- chia/{rpc → wallet}/wallet_request_types.py +670 -81
- chia/{rpc → wallet}/wallet_rpc_api.py +735 -766
- chia/{rpc → wallet}/wallet_rpc_client.py +268 -420
- chia/wallet/wallet_singleton_store.py +8 -7
- chia/wallet/wallet_spend_bundle.py +4 -3
- chia/wallet/wallet_state_manager.py +320 -191
- chia/wallet/wallet_weight_proof_handler.py +1 -2
- chia/wallet/wsm_apis.py +98 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/RECORD +443 -436
- mozilla-ca/cacert.pem +3 -165
- chia/_tests/fee_estimation/test_mempoolitem_height_added.py +0 -145
- chia/cmds/dev.py +0 -18
- chia/types/blockchain_format/slots.py +0 -9
- chia/types/blockchain_format/sub_epoch_summary.py +0 -5
- chia/types/end_of_slot_bundle.py +0 -5
- chia/types/full_block.py +0 -5
- chia/types/header_block.py +0 -5
- chia/types/spend_bundle_conditions.py +0 -7
- chia/types/transaction_queue_entry.py +0 -56
- chia/types/unfinished_block.py +0 -5
- /chia/cmds/{installers.py → dev/installers.py} +0 -0
- /chia/cmds/{sim.py → dev/sim.py} +0 -0
- /chia/{util → cmds}/dump_keyring.py +0 -0
- /chia/{full_node → consensus}/signage_point.py +0 -0
- /chia/{rpc → data_layer}/data_layer_rpc_client.py +0 -0
- /chia/{rpc → farmer}/farmer_rpc_api.py +0 -0
- /chia/{util → full_node}/full_block_utils.py +0 -0
- /chia/{rpc → harvester}/harvester_rpc_api.py +0 -0
- /chia/{rpc → harvester}/harvester_rpc_client.py +0 -0
- /chia/{full_node → protocols}/fee_estimate.py +0 -0
- /chia/{server → protocols}/outbound_message.py +0 -0
- /chia/{rpc → seeder}/crawler_rpc_api.py +0 -0
- /chia/{util → simulator}/vdf_prover.py +0 -0
- /chia/{util → ssl}/ssl_check.py +0 -0
- /chia/{rpc → timelord}/timelord_rpc_api.py +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/entry_points.txt +0 -0
|
@@ -12,19 +12,23 @@ from typing import Any, Optional
|
|
|
12
12
|
import pytest
|
|
13
13
|
from chia_rs import (
|
|
14
14
|
AugSchemeMPL,
|
|
15
|
+
ConsensusConstants,
|
|
15
16
|
Foliage,
|
|
16
17
|
FoliageTransactionBlock,
|
|
18
|
+
FullBlock,
|
|
17
19
|
G2Element,
|
|
18
20
|
PrivateKey,
|
|
21
|
+
ProofOfSpace,
|
|
19
22
|
RewardChainBlockUnfinished,
|
|
23
|
+
SpendBundle,
|
|
20
24
|
SpendBundleConditions,
|
|
21
25
|
TransactionsInfo,
|
|
26
|
+
UnfinishedBlock,
|
|
22
27
|
additions_and_removals,
|
|
23
28
|
get_flags_for_height_and_constants,
|
|
24
29
|
)
|
|
25
30
|
from chia_rs.sized_bytes import bytes32
|
|
26
31
|
from chia_rs.sized_ints import uint8, uint16, uint32, uint64, uint128
|
|
27
|
-
from clvm.casts import int_to_bytes
|
|
28
32
|
from packaging.version import Version
|
|
29
33
|
|
|
30
34
|
from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block, _validate_and_add_block_no_error
|
|
@@ -34,27 +38,35 @@ from chia._tests.core.full_node.stores.test_coin_store import get_future_reward_
|
|
|
34
38
|
from chia._tests.core.make_block_generator import make_spend_bundle
|
|
35
39
|
from chia._tests.core.node_height import node_height_at_least
|
|
36
40
|
from chia._tests.util.misc import wallet_height_at_least
|
|
37
|
-
from chia._tests.util.setup_nodes import
|
|
41
|
+
from chia._tests.util.setup_nodes import (
|
|
42
|
+
OldSimulatorsAndWallets,
|
|
43
|
+
SimulatorsAndWalletsServices,
|
|
44
|
+
setup_simulators_and_wallets,
|
|
45
|
+
)
|
|
38
46
|
from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages
|
|
47
|
+
from chia.consensus.augmented_chain import AugmentedBlockchain
|
|
39
48
|
from chia.consensus.block_body_validation import ForkInfo
|
|
40
49
|
from chia.consensus.blockchain import Blockchain
|
|
50
|
+
from chia.consensus.coin_store_protocol import CoinStoreProtocol
|
|
51
|
+
from chia.consensus.get_block_challenge import get_block_challenge
|
|
41
52
|
from chia.consensus.multiprocess_validation import PreValidationResult, pre_validate_block
|
|
42
53
|
from chia.consensus.pot_iterations import is_overflow_block
|
|
43
|
-
from chia.
|
|
54
|
+
from chia.consensus.signage_point import SignagePoint
|
|
44
55
|
from chia.full_node.full_node import WalletUpdate
|
|
45
56
|
from chia.full_node.full_node_api import FullNodeAPI
|
|
46
|
-
from chia.full_node.signage_point import SignagePoint
|
|
47
57
|
from chia.full_node.sync_store import Peak
|
|
48
58
|
from chia.protocols import full_node_protocol, timelord_protocol, wallet_protocol
|
|
49
59
|
from chia.protocols import full_node_protocol as fnp
|
|
60
|
+
from chia.protocols.farmer_protocol import DeclareProofOfSpace
|
|
50
61
|
from chia.protocols.full_node_protocol import NewTransaction, RespondTransaction
|
|
62
|
+
from chia.protocols.outbound_message import Message, NodeType
|
|
51
63
|
from chia.protocols.protocol_message_types import ProtocolMessageTypes
|
|
52
64
|
from chia.protocols.shared_protocol import Capability, default_capabilities
|
|
53
65
|
from chia.protocols.wallet_protocol import SendTransaction, TransactionAck
|
|
54
66
|
from chia.server.address_manager import AddressManager
|
|
55
67
|
from chia.server.node_discovery import FullNodePeers
|
|
56
|
-
from chia.server.outbound_message import Message, NodeType
|
|
57
68
|
from chia.server.server import ChiaServer
|
|
69
|
+
from chia.server.ws_connection import WSChiaConnection
|
|
58
70
|
from chia.simulator.add_blocks_in_batches import add_blocks_in_batches
|
|
59
71
|
from chia.simulator.block_tools import (
|
|
60
72
|
BlockTools,
|
|
@@ -67,14 +79,15 @@ from chia.simulator.full_node_simulator import FullNodeSimulator
|
|
|
67
79
|
from chia.simulator.keyring import TempKeyring
|
|
68
80
|
from chia.simulator.setup_services import setup_full_node
|
|
69
81
|
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
|
|
82
|
+
from chia.simulator.vdf_prover import get_vdf_info_and_proof
|
|
70
83
|
from chia.simulator.wallet_tools import WalletTool
|
|
71
84
|
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
|
72
85
|
from chia.types.blockchain_format.program import Program
|
|
73
86
|
from chia.types.blockchain_format.proof_of_space import (
|
|
74
|
-
ProofOfSpace,
|
|
75
87
|
calculate_plot_id_ph,
|
|
76
88
|
calculate_plot_id_pk,
|
|
77
89
|
calculate_pos_challenge,
|
|
90
|
+
verify_and_get_quality_string,
|
|
78
91
|
)
|
|
79
92
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
80
93
|
from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFProof
|
|
@@ -82,19 +95,16 @@ from chia.types.coin_record import CoinRecord
|
|
|
82
95
|
from chia.types.coin_spend import make_spend
|
|
83
96
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
84
97
|
from chia.types.condition_with_args import ConditionWithArgs
|
|
85
|
-
from chia.types.full_block import FullBlock
|
|
86
98
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
87
99
|
from chia.types.peer_info import PeerInfo, TimestampedPeerInfo
|
|
88
|
-
from chia.types.spend_bundle import SpendBundle, estimate_fees
|
|
89
|
-
from chia.types.unfinished_block import UnfinishedBlock
|
|
90
100
|
from chia.types.validation_state import ValidationState
|
|
91
|
-
from chia.util.
|
|
101
|
+
from chia.util.casts import int_to_bytes
|
|
92
102
|
from chia.util.errors import ConsensusError, Err
|
|
93
103
|
from chia.util.hash import std_hash
|
|
94
104
|
from chia.util.limited_semaphore import LimitedSemaphore
|
|
95
105
|
from chia.util.recursive_replace import recursive_replace
|
|
96
106
|
from chia.util.task_referencer import create_referenced_task
|
|
97
|
-
from chia.
|
|
107
|
+
from chia.wallet.estimate_fees import estimate_fees
|
|
98
108
|
from chia.wallet.transaction_record import TransactionRecord
|
|
99
109
|
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG
|
|
100
110
|
from chia.wallet.wallet_node import WalletNode
|
|
@@ -195,7 +205,8 @@ async def test_block_compression(
|
|
|
195
205
|
_ = await connect_and_get_peer(server_1, server_2, self_hostname)
|
|
196
206
|
_ = await connect_and_get_peer(server_1, server_3, self_hostname)
|
|
197
207
|
|
|
198
|
-
|
|
208
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
209
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
199
210
|
|
|
200
211
|
for i in range(4):
|
|
201
212
|
await full_node_1.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
|
@@ -672,7 +683,7 @@ async def test_respond_end_of_sub_slot_no_reorg(
|
|
|
672
683
|
# First get two blocks in the same sub slot
|
|
673
684
|
blocks = await full_node_1.get_all_full_blocks()
|
|
674
685
|
|
|
675
|
-
for i in range(
|
|
686
|
+
for i in range(9999999):
|
|
676
687
|
blocks = bt.get_consecutive_blocks(5, block_list_input=blocks, skip_slots=1, seed=i.to_bytes(4, "big"))
|
|
677
688
|
if len(blocks[-1].finished_sub_slots) == 0:
|
|
678
689
|
break
|
|
@@ -1457,7 +1468,7 @@ async def test_new_unfinished_block2_forward_limit(
|
|
|
1457
1468
|
unf_blocks: list[UnfinishedBlock] = []
|
|
1458
1469
|
|
|
1459
1470
|
last_reward_hash: Optional[bytes32] = None
|
|
1460
|
-
for idx in range(
|
|
1471
|
+
for idx in range(6):
|
|
1461
1472
|
# we include a different transaction in each block. This makes the
|
|
1462
1473
|
# foliage different in each of them, but the reward block (plot) the same
|
|
1463
1474
|
tx = wallet_a.generate_signed_transaction(uint64(100 * (idx + 1)), puzzle_hash, coin)
|
|
@@ -1615,7 +1626,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|
|
1615
1626
|
pos.pool_public_key,
|
|
1616
1627
|
pos.pool_contract_puzzle_hash,
|
|
1617
1628
|
public_key,
|
|
1618
|
-
pos.
|
|
1629
|
+
pos.version_and_size,
|
|
1619
1630
|
pos.proof,
|
|
1620
1631
|
)
|
|
1621
1632
|
|
|
@@ -1754,7 +1765,7 @@ async def test_request_unfinished_block2(
|
|
|
1754
1765
|
# deterministically
|
|
1755
1766
|
best_unf: Optional[UnfinishedBlock] = None
|
|
1756
1767
|
|
|
1757
|
-
for idx in range(
|
|
1768
|
+
for idx in range(6):
|
|
1758
1769
|
# we include a different transaction in each block. This makes the
|
|
1759
1770
|
# foliage different in each of them, but the reward block (plot) the same
|
|
1760
1771
|
tx = wallet_a.generate_signed_transaction(uint64(100 * (idx + 1)), puzzle_hash, coin)
|
|
@@ -1920,6 +1931,12 @@ async def test_new_signage_point_caching(
|
|
|
1920
1931
|
fnp.RespondSignagePoint(uint8(4), sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer
|
|
1921
1932
|
)
|
|
1922
1933
|
assert full_node_1.full_node.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash()) is None
|
|
1934
|
+
assert (
|
|
1935
|
+
full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
|
|
1936
|
+
sp.cc_vdf.output.get_hash(), sp.cc_vdf.challenge, uint8(4)
|
|
1937
|
+
)
|
|
1938
|
+
is None
|
|
1939
|
+
)
|
|
1923
1940
|
assert len(full_node_1.full_node.full_node_store.future_sp_cache[sp.rc_vdf.challenge]) == 1
|
|
1924
1941
|
|
|
1925
1942
|
# Add block
|
|
@@ -1927,6 +1944,16 @@ async def test_new_signage_point_caching(
|
|
|
1927
1944
|
|
|
1928
1945
|
# Now signage point should be added
|
|
1929
1946
|
assert full_node_1.full_node.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash()) is not None
|
|
1947
|
+
assert (
|
|
1948
|
+
full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
|
|
1949
|
+
sp.cc_vdf.output.get_hash(), sp.cc_vdf.challenge, uint8(4)
|
|
1950
|
+
)
|
|
1951
|
+
is not None
|
|
1952
|
+
)
|
|
1953
|
+
|
|
1954
|
+
assert full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
|
|
1955
|
+
full_node_1.full_node.constants.GENESIS_CHALLENGE, bytes32.zeros, uint8(0)
|
|
1956
|
+
) == SignagePoint(None, None, None, None)
|
|
1930
1957
|
|
|
1931
1958
|
|
|
1932
1959
|
@pytest.mark.anyio
|
|
@@ -2478,7 +2505,7 @@ def print_coin_records(records: dict[bytes32, CoinRecord]) -> None: # pragma: n
|
|
|
2478
2505
|
print(f"{rec}")
|
|
2479
2506
|
|
|
2480
2507
|
|
|
2481
|
-
async def validate_coin_set(coin_store:
|
|
2508
|
+
async def validate_coin_set(coin_store: CoinStoreProtocol, blocks: list[FullBlock]) -> None:
|
|
2482
2509
|
prev_height = blocks[0].height - 1
|
|
2483
2510
|
prev_hash = blocks[0].prev_header_hash
|
|
2484
2511
|
for block in blocks:
|
|
@@ -2504,9 +2531,9 @@ async def validate_coin_set(coin_store: CoinStore, blocks: list[FullBlock]) -> N
|
|
|
2504
2531
|
assert records == {}
|
|
2505
2532
|
continue
|
|
2506
2533
|
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2534
|
+
# TODO: Support block references
|
|
2535
|
+
# if len(block.transactions_generator_ref_list) > 0:
|
|
2536
|
+
# assert False
|
|
2510
2537
|
|
|
2511
2538
|
flags = get_flags_for_height_and_constants(block.height, test_constants)
|
|
2512
2539
|
additions, removals = additions_and_removals(bytes(block.transactions_generator), [], flags, test_constants)
|
|
@@ -2524,11 +2551,12 @@ async def validate_coin_set(coin_store: CoinStore, blocks: list[FullBlock]) -> N
|
|
|
2524
2551
|
assert records == {}
|
|
2525
2552
|
|
|
2526
2553
|
records = {rec.coin.name(): rec for rec in await coin_store.get_coins_removed_at_height(block.height)}
|
|
2527
|
-
for rem in removals:
|
|
2528
|
-
rec = records.pop(
|
|
2554
|
+
for name, rem in removals:
|
|
2555
|
+
rec = records.pop(name)
|
|
2529
2556
|
assert rec is not None
|
|
2530
2557
|
assert rec.spent_block_index == block.height
|
|
2531
2558
|
assert rec.coin == rem
|
|
2559
|
+
assert name == rem.name()
|
|
2532
2560
|
|
|
2533
2561
|
if len(records) > 0: # pragma: no cover
|
|
2534
2562
|
print(f"height: {block.height} unexpected removals: {records} TX: Yes")
|
|
@@ -2538,6 +2566,7 @@ async def validate_coin_set(coin_store: CoinStore, blocks: list[FullBlock]) -> N
|
|
|
2538
2566
|
|
|
2539
2567
|
@pytest.mark.anyio
|
|
2540
2568
|
@pytest.mark.parametrize("light_blocks", [True, False])
|
|
2569
|
+
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="save time")
|
|
2541
2570
|
async def test_long_reorg(
|
|
2542
2571
|
light_blocks: bool,
|
|
2543
2572
|
one_node_one_block: tuple[FullNodeSimulator, ChiaServer, BlockTools],
|
|
@@ -2549,14 +2578,15 @@ async def test_long_reorg(
|
|
|
2549
2578
|
node, _server, _bt = one_node_one_block
|
|
2550
2579
|
|
|
2551
2580
|
fork_point = 1499
|
|
2552
|
-
blocks = default_10000_blocks[:3000]
|
|
2553
2581
|
|
|
2554
2582
|
if light_blocks:
|
|
2555
2583
|
# if the blocks have lighter weight, we need more height to compensate,
|
|
2556
2584
|
# to force a reorg
|
|
2557
|
-
reorg_blocks = test_long_reorg_1500_blocks_light[:
|
|
2585
|
+
reorg_blocks = test_long_reorg_1500_blocks_light[:1950]
|
|
2586
|
+
blocks = default_10000_blocks[:1900]
|
|
2558
2587
|
else:
|
|
2559
|
-
reorg_blocks = test_long_reorg_1500_blocks[:
|
|
2588
|
+
reorg_blocks = test_long_reorg_1500_blocks[:2300]
|
|
2589
|
+
blocks = default_10000_blocks[:3000]
|
|
2560
2590
|
|
|
2561
2591
|
await add_blocks_in_batches(blocks, node.full_node)
|
|
2562
2592
|
peak = node.full_node.blockchain.get_peak()
|
|
@@ -2623,7 +2653,10 @@ async def test_long_reorg_nodes(
|
|
|
2623
2653
|
fork_point: int,
|
|
2624
2654
|
three_nodes: list[FullNodeAPI],
|
|
2625
2655
|
default_10000_blocks: list[FullBlock],
|
|
2626
|
-
|
|
2656
|
+
# this is commented out because it's currently only used by a skipped test.
|
|
2657
|
+
# If we ever want to un-skip the test, we need this fixture again. Loading
|
|
2658
|
+
# these blocks from disk takes non-trivial time
|
|
2659
|
+
# test_long_reorg_blocks: list[FullBlock],
|
|
2627
2660
|
test_long_reorg_blocks_light: list[FullBlock],
|
|
2628
2661
|
test_long_reorg_1500_blocks: list[FullBlock],
|
|
2629
2662
|
test_long_reorg_1500_blocks_light: list[FullBlock],
|
|
@@ -2636,26 +2669,28 @@ async def test_long_reorg_nodes(
|
|
|
2636
2669
|
assert full_node_2.full_node._coin_store is not None
|
|
2637
2670
|
assert full_node_3.full_node._coin_store is not None
|
|
2638
2671
|
|
|
2639
|
-
if fork_point == 1500:
|
|
2640
|
-
blocks = default_10000_blocks[: 3600 - chain_length]
|
|
2641
|
-
else:
|
|
2642
|
-
blocks = default_10000_blocks[: 1600 - chain_length]
|
|
2643
|
-
|
|
2644
2672
|
if light_blocks:
|
|
2645
2673
|
if fork_point == 1500:
|
|
2646
|
-
|
|
2647
|
-
|
|
2674
|
+
blocks = default_10000_blocks[: 3105 - chain_length]
|
|
2675
|
+
reorg_blocks = test_long_reorg_1500_blocks_light[: 3105 - chain_length]
|
|
2676
|
+
reorg_height = 3300
|
|
2648
2677
|
else:
|
|
2678
|
+
blocks = default_10000_blocks[: 1600 - chain_length]
|
|
2649
2679
|
reorg_blocks = test_long_reorg_blocks_light[: 1600 - chain_length]
|
|
2650
|
-
reorg_height =
|
|
2680
|
+
reorg_height = 2000
|
|
2651
2681
|
else:
|
|
2652
2682
|
if fork_point == 1500:
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
reorg_height = 4000
|
|
2683
|
+
blocks = default_10000_blocks[: 1900 - chain_length]
|
|
2684
|
+
reorg_blocks = test_long_reorg_1500_blocks[: 1900 - chain_length]
|
|
2685
|
+
reorg_height = 2300
|
|
2686
|
+
else: # pragma: no cover
|
|
2658
2687
|
pytest.skip("We rely on the light-blocks test for a 0 forkpoint")
|
|
2688
|
+
blocks = default_10000_blocks[: 1100 - chain_length]
|
|
2689
|
+
# reorg_blocks = test_long_reorg_blocks[: 1100 - chain_length]
|
|
2690
|
+
reorg_height = 1600
|
|
2691
|
+
|
|
2692
|
+
# this is a pre-requisite for a reorg to happen
|
|
2693
|
+
assert default_10000_blocks[reorg_height].weight > reorg_blocks[-1].weight
|
|
2659
2694
|
|
|
2660
2695
|
await add_blocks_in_batches(blocks, full_node_1.full_node)
|
|
2661
2696
|
|
|
@@ -2675,7 +2710,7 @@ async def test_long_reorg_nodes(
|
|
|
2675
2710
|
p2 = full_node_1.full_node.blockchain.get_peak()
|
|
2676
2711
|
return p1 == p2
|
|
2677
2712
|
|
|
2678
|
-
await time_out_assert(
|
|
2713
|
+
await time_out_assert(300, check_nodes_in_sync)
|
|
2679
2714
|
peak = full_node_2.full_node.blockchain.get_peak()
|
|
2680
2715
|
assert peak is not None
|
|
2681
2716
|
print(f"peak: {str(peak.header_hash)[:6]}")
|
|
@@ -2880,3 +2915,384 @@ async def test_eviction_from_bls_cache(one_node_one_block: tuple[FullNodeSimulat
|
|
|
2880
2915
|
# Farming a block with this tx evicts those pk msg pairs from the BLS cache
|
|
2881
2916
|
await full_node_1.full_node.add_block(blocks[-1], None, full_node_1.full_node._bls_cache)
|
|
2882
2917
|
assert len(full_node_1.full_node._bls_cache.items()) == 0
|
|
2918
|
+
|
|
2919
|
+
|
|
2920
|
+
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="irrelevant")
|
|
2921
|
+
@pytest.mark.parametrize("block_creation", [0, 1, 2])
|
|
2922
|
+
@pytest.mark.anyio
|
|
2923
|
+
async def test_declare_proof_of_space_no_overflow(
|
|
2924
|
+
blockchain_constants: ConsensusConstants,
|
|
2925
|
+
self_hostname: str,
|
|
2926
|
+
block_creation: int,
|
|
2927
|
+
) -> None:
|
|
2928
|
+
async with setup_simulators_and_wallets(
|
|
2929
|
+
1, 1, blockchain_constants, config_overrides={"full_node.block_creation": block_creation}
|
|
2930
|
+
) as new:
|
|
2931
|
+
full_node_api = new.simulators[0].peer_api
|
|
2932
|
+
server_1 = full_node_api.full_node.server
|
|
2933
|
+
bt = new.bt
|
|
2934
|
+
|
|
2935
|
+
wallet = WalletTool(test_constants)
|
|
2936
|
+
coinbase_puzzlehash = wallet.get_new_puzzlehash()
|
|
2937
|
+
blocks = bt.get_consecutive_blocks(
|
|
2938
|
+
num_blocks=10,
|
|
2939
|
+
skip_overflow=True,
|
|
2940
|
+
force_overflow=False,
|
|
2941
|
+
farmer_reward_puzzle_hash=coinbase_puzzlehash,
|
|
2942
|
+
guarantee_transaction_block=True,
|
|
2943
|
+
)
|
|
2944
|
+
await add_blocks_in_batches(blocks, full_node_api.full_node)
|
|
2945
|
+
_, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
|
|
2946
|
+
dummy_peer = server_1.all_connections[dummy_node_id]
|
|
2947
|
+
assert full_node_api.full_node.blockchain.get_peak_height() == blocks[-1].height
|
|
2948
|
+
for i in range(10, 100):
|
|
2949
|
+
sb = await add_tx_to_mempool(
|
|
2950
|
+
full_node_api, wallet, blocks[-8], coinbase_puzzlehash, bytes32(i.to_bytes(32, "big")), uint64(i)
|
|
2951
|
+
)
|
|
2952
|
+
blocks = bt.get_consecutive_blocks(
|
|
2953
|
+
block_list_input=blocks,
|
|
2954
|
+
num_blocks=1,
|
|
2955
|
+
farmer_reward_puzzle_hash=coinbase_puzzlehash,
|
|
2956
|
+
guarantee_transaction_block=True,
|
|
2957
|
+
transaction_data=sb,
|
|
2958
|
+
)
|
|
2959
|
+
block = blocks[-1]
|
|
2960
|
+
unfinised_block = await declare_pos_unfinished_block(full_node_api, dummy_peer, block)
|
|
2961
|
+
compare_unfinished_blocks(unfinished_from_full_block(block), unfinised_block)
|
|
2962
|
+
await full_node_api.full_node.add_block(block)
|
|
2963
|
+
assert full_node_api.full_node.blockchain.get_peak_height() == block.height
|
|
2964
|
+
|
|
2965
|
+
|
|
2966
|
+
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="irrelevant")
|
|
2967
|
+
@pytest.mark.parametrize("block_creation", [0, 1, 2])
|
|
2968
|
+
@pytest.mark.anyio
|
|
2969
|
+
async def test_declare_proof_of_space_overflow(
|
|
2970
|
+
blockchain_constants: ConsensusConstants,
|
|
2971
|
+
self_hostname: str,
|
|
2972
|
+
block_creation: int,
|
|
2973
|
+
) -> None:
|
|
2974
|
+
async with setup_simulators_and_wallets(
|
|
2975
|
+
1, 1, blockchain_constants, config_overrides={"full_node.block_creation": block_creation}
|
|
2976
|
+
) as new:
|
|
2977
|
+
full_node_api = new.simulators[0].peer_api
|
|
2978
|
+
server_1 = full_node_api.full_node.server
|
|
2979
|
+
bt = new.bt
|
|
2980
|
+
|
|
2981
|
+
wallet = WalletTool(test_constants)
|
|
2982
|
+
coinbase_puzzlehash = wallet.get_new_puzzlehash()
|
|
2983
|
+
blocks = bt.get_consecutive_blocks(
|
|
2984
|
+
num_blocks=10,
|
|
2985
|
+
farmer_reward_puzzle_hash=coinbase_puzzlehash,
|
|
2986
|
+
guarantee_transaction_block=True,
|
|
2987
|
+
)
|
|
2988
|
+
await add_blocks_in_batches(blocks, full_node_api.full_node)
|
|
2989
|
+
_, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
|
|
2990
|
+
dummy_peer = server_1.all_connections[dummy_node_id]
|
|
2991
|
+
assert full_node_api.full_node.blockchain.get_peak_height() == blocks[-1].height
|
|
2992
|
+
for i in range(10, 100):
|
|
2993
|
+
sb = await add_tx_to_mempool(
|
|
2994
|
+
full_node_api, wallet, blocks[-8], coinbase_puzzlehash, bytes32(i.to_bytes(32, "big")), uint64(i)
|
|
2995
|
+
)
|
|
2996
|
+
|
|
2997
|
+
blocks = bt.get_consecutive_blocks(
|
|
2998
|
+
block_list_input=blocks,
|
|
2999
|
+
num_blocks=1,
|
|
3000
|
+
skip_overflow=False,
|
|
3001
|
+
force_overflow=(i % 10 == 0),
|
|
3002
|
+
farmer_reward_puzzle_hash=coinbase_puzzlehash,
|
|
3003
|
+
guarantee_transaction_block=True,
|
|
3004
|
+
transaction_data=sb,
|
|
3005
|
+
)
|
|
3006
|
+
|
|
3007
|
+
block = blocks[-1]
|
|
3008
|
+
unfinised_block = await declare_pos_unfinished_block(full_node_api, dummy_peer, block)
|
|
3009
|
+
compare_unfinished_blocks(unfinished_from_full_block(block), unfinised_block)
|
|
3010
|
+
await full_node_api.full_node.add_block(block)
|
|
3011
|
+
assert full_node_api.full_node.blockchain.get_peak_height() == block.height
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
@pytest.mark.anyio
|
|
3015
|
+
async def test_add_unfinished_block_with_generator_refs(
|
|
3016
|
+
wallet_nodes: tuple[
|
|
3017
|
+
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
|
|
3018
|
+
],
|
|
3019
|
+
) -> None:
|
|
3020
|
+
"""
|
|
3021
|
+
Robustly test add_unfinished_block, including generator refs and edge cases.
|
|
3022
|
+
Assert block height after each added block.
|
|
3023
|
+
"""
|
|
3024
|
+
full_node_1, _, _, _, wallet, wallet_receiver, bt = wallet_nodes
|
|
3025
|
+
coinbase_puzzlehash = wallet.get_new_puzzlehash()
|
|
3026
|
+
blocks = bt.get_consecutive_blocks(
|
|
3027
|
+
5, block_list_input=[], guarantee_transaction_block=True, farmer_reward_puzzle_hash=coinbase_puzzlehash
|
|
3028
|
+
)
|
|
3029
|
+
for i in range(3):
|
|
3030
|
+
blocks = bt.get_consecutive_blocks(
|
|
3031
|
+
1,
|
|
3032
|
+
block_list_input=blocks,
|
|
3033
|
+
guarantee_transaction_block=True,
|
|
3034
|
+
transaction_data=wallet.generate_signed_transaction(
|
|
3035
|
+
uint64(1000),
|
|
3036
|
+
wallet_receiver.get_new_puzzlehash(),
|
|
3037
|
+
blocks[-3].get_included_reward_coins()[0],
|
|
3038
|
+
),
|
|
3039
|
+
block_refs=[blocks[-1].height, blocks[-2].height],
|
|
3040
|
+
)
|
|
3041
|
+
|
|
3042
|
+
for idx, block in enumerate(blocks[:-1]):
|
|
3043
|
+
await full_node_1.full_node.add_block(block)
|
|
3044
|
+
# Assert block height after each add
|
|
3045
|
+
peak = full_node_1.full_node.blockchain.get_peak()
|
|
3046
|
+
assert peak is not None and peak.height == blocks[-2].height
|
|
3047
|
+
block = blocks[-1]
|
|
3048
|
+
unf = unfinished_from_full_block(block)
|
|
3049
|
+
|
|
3050
|
+
# Test with missing generator ref (should raise ConsensusError)
|
|
3051
|
+
bad_refs = [uint32(9999999)]
|
|
3052
|
+
unf_bad = unf.replace(transactions_generator_ref_list=bad_refs)
|
|
3053
|
+
with pytest.raises(Exception) as excinfo:
|
|
3054
|
+
await full_node_1.full_node.add_unfinished_block(unf_bad, None)
|
|
3055
|
+
assert excinfo.value.args[0] == Err.GENERATOR_REF_HAS_NO_GENERATOR
|
|
3056
|
+
|
|
3057
|
+
unf_no_gen = unf.replace(transactions_generator_ref_list=bad_refs, transactions_generator=None)
|
|
3058
|
+
with pytest.raises(Exception) as excinfo:
|
|
3059
|
+
await full_node_1.full_node.add_unfinished_block(unf_no_gen, None)
|
|
3060
|
+
assert isinstance(excinfo.value, ConsensusError)
|
|
3061
|
+
assert excinfo.value.code == Err.INVALID_TRANSACTIONS_GENERATOR_HASH
|
|
3062
|
+
|
|
3063
|
+
# Duplicate generator refs (should raise ConsensusError or be rejected)
|
|
3064
|
+
dup_ref = blocks[-2].height
|
|
3065
|
+
unf_dup_refs = unf.replace(transactions_generator_ref_list=[dup_ref, dup_ref])
|
|
3066
|
+
with pytest.raises(Exception) as excinfo:
|
|
3067
|
+
await full_node_1.full_node.add_unfinished_block(unf_dup_refs, None)
|
|
3068
|
+
assert isinstance(excinfo.value, ConsensusError)
|
|
3069
|
+
assert excinfo.value.code == Err.INVALID_TRANSACTIONS_GENERATOR_REFS_ROOT
|
|
3070
|
+
|
|
3071
|
+
# ref block with no generator
|
|
3072
|
+
unf_bad_ref = unf.replace(transactions_generator_ref_list=[uint32(2)])
|
|
3073
|
+
with pytest.raises(Exception) as excinfo:
|
|
3074
|
+
await full_node_1.full_node.add_unfinished_block(unf_bad_ref, None)
|
|
3075
|
+
assert excinfo.value.args[0] == Err.GENERATOR_REF_HAS_NO_GENERATOR
|
|
3076
|
+
|
|
3077
|
+
# Generator ref points to block not yet in store (simulate by using a future height)
|
|
3078
|
+
unf_future_ref = unf.replace(transactions_generator_ref_list=[uint32(blocks[-1].height + 1000)])
|
|
3079
|
+
with pytest.raises(Exception) as excinfo:
|
|
3080
|
+
await full_node_1.full_node.add_unfinished_block(unf_future_ref, None)
|
|
3081
|
+
assert excinfo.value.args[0] == Err.GENERATOR_REF_HAS_NO_GENERATOR
|
|
3082
|
+
|
|
3083
|
+
# Generator ref points to itself
|
|
3084
|
+
unf_self_ref = unf.replace(transactions_generator_ref_list=[block.height])
|
|
3085
|
+
# Should raise ConsensusError or be rejected
|
|
3086
|
+
with pytest.raises(Exception) as excinfo:
|
|
3087
|
+
await full_node_1.full_node.add_unfinished_block(unf_self_ref, None)
|
|
3088
|
+
assert excinfo.value.args[0] == Err.GENERATOR_REF_HAS_NO_GENERATOR
|
|
3089
|
+
|
|
3090
|
+
# unsorted Generator refs
|
|
3091
|
+
unf_unsorted = unf.replace(transactions_generator_ref_list=[blocks[-2].height, blocks[-1].height])
|
|
3092
|
+
with pytest.raises(Exception) as excinfo:
|
|
3093
|
+
await full_node_1.full_node.add_unfinished_block(unf_unsorted, None)
|
|
3094
|
+
assert excinfo.value.args[0] == Err.GENERATOR_REF_HAS_NO_GENERATOR
|
|
3095
|
+
|
|
3096
|
+
# valid unfinished block with refs
|
|
3097
|
+
await full_node_1.full_node.add_unfinished_block(unf, None)
|
|
3098
|
+
assert full_node_1.full_node.full_node_store.get_unfinished_block(unf.partial_hash) is not None
|
|
3099
|
+
assert full_node_1.full_node.full_node_store.seen_unfinished_block(unf.get_hash())
|
|
3100
|
+
|
|
3101
|
+
# Test disconnected block
|
|
3102
|
+
fork_blocks = blocks[:-3]
|
|
3103
|
+
for i in range(3):
|
|
3104
|
+
# Add a block with a transaction
|
|
3105
|
+
fork_blocks = bt.get_consecutive_blocks(
|
|
3106
|
+
1,
|
|
3107
|
+
block_list_input=fork_blocks,
|
|
3108
|
+
guarantee_transaction_block=True,
|
|
3109
|
+
transaction_data=wallet.generate_signed_transaction(
|
|
3110
|
+
uint64(1000),
|
|
3111
|
+
wallet_receiver.get_new_puzzlehash(),
|
|
3112
|
+
fork_blocks[-3].get_included_reward_coins()[0],
|
|
3113
|
+
),
|
|
3114
|
+
min_signage_point=blocks[-1].reward_chain_block.signage_point_index + 1,
|
|
3115
|
+
seed=b"random_seed",
|
|
3116
|
+
block_refs=[fork_blocks[-2].height],
|
|
3117
|
+
)
|
|
3118
|
+
|
|
3119
|
+
disconnected_unf = unfinished_from_full_block(fork_blocks[-1])
|
|
3120
|
+
# Should not raise, but should not add the block either
|
|
3121
|
+
await full_node_1.full_node.add_unfinished_block(disconnected_unf, None)
|
|
3122
|
+
assert disconnected_unf.get_hash() not in full_node_1.full_node.full_node_store.seen_unfinished_blocks
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
def unfinished_from_full_block(block: FullBlock) -> UnfinishedBlock:
|
|
3126
|
+
unfinished_block_expected = UnfinishedBlock(
|
|
3127
|
+
block.finished_sub_slots,
|
|
3128
|
+
RewardChainBlockUnfinished(
|
|
3129
|
+
block.reward_chain_block.total_iters,
|
|
3130
|
+
block.reward_chain_block.signage_point_index,
|
|
3131
|
+
block.reward_chain_block.pos_ss_cc_challenge_hash,
|
|
3132
|
+
block.reward_chain_block.proof_of_space,
|
|
3133
|
+
block.reward_chain_block.challenge_chain_sp_vdf,
|
|
3134
|
+
block.reward_chain_block.challenge_chain_sp_signature,
|
|
3135
|
+
block.reward_chain_block.reward_chain_sp_vdf,
|
|
3136
|
+
block.reward_chain_block.reward_chain_sp_signature,
|
|
3137
|
+
),
|
|
3138
|
+
block.challenge_chain_sp_proof,
|
|
3139
|
+
block.reward_chain_sp_proof,
|
|
3140
|
+
block.foliage,
|
|
3141
|
+
block.foliage_transaction_block,
|
|
3142
|
+
block.transactions_info,
|
|
3143
|
+
block.transactions_generator,
|
|
3144
|
+
block.transactions_generator_ref_list,
|
|
3145
|
+
)
|
|
3146
|
+
|
|
3147
|
+
return unfinished_block_expected
|
|
3148
|
+
|
|
3149
|
+
|
|
3150
|
+
async def declare_pos_unfinished_block(
|
|
3151
|
+
full_node_api: FullNodeAPI,
|
|
3152
|
+
dummy_peer: WSChiaConnection,
|
|
3153
|
+
block: FullBlock,
|
|
3154
|
+
) -> UnfinishedBlock:
|
|
3155
|
+
blockchain = full_node_api.full_node.blockchain
|
|
3156
|
+
full_node_store = full_node_api.full_node.full_node_store
|
|
3157
|
+
overflow = is_overflow_block(blockchain.constants, block.reward_chain_block.signage_point_index)
|
|
3158
|
+
challenge = get_block_challenge(blockchain.constants, block, blockchain, False, overflow, False)
|
|
3159
|
+
assert block.reward_chain_block.pos_ss_cc_challenge_hash == challenge
|
|
3160
|
+
if block.reward_chain_block.challenge_chain_sp_vdf is None:
|
|
3161
|
+
challenge_chain_sp: bytes32 = challenge
|
|
3162
|
+
else:
|
|
3163
|
+
challenge_chain_sp = block.reward_chain_block.challenge_chain_sp_vdf.output.get_hash()
|
|
3164
|
+
if block.reward_chain_block.reward_chain_sp_vdf is not None:
|
|
3165
|
+
reward_chain_sp = block.reward_chain_block.reward_chain_sp_vdf.output.get_hash()
|
|
3166
|
+
else:
|
|
3167
|
+
if len(block.finished_sub_slots) > 0:
|
|
3168
|
+
reward_chain_sp = block.finished_sub_slots[-1].reward_chain.get_hash()
|
|
3169
|
+
else:
|
|
3170
|
+
curr = blockchain.block_record(block.prev_header_hash)
|
|
3171
|
+
while not curr.first_in_sub_slot:
|
|
3172
|
+
curr = blockchain.block_record(curr.prev_hash)
|
|
3173
|
+
assert curr.finished_reward_slot_hashes is not None
|
|
3174
|
+
reward_chain_sp = curr.finished_reward_slot_hashes[-1]
|
|
3175
|
+
farmer_reward_address = block.foliage.foliage_block_data.farmer_reward_puzzle_hash
|
|
3176
|
+
pool_target = block.foliage.foliage_block_data.pool_target
|
|
3177
|
+
pool_target_signature = block.foliage.foliage_block_data.pool_signature
|
|
3178
|
+
peak = blockchain.get_peak()
|
|
3179
|
+
full_peak = await blockchain.get_full_peak()
|
|
3180
|
+
assert peak is not None
|
|
3181
|
+
assert peak.height + 1 == block.height
|
|
3182
|
+
ssi = peak.sub_slot_iters
|
|
3183
|
+
prevb = blockchain.block_record(block.prev_header_hash)
|
|
3184
|
+
assert prevb is not None
|
|
3185
|
+
diff = uint64(peak.weight - prevb.weight)
|
|
3186
|
+
if len(block.finished_sub_slots) > 0:
|
|
3187
|
+
if block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters is not None:
|
|
3188
|
+
ssi = block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters
|
|
3189
|
+
if block.finished_sub_slots[0].challenge_chain.new_difficulty is not None:
|
|
3190
|
+
diff = block.finished_sub_slots[0].challenge_chain.new_difficulty
|
|
3191
|
+
|
|
3192
|
+
for eos in block.finished_sub_slots:
|
|
3193
|
+
full_node_store.new_finished_sub_slot(
|
|
3194
|
+
eos,
|
|
3195
|
+
blockchain,
|
|
3196
|
+
peak,
|
|
3197
|
+
ssi if ssi is not None else None,
|
|
3198
|
+
diff,
|
|
3199
|
+
full_peak,
|
|
3200
|
+
)
|
|
3201
|
+
|
|
3202
|
+
if block.reward_chain_block.challenge_chain_sp_vdf is not None:
|
|
3203
|
+
sp = SignagePoint(
|
|
3204
|
+
block.reward_chain_block.challenge_chain_sp_vdf,
|
|
3205
|
+
block.challenge_chain_sp_proof,
|
|
3206
|
+
block.reward_chain_block.reward_chain_sp_vdf,
|
|
3207
|
+
block.reward_chain_sp_proof,
|
|
3208
|
+
)
|
|
3209
|
+
full_node_store.new_signage_point(block.reward_chain_block.signage_point_index, blockchain, prevb, ssi, sp)
|
|
3210
|
+
|
|
3211
|
+
pospace = DeclareProofOfSpace(
|
|
3212
|
+
challenge,
|
|
3213
|
+
challenge_chain_sp,
|
|
3214
|
+
block.reward_chain_block.signage_point_index,
|
|
3215
|
+
reward_chain_sp,
|
|
3216
|
+
block.reward_chain_block.proof_of_space,
|
|
3217
|
+
block.reward_chain_block.challenge_chain_sp_signature,
|
|
3218
|
+
block.reward_chain_block.reward_chain_sp_signature,
|
|
3219
|
+
farmer_reward_address,
|
|
3220
|
+
pool_target,
|
|
3221
|
+
pool_target_signature,
|
|
3222
|
+
include_signature_source_data=True,
|
|
3223
|
+
)
|
|
3224
|
+
await full_node_api.declare_proof_of_space(pospace, dummy_peer)
|
|
3225
|
+
q_str: Optional[bytes32] = verify_and_get_quality_string(
|
|
3226
|
+
block.reward_chain_block.proof_of_space,
|
|
3227
|
+
blockchain.constants,
|
|
3228
|
+
challenge,
|
|
3229
|
+
challenge_chain_sp,
|
|
3230
|
+
height=block.reward_chain_block.height,
|
|
3231
|
+
)
|
|
3232
|
+
assert q_str is not None
|
|
3233
|
+
unfinised_block = None
|
|
3234
|
+
res = full_node_api.full_node.full_node_store.candidate_blocks.get(q_str)
|
|
3235
|
+
if res is not None:
|
|
3236
|
+
_, unfinised_block = res
|
|
3237
|
+
elif unfinised_block is None:
|
|
3238
|
+
res = full_node_api.full_node.full_node_store.candidate_backup_blocks.get(q_str)
|
|
3239
|
+
assert res is not None
|
|
3240
|
+
_, unfinised_block = res
|
|
3241
|
+
unfinised_block = unfinised_block.replace(
|
|
3242
|
+
finished_sub_slots=block.finished_sub_slots if overflow else unfinised_block.finished_sub_slots,
|
|
3243
|
+
foliage_transaction_block=block.foliage_transaction_block,
|
|
3244
|
+
foliage=block.foliage,
|
|
3245
|
+
)
|
|
3246
|
+
|
|
3247
|
+
return unfinised_block
|
|
3248
|
+
|
|
3249
|
+
|
|
3250
|
+
async def add_tx_to_mempool(
|
|
3251
|
+
full_node_api: FullNodeAPI,
|
|
3252
|
+
wallet: WalletTool,
|
|
3253
|
+
spend_block: FullBlock,
|
|
3254
|
+
coinbase_puzzlehash: bytes32,
|
|
3255
|
+
receiver_puzzlehash: bytes32,
|
|
3256
|
+
amount: uint64,
|
|
3257
|
+
) -> Optional[SpendBundle]:
|
|
3258
|
+
spend_coin = None
|
|
3259
|
+
coins = spend_block.get_included_reward_coins()
|
|
3260
|
+
for coin in coins:
|
|
3261
|
+
if coin.puzzle_hash == coinbase_puzzlehash:
|
|
3262
|
+
spend_coin = coin
|
|
3263
|
+
|
|
3264
|
+
assert spend_coin is not None
|
|
3265
|
+
spend_bundle = wallet.generate_signed_transaction(amount, receiver_puzzlehash, spend_coin)
|
|
3266
|
+
assert spend_bundle is not None
|
|
3267
|
+
response_msg = await full_node_api.send_transaction(wallet_protocol.SendTransaction(spend_bundle))
|
|
3268
|
+
assert (
|
|
3269
|
+
response_msg is not None
|
|
3270
|
+
and TransactionAck.from_bytes(response_msg.data).status == MempoolInclusionStatus.SUCCESS.value
|
|
3271
|
+
)
|
|
3272
|
+
|
|
3273
|
+
await time_out_assert(
|
|
3274
|
+
20,
|
|
3275
|
+
full_node_api.full_node.mempool_manager.get_spendbundle,
|
|
3276
|
+
spend_bundle,
|
|
3277
|
+
spend_bundle.name(),
|
|
3278
|
+
)
|
|
3279
|
+
return spend_bundle
|
|
3280
|
+
|
|
3281
|
+
|
|
3282
|
+
def compare_unfinished_blocks(block1: UnfinishedBlock, block2: UnfinishedBlock) -> bool:
|
|
3283
|
+
assert block1.finished_sub_slots == block2.finished_sub_slots, "Mismatch in finished_sub_slots"
|
|
3284
|
+
assert block1.reward_chain_block == block2.reward_chain_block, "Mismatch in reward_chain_block"
|
|
3285
|
+
assert block1.challenge_chain_sp_proof == block2.challenge_chain_sp_proof, "Mismatch in challenge_chain_sp_proof"
|
|
3286
|
+
assert block1.reward_chain_sp_proof == block2.reward_chain_sp_proof, "Mismatch in reward_chain_sp_proof"
|
|
3287
|
+
assert block1.total_iters == block2.total_iters, "Mismatch in total_iters"
|
|
3288
|
+
assert block1.prev_header_hash == block2.prev_header_hash, "Mismatch in prev_header_hash"
|
|
3289
|
+
assert block1.is_transaction_block() == block2.is_transaction_block(), "Mismatch in is_transaction_block"
|
|
3290
|
+
assert block1.foliage == block2.foliage, "Mismatch in foliage"
|
|
3291
|
+
assert block1.foliage_transaction_block == block2.foliage_transaction_block, "Mismatch in foliage_transaction_block"
|
|
3292
|
+
assert block1.transactions_info == block2.transactions_info, "Mismatch in transactions_info"
|
|
3293
|
+
assert block1.transactions_generator == block2.transactions_generator, "Mismatch in transactions_generator"
|
|
3294
|
+
assert block1.transactions_generator_ref_list == block2.transactions_generator_ref_list
|
|
3295
|
+
|
|
3296
|
+
# Final assertion to check the entire block
|
|
3297
|
+
assert block1 == block2, "The entire block objects are not identical"
|
|
3298
|
+
return True
|