chia-blockchain 2.5.4rc2__py3-none-any.whl → 2.5.5rc1__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 +305 -184
- 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 +273 -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.5rc1.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.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.5rc1.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/entry_points.txt +0 -0
chia/full_node/full_node.py
CHANGED
|
@@ -17,9 +17,17 @@ from typing import TYPE_CHECKING, Any, Callable, ClassVar, Optional, TextIO, Uni
|
|
|
17
17
|
|
|
18
18
|
from chia_rs import (
|
|
19
19
|
AugSchemeMPL,
|
|
20
|
+
BlockRecord,
|
|
20
21
|
BLSCache,
|
|
22
|
+
CoinState,
|
|
21
23
|
ConsensusConstants,
|
|
24
|
+
EndOfSubSlotBundle,
|
|
25
|
+
FullBlock,
|
|
26
|
+
HeaderBlock,
|
|
22
27
|
PoolTarget,
|
|
28
|
+
SpendBundle,
|
|
29
|
+
SubEpochSummary,
|
|
30
|
+
UnfinishedBlock,
|
|
23
31
|
get_flags_for_height_and_constants,
|
|
24
32
|
run_block_generator,
|
|
25
33
|
run_block_generator2,
|
|
@@ -28,16 +36,20 @@ from chia_rs.sized_bytes import bytes32
|
|
|
28
36
|
from chia_rs.sized_ints import uint8, uint32, uint64, uint128
|
|
29
37
|
from packaging.version import Version
|
|
30
38
|
|
|
39
|
+
from chia.consensus.augmented_chain import AugmentedBlockchain
|
|
31
40
|
from chia.consensus.block_body_validation import ForkInfo
|
|
32
41
|
from chia.consensus.block_creation import unfinished_block_to_full_block
|
|
33
|
-
from chia.consensus.block_record import BlockRecord
|
|
34
42
|
from chia.consensus.blockchain import AddBlockResult, Blockchain, BlockchainMutexPriority, StateChangeSummary
|
|
35
43
|
from chia.consensus.blockchain_interface import BlockchainInterface
|
|
44
|
+
from chia.consensus.coin_store_protocol import CoinStoreProtocol
|
|
45
|
+
from chia.consensus.condition_tools import pkm_pairs
|
|
36
46
|
from chia.consensus.cost_calculator import NPCResult
|
|
37
47
|
from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty
|
|
38
48
|
from chia.consensus.make_sub_epoch_summary import next_sub_epoch_summary
|
|
39
49
|
from chia.consensus.multiprocess_validation import PreValidationResult, pre_validate_block
|
|
40
50
|
from chia.consensus.pot_iterations import calculate_sp_iters
|
|
51
|
+
from chia.consensus.signage_point import SignagePoint
|
|
52
|
+
from chia.full_node.block_height_map import BlockHeightMap
|
|
41
53
|
from chia.full_node.block_store import BlockStore
|
|
42
54
|
from chia.full_node.check_fork_next_block import check_fork_next_block
|
|
43
55
|
from chia.full_node.coin_store import CoinStore
|
|
@@ -47,40 +59,30 @@ from chia.full_node.hint_management import get_hints_and_subscription_coin_ids
|
|
|
47
59
|
from chia.full_node.hint_store import HintStore
|
|
48
60
|
from chia.full_node.mempool import MempoolRemoveInfo
|
|
49
61
|
from chia.full_node.mempool_manager import MempoolManager, NewPeakItem
|
|
50
|
-
from chia.full_node.signage_point import SignagePoint
|
|
51
62
|
from chia.full_node.subscriptions import PeerSubscriptions, peers_for_spend_bundle
|
|
52
63
|
from chia.full_node.sync_store import Peak, SyncStore
|
|
53
|
-
from chia.full_node.tx_processing_queue import TransactionQueue
|
|
64
|
+
from chia.full_node.tx_processing_queue import TransactionQueue, TransactionQueueEntry
|
|
54
65
|
from chia.full_node.weight_proof import WeightProofHandler
|
|
55
66
|
from chia.protocols import farmer_protocol, full_node_protocol, timelord_protocol, wallet_protocol
|
|
56
67
|
from chia.protocols.farmer_protocol import SignagePointSourceData, SPSubSlotSourceData, SPVDFSourceData
|
|
57
68
|
from chia.protocols.full_node_protocol import RequestBlocks, RespondBlock, RespondBlocks, RespondSignagePoint
|
|
69
|
+
from chia.protocols.outbound_message import Message, NodeType, make_msg
|
|
58
70
|
from chia.protocols.protocol_message_types import ProtocolMessageTypes
|
|
59
71
|
from chia.protocols.shared_protocol import Capability
|
|
60
|
-
from chia.protocols.wallet_protocol import
|
|
72
|
+
from chia.protocols.wallet_protocol import CoinStateUpdate, RemovedMempoolItem
|
|
61
73
|
from chia.rpc.rpc_server import StateChangedProtocol
|
|
62
74
|
from chia.server.node_discovery import FullNodePeers
|
|
63
|
-
from chia.server.outbound_message import Message, NodeType, make_msg
|
|
64
75
|
from chia.server.server import ChiaServer
|
|
65
76
|
from chia.server.ws_connection import WSChiaConnection
|
|
66
77
|
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
|
67
|
-
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
|
|
68
78
|
from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFInfo, VDFProof, validate_vdf
|
|
69
79
|
from chia.types.coin_record import CoinRecord
|
|
70
|
-
from chia.types.end_of_slot_bundle import EndOfSubSlotBundle
|
|
71
|
-
from chia.types.full_block import FullBlock
|
|
72
|
-
from chia.types.header_block import HeaderBlock
|
|
73
80
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
74
81
|
from chia.types.mempool_item import MempoolItem
|
|
75
82
|
from chia.types.peer_info import PeerInfo
|
|
76
|
-
from chia.types.spend_bundle import SpendBundle
|
|
77
|
-
from chia.types.transaction_queue_entry import TransactionQueueEntry
|
|
78
|
-
from chia.types.unfinished_block import UnfinishedBlock
|
|
79
83
|
from chia.types.validation_state import ValidationState
|
|
80
84
|
from chia.types.weight_proof import WeightProof
|
|
81
|
-
from chia.util.augmented_chain import AugmentedBlockchain
|
|
82
85
|
from chia.util.bech32m import encode_puzzle_hash
|
|
83
|
-
from chia.util.condition_tools import pkm_pairs
|
|
84
86
|
from chia.util.config import process_config_start_method
|
|
85
87
|
from chia.util.db_synchronous import db_synchronous_on
|
|
86
88
|
from chia.util.db_version import lookup_db_version, set_db_version_async
|
|
@@ -102,6 +104,7 @@ class PeakPostProcessingResult:
|
|
|
102
104
|
fns_peak_result: FullNodeStorePeakResult # The result of calling FullNodeStore.new_peak
|
|
103
105
|
hints: list[tuple[bytes32, bytes]] # The hints added to the DB
|
|
104
106
|
lookup_coin_ids: list[bytes32] # The coin IDs that we need to look up to notify wallets of changes
|
|
107
|
+
signage_points: list[tuple[RespondSignagePoint, WSChiaConnection, Optional[EndOfSubSlotBundle]]]
|
|
105
108
|
|
|
106
109
|
|
|
107
110
|
@dataclasses.dataclass(frozen=True)
|
|
@@ -154,7 +157,7 @@ class FullNode:
|
|
|
154
157
|
_db_wrapper: Optional[DBWrapper2] = None
|
|
155
158
|
_hint_store: Optional[HintStore] = None
|
|
156
159
|
_block_store: Optional[BlockStore] = None
|
|
157
|
-
_coin_store: Optional[
|
|
160
|
+
_coin_store: Optional[CoinStoreProtocol] = None
|
|
158
161
|
_mempool_manager: Optional[MempoolManager] = None
|
|
159
162
|
_init_weight_proof: Optional[asyncio.Task[None]] = None
|
|
160
163
|
_blockchain: Optional[Blockchain] = None
|
|
@@ -262,11 +265,13 @@ class FullNode:
|
|
|
262
265
|
log_coins = self.config.get("log_coins", False)
|
|
263
266
|
multiprocessing_start_method = process_config_start_method(config=self.config, log=self.log)
|
|
264
267
|
self.multiprocessing_context = multiprocessing.get_context(method=multiprocessing_start_method)
|
|
268
|
+
selected_network = self.config.get("selected_network")
|
|
269
|
+
height_map = await BlockHeightMap.create(self.db_path.parent, self._db_wrapper, selected_network)
|
|
265
270
|
self._blockchain = await Blockchain.create(
|
|
266
271
|
coin_store=self.coin_store,
|
|
267
272
|
block_store=self.block_store,
|
|
268
273
|
consensus_constants=self.constants,
|
|
269
|
-
|
|
274
|
+
height_map=height_map,
|
|
270
275
|
reserved_cores=reserved_cores,
|
|
271
276
|
single_threaded=single_threaded,
|
|
272
277
|
log_coins=log_coins,
|
|
@@ -302,10 +307,9 @@ class FullNode:
|
|
|
302
307
|
peak: Optional[BlockRecord] = self.blockchain.get_peak()
|
|
303
308
|
if peak is None:
|
|
304
309
|
self.log.info(f"Initialized with empty blockchain time taken: {int(time_taken)}s")
|
|
305
|
-
|
|
306
|
-
if num_unspent > 0:
|
|
310
|
+
if not await self.coin_store.is_empty():
|
|
307
311
|
self.log.error(
|
|
308
|
-
|
|
312
|
+
"Inconsistent blockchain DB file! Could not find peak block but found some coins! "
|
|
309
313
|
"This is a fatal error. The blockchain database may be corrupt"
|
|
310
314
|
)
|
|
311
315
|
raise RuntimeError("corrupt blockchain DB")
|
|
@@ -344,10 +348,12 @@ class FullNode:
|
|
|
344
348
|
self.wallet_sync_task = create_referenced_task(self._wallets_sync_task_handler())
|
|
345
349
|
|
|
346
350
|
self.initialized = True
|
|
347
|
-
|
|
348
|
-
create_referenced_task(self.full_node_peers.start(), known_unreferenced=True)
|
|
351
|
+
|
|
349
352
|
try:
|
|
350
|
-
|
|
353
|
+
async with contextlib.AsyncExitStack() as aexit_stack:
|
|
354
|
+
if self.full_node_peers is not None:
|
|
355
|
+
await aexit_stack.enter_async_context(self.full_node_peers.manage())
|
|
356
|
+
yield
|
|
351
357
|
finally:
|
|
352
358
|
self._shut_down = True
|
|
353
359
|
if self._init_weight_proof is not None:
|
|
@@ -359,9 +365,6 @@ class FullNode:
|
|
|
359
365
|
# same for mempool_manager
|
|
360
366
|
if self._mempool_manager is not None:
|
|
361
367
|
self.mempool_manager.shut_down()
|
|
362
|
-
|
|
363
|
-
if self.full_node_peers is not None:
|
|
364
|
-
create_referenced_task(self.full_node_peers.close(), known_unreferenced=True)
|
|
365
368
|
if self.uncompact_task is not None:
|
|
366
369
|
self.uncompact_task.cancel()
|
|
367
370
|
if self._transaction_queue_task is not None:
|
|
@@ -416,7 +419,7 @@ class FullNode:
|
|
|
416
419
|
return self._blockchain
|
|
417
420
|
|
|
418
421
|
@property
|
|
419
|
-
def coin_store(self) ->
|
|
422
|
+
def coin_store(self) -> CoinStoreProtocol:
|
|
420
423
|
assert self._coin_store is not None
|
|
421
424
|
return self._coin_store
|
|
422
425
|
|
|
@@ -545,15 +548,15 @@ class FullNode:
|
|
|
545
548
|
dns_servers.append("dns-introducer.chia.net")
|
|
546
549
|
try:
|
|
547
550
|
self.full_node_peers = FullNodePeers(
|
|
548
|
-
self.server,
|
|
549
|
-
self.config["target_outbound_peer_count"],
|
|
550
|
-
self.root_path / Path(self.config.get("peers_file_path", "db/peers.dat")),
|
|
551
|
-
self.config["introducer_peer"],
|
|
552
|
-
dns_servers,
|
|
553
|
-
self.config["peer_connect_interval"],
|
|
554
|
-
self.config["selected_network"],
|
|
555
|
-
default_port,
|
|
556
|
-
self.log,
|
|
551
|
+
server=self.server,
|
|
552
|
+
target_outbound_count=self.config["target_outbound_peer_count"],
|
|
553
|
+
peers_file_path=self.root_path / Path(self.config.get("peers_file_path", "db/peers.dat")),
|
|
554
|
+
introducer_info=self.config["introducer_peer"],
|
|
555
|
+
dns_servers=dns_servers,
|
|
556
|
+
peer_connect_interval=self.config["peer_connect_interval"],
|
|
557
|
+
selected_network=self.config["selected_network"],
|
|
558
|
+
default_port=default_port,
|
|
559
|
+
log=self.log,
|
|
557
560
|
)
|
|
558
561
|
except Exception as e:
|
|
559
562
|
error_stack = traceback.format_exc()
|
|
@@ -837,7 +840,7 @@ class FullNode:
|
|
|
837
840
|
peak_block = await self.blockchain.get_full_peak()
|
|
838
841
|
if peak_block is not None:
|
|
839
842
|
peak = self.blockchain.block_record(peak_block.header_hash)
|
|
840
|
-
difficulty = self.blockchain.
|
|
843
|
+
difficulty = self.blockchain.get_next_sub_slot_iters_and_difficulty(peak.header_hash, False)[1]
|
|
841
844
|
ses: Optional[SubEpochSummary] = next_sub_epoch_summary(
|
|
842
845
|
self.constants,
|
|
843
846
|
self.blockchain,
|
|
@@ -912,6 +915,7 @@ class FullNode:
|
|
|
912
915
|
|
|
913
916
|
self._state_changed("add_connection")
|
|
914
917
|
self._state_changed("sync_mode")
|
|
918
|
+
# TODO: this can probably be improved
|
|
915
919
|
if self.full_node_peers is not None:
|
|
916
920
|
create_referenced_task(self.full_node_peers.on_connect(connection))
|
|
917
921
|
|
|
@@ -1345,7 +1349,7 @@ class FullNode:
|
|
|
1345
1349
|
],
|
|
1346
1350
|
) -> None:
|
|
1347
1351
|
nonlocal fork_info
|
|
1348
|
-
block_rate = 0
|
|
1352
|
+
block_rate = 0.0
|
|
1349
1353
|
block_rate_time = time.monotonic()
|
|
1350
1354
|
block_rate_height = -1
|
|
1351
1355
|
while True:
|
|
@@ -1376,12 +1380,13 @@ class FullNode:
|
|
|
1376
1380
|
raise ValueError(f"Failed to validate block batch {start_height} to {end_height}: {err}")
|
|
1377
1381
|
if end_height - block_rate_height > 100:
|
|
1378
1382
|
now = time.monotonic()
|
|
1379
|
-
block_rate =
|
|
1383
|
+
block_rate = (end_height - block_rate_height) / (now - block_rate_time)
|
|
1380
1384
|
block_rate_time = now
|
|
1381
1385
|
block_rate_height = end_height
|
|
1382
1386
|
|
|
1383
1387
|
self.log.info(
|
|
1384
|
-
f"Added blocks {start_height} to {end_height}
|
|
1388
|
+
f"Added blocks {start_height} to {end_height} "
|
|
1389
|
+
f"({block_rate:.3g} blocks/s) (from: {peer.peer_info.ip})"
|
|
1385
1390
|
)
|
|
1386
1391
|
peak: Optional[BlockRecord] = self.blockchain.get_peak()
|
|
1387
1392
|
if state_change_summary is not None:
|
|
@@ -1805,14 +1810,14 @@ class FullNode:
|
|
|
1805
1810
|
# Makes sure to potentially update the difficulty if we are past the peak (into a new sub-slot)
|
|
1806
1811
|
assert ip_sub_slot is not None
|
|
1807
1812
|
if request.challenge_chain_vdf.challenge != ip_sub_slot.challenge_chain.get_hash():
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
sub_slot_iters = next_sub_slot_iters
|
|
1813
|
+
sub_slot_iters, difficulty = self.blockchain.get_next_sub_slot_iters_and_difficulty(
|
|
1814
|
+
peak.header_hash, True
|
|
1815
|
+
)
|
|
1812
1816
|
else:
|
|
1813
1817
|
difficulty = self.constants.DIFFICULTY_STARTING
|
|
1814
1818
|
sub_slot_iters = self.constants.SUB_SLOT_ITERS_STARTING
|
|
1815
1819
|
|
|
1820
|
+
tx_peak = self.blockchain.get_tx_peak()
|
|
1816
1821
|
# Notify farmers of the new signage point
|
|
1817
1822
|
broadcast_farmer = farmer_protocol.NewSignagePoint(
|
|
1818
1823
|
request.challenge_chain_vdf.challenge,
|
|
@@ -1822,6 +1827,7 @@ class FullNode:
|
|
|
1822
1827
|
sub_slot_iters,
|
|
1823
1828
|
request.index_from_challenge,
|
|
1824
1829
|
uint32(0) if peak is None else peak.height,
|
|
1830
|
+
tx_peak.height if tx_peak is not None else uint32(0),
|
|
1825
1831
|
sp_source_data=SignagePointSourceData(
|
|
1826
1832
|
vdf_data=SPVDFSourceData(request.challenge_chain_vdf.output, request.reward_chain_vdf.output)
|
|
1827
1833
|
),
|
|
@@ -1843,8 +1849,7 @@ class FullNode:
|
|
|
1843
1849
|
"""
|
|
1844
1850
|
|
|
1845
1851
|
record = state_change_summary.peak
|
|
1846
|
-
difficulty = self.blockchain.
|
|
1847
|
-
sub_slot_iters = self.blockchain.get_next_slot_iters(record.header_hash, False)
|
|
1852
|
+
sub_slot_iters, difficulty = self.blockchain.get_next_sub_slot_iters_and_difficulty(record.header_hash, False)
|
|
1848
1853
|
|
|
1849
1854
|
self.log.info(
|
|
1850
1855
|
f"🌱 Updated peak to height {record.height}, weight {record.weight}, "
|
|
@@ -1893,6 +1898,7 @@ class FullNode:
|
|
|
1893
1898
|
difficulty,
|
|
1894
1899
|
)
|
|
1895
1900
|
|
|
1901
|
+
signage_points: list[tuple[RespondSignagePoint, WSChiaConnection, Optional[EndOfSubSlotBundle]]] = []
|
|
1896
1902
|
if fns_peak_result.new_signage_points is not None and peer is not None:
|
|
1897
1903
|
for index, sp in fns_peak_result.new_signage_points:
|
|
1898
1904
|
assert (
|
|
@@ -1901,8 +1907,13 @@ class FullNode:
|
|
|
1901
1907
|
and sp.rc_vdf is not None
|
|
1902
1908
|
and sp.rc_proof is not None
|
|
1903
1909
|
)
|
|
1904
|
-
|
|
1905
|
-
|
|
1910
|
+
# Collect the data for networking outside the mutex
|
|
1911
|
+
signage_points.append(
|
|
1912
|
+
(
|
|
1913
|
+
RespondSignagePoint(index, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof),
|
|
1914
|
+
peer,
|
|
1915
|
+
sub_slots[1],
|
|
1916
|
+
)
|
|
1906
1917
|
)
|
|
1907
1918
|
|
|
1908
1919
|
if sub_slots[1] is None:
|
|
@@ -1932,6 +1943,7 @@ class FullNode:
|
|
|
1932
1943
|
fns_peak_result,
|
|
1933
1944
|
hints_to_add,
|
|
1934
1945
|
lookup_coin_ids,
|
|
1946
|
+
signage_points=signage_points,
|
|
1935
1947
|
)
|
|
1936
1948
|
|
|
1937
1949
|
async def peak_post_processing_2(
|
|
@@ -1946,6 +1958,8 @@ class FullNode:
|
|
|
1946
1958
|
with peers
|
|
1947
1959
|
"""
|
|
1948
1960
|
record = state_change_summary.peak
|
|
1961
|
+
for signage_point in ppp_result.signage_points:
|
|
1962
|
+
await self.signage_point_post_processing(*signage_point)
|
|
1949
1963
|
for new_peak_item in ppp_result.mempool_peak_result:
|
|
1950
1964
|
self.log.debug(f"Added transaction to mempool: {new_peak_item.transaction_id}")
|
|
1951
1965
|
mempool_item = self.mempool_manager.get_mempool_item(new_peak_item.transaction_id)
|
|
@@ -2142,7 +2156,7 @@ class FullNode:
|
|
|
2142
2156
|
added = AddBlockResult.DISCONNECTED_BLOCK
|
|
2143
2157
|
error_code: Optional[Err] = Err.INVALID_PREV_BLOCK_HASH
|
|
2144
2158
|
elif Err(pre_validation_result.error) == Err.TIMESTAMP_TOO_FAR_IN_FUTURE:
|
|
2145
|
-
raise TimestampError
|
|
2159
|
+
raise TimestampError
|
|
2146
2160
|
else:
|
|
2147
2161
|
raise ValueError(
|
|
2148
2162
|
f"Failed to validate block {header_hash} height "
|
|
@@ -2244,7 +2258,8 @@ class FullNode:
|
|
|
2244
2258
|
|
|
2245
2259
|
state_changed_data: dict[str, Any] = {
|
|
2246
2260
|
"transaction_block": False,
|
|
2247
|
-
"k_size": block.reward_chain_block.proof_of_space.size,
|
|
2261
|
+
"k_size": block.reward_chain_block.proof_of_space.size().size_v1,
|
|
2262
|
+
"k_size2": block.reward_chain_block.proof_of_space.size().size_v2,
|
|
2248
2263
|
"header_hash": block.header_hash,
|
|
2249
2264
|
"fork_height": None,
|
|
2250
2265
|
"rolled_back_records": None,
|
|
@@ -2356,7 +2371,7 @@ class FullNode:
|
|
|
2356
2371
|
_, header_error = await self.blockchain.validate_unfinished_block_header(block)
|
|
2357
2372
|
if header_error is not None:
|
|
2358
2373
|
if header_error == Err.TIMESTAMP_TOO_FAR_IN_FUTURE:
|
|
2359
|
-
raise TimestampError
|
|
2374
|
+
raise TimestampError
|
|
2360
2375
|
else:
|
|
2361
2376
|
raise ConsensusError(header_error)
|
|
2362
2377
|
validate_time = time.monotonic() - start_header_time
|
|
@@ -2670,8 +2685,9 @@ class FullNode:
|
|
|
2670
2685
|
|
|
2671
2686
|
peak = self.blockchain.get_peak()
|
|
2672
2687
|
if peak is not None and peak.height > 2:
|
|
2673
|
-
next_sub_slot_iters = self.blockchain.
|
|
2674
|
-
|
|
2688
|
+
next_sub_slot_iters, next_difficulty = self.blockchain.get_next_sub_slot_iters_and_difficulty(
|
|
2689
|
+
peak.header_hash, True
|
|
2690
|
+
)
|
|
2675
2691
|
else:
|
|
2676
2692
|
next_sub_slot_iters = self.constants.SUB_SLOT_ITERS_STARTING
|
|
2677
2693
|
next_difficulty = self.constants.DIFFICULTY_STARTING
|
|
@@ -2708,7 +2724,7 @@ class FullNode:
|
|
|
2708
2724
|
|
|
2709
2725
|
for infusion in new_infusions:
|
|
2710
2726
|
await self.new_infusion_point_vdf(infusion)
|
|
2711
|
-
|
|
2727
|
+
tx_peak = self.blockchain.get_tx_peak()
|
|
2712
2728
|
# Notify farmers of the new sub-slot
|
|
2713
2729
|
broadcast_farmer = farmer_protocol.NewSignagePoint(
|
|
2714
2730
|
end_of_slot_bundle.challenge_chain.get_hash(),
|
|
@@ -2718,6 +2734,7 @@ class FullNode:
|
|
|
2718
2734
|
next_sub_slot_iters,
|
|
2719
2735
|
uint8(0),
|
|
2720
2736
|
uint32(0) if peak is None else peak.height,
|
|
2737
|
+
tx_peak.height if tx_peak is not None else uint32(0),
|
|
2721
2738
|
sp_source_data=SignagePointSourceData(
|
|
2722
2739
|
sub_slot_data=SPSubSlotSourceData(
|
|
2723
2740
|
end_of_slot_bundle.challenge_chain, end_of_slot_bundle.reward_chain
|
chia/full_node/full_node_api.py
CHANGED
|
@@ -12,13 +12,21 @@ from typing import TYPE_CHECKING, ClassVar, Optional, cast
|
|
|
12
12
|
import anyio
|
|
13
13
|
from chia_rs import (
|
|
14
14
|
AugSchemeMPL,
|
|
15
|
+
BlockRecord,
|
|
16
|
+
CoinState,
|
|
17
|
+
EndOfSubSlotBundle,
|
|
15
18
|
FoliageBlockData,
|
|
16
19
|
FoliageTransactionBlock,
|
|
20
|
+
FullBlock,
|
|
17
21
|
G1Element,
|
|
18
22
|
G2Element,
|
|
19
23
|
MerkleSet,
|
|
20
24
|
PoolTarget,
|
|
25
|
+
RespondToPhUpdates,
|
|
21
26
|
RewardChainBlockUnfinished,
|
|
27
|
+
SpendBundle,
|
|
28
|
+
SubEpochSummary,
|
|
29
|
+
UnfinishedBlock,
|
|
22
30
|
additions_and_removals,
|
|
23
31
|
get_flags_for_height_and_constants,
|
|
24
32
|
)
|
|
@@ -27,23 +35,24 @@ from chia_rs.sized_ints import uint8, uint32, uint64, uint128
|
|
|
27
35
|
from chiabip158 import PyBIP158
|
|
28
36
|
|
|
29
37
|
from chia.consensus.block_creation import create_unfinished_block
|
|
30
|
-
from chia.consensus.block_record import BlockRecord
|
|
31
38
|
from chia.consensus.blockchain import BlockchainMutexPriority
|
|
39
|
+
from chia.consensus.generator_tools import get_block_header
|
|
32
40
|
from chia.consensus.get_block_generator import get_block_generator
|
|
33
41
|
from chia.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters
|
|
42
|
+
from chia.consensus.signage_point import SignagePoint
|
|
34
43
|
from chia.full_node.coin_store import CoinStore
|
|
35
|
-
from chia.full_node.fee_estimate import FeeEstimate, FeeEstimateGroup, fee_rate_v2_to_v1
|
|
36
44
|
from chia.full_node.fee_estimator_interface import FeeEstimatorInterface
|
|
45
|
+
from chia.full_node.full_block_utils import get_height_and_tx_status_from_block, header_block_from_block
|
|
37
46
|
from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin
|
|
38
|
-
from chia.full_node.
|
|
39
|
-
from chia.full_node.tx_processing_queue import TransactionQueueFull
|
|
47
|
+
from chia.full_node.tx_processing_queue import TransactionQueueEntry, TransactionQueueFull
|
|
40
48
|
from chia.protocols import farmer_protocol, full_node_protocol, introducer_protocol, timelord_protocol, wallet_protocol
|
|
49
|
+
from chia.protocols.fee_estimate import FeeEstimate, FeeEstimateGroup, fee_rate_v2_to_v1
|
|
41
50
|
from chia.protocols.full_node_protocol import RejectBlock, RejectBlocks
|
|
51
|
+
from chia.protocols.outbound_message import Message, make_msg
|
|
42
52
|
from chia.protocols.protocol_message_types import ProtocolMessageTypes
|
|
43
53
|
from chia.protocols.protocol_timing import RATE_LIMITER_BAN_SECONDS
|
|
44
54
|
from chia.protocols.shared_protocol import Capability
|
|
45
55
|
from chia.protocols.wallet_protocol import (
|
|
46
|
-
CoinState,
|
|
47
56
|
PuzzleSolutionResponse,
|
|
48
57
|
RejectBlockHeaders,
|
|
49
58
|
RejectHeaderBlocks,
|
|
@@ -52,26 +61,17 @@ from chia.protocols.wallet_protocol import (
|
|
|
52
61
|
RespondSESInfo,
|
|
53
62
|
)
|
|
54
63
|
from chia.server.api_protocol import ApiMetadata
|
|
55
|
-
from chia.server.outbound_message import Message, make_msg
|
|
56
64
|
from chia.server.server import ChiaServer
|
|
57
65
|
from chia.server.ws_connection import WSChiaConnection
|
|
58
66
|
from chia.types.block_protocol import BlockInfo
|
|
59
67
|
from chia.types.blockchain_format.coin import Coin, hash_coin_ids
|
|
60
68
|
from chia.types.blockchain_format.proof_of_space import verify_and_get_quality_string
|
|
61
|
-
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
|
|
62
69
|
from chia.types.coin_record import CoinRecord
|
|
63
|
-
from chia.types.
|
|
64
|
-
from chia.types.full_block import FullBlock
|
|
65
|
-
from chia.types.generator_types import BlockGenerator
|
|
70
|
+
from chia.types.generator_types import BlockGenerator, NewBlockGenerator
|
|
66
71
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
67
72
|
from chia.types.peer_info import PeerInfo
|
|
68
|
-
from chia.types.spend_bundle import SpendBundle
|
|
69
|
-
from chia.types.transaction_queue_entry import TransactionQueueEntry
|
|
70
|
-
from chia.types.unfinished_block import UnfinishedBlock
|
|
71
73
|
from chia.util.batches import to_batches
|
|
72
74
|
from chia.util.db_wrapper import SQLITE_MAX_VARIABLE_NUMBER
|
|
73
|
-
from chia.util.full_block_utils import get_height_and_tx_status_from_block, header_block_from_block
|
|
74
|
-
from chia.util.generator_tools import get_block_header
|
|
75
75
|
from chia.util.hash import std_hash
|
|
76
76
|
from chia.util.limited_semaphore import LimitedSemaphoreFullError
|
|
77
77
|
from chia.util.task_referencer import create_referenced_task
|
|
@@ -301,7 +301,7 @@ class FullNodeAPI:
|
|
|
301
301
|
|
|
302
302
|
if len(tips) > 4:
|
|
303
303
|
# Remove old from cache
|
|
304
|
-
for i in range(
|
|
304
|
+
for i in range(4):
|
|
305
305
|
self.full_node.pow_creation.pop(tips[i])
|
|
306
306
|
|
|
307
307
|
if wp is None:
|
|
@@ -717,14 +717,18 @@ class FullNodeAPI:
|
|
|
717
717
|
request.reward_chain_vdf.challenge,
|
|
718
718
|
):
|
|
719
719
|
return None
|
|
720
|
-
existing_sp = self.full_node.full_node_store.
|
|
721
|
-
request.challenge_chain_vdf.output.get_hash()
|
|
720
|
+
existing_sp = self.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
|
|
721
|
+
request.challenge_chain_vdf.output.get_hash(),
|
|
722
|
+
request.challenge_chain_vdf.challenge,
|
|
723
|
+
request.index_from_challenge,
|
|
722
724
|
)
|
|
723
725
|
if existing_sp is not None and existing_sp.rc_vdf == request.reward_chain_vdf:
|
|
724
726
|
return None
|
|
725
727
|
peak = self.full_node.blockchain.get_peak()
|
|
726
728
|
if peak is not None and peak.height > self.full_node.constants.MAX_SUB_SLOT_BLOCKS:
|
|
727
|
-
next_sub_slot_iters = self.full_node.blockchain.
|
|
729
|
+
next_sub_slot_iters = self.full_node.blockchain.get_next_sub_slot_iters_and_difficulty(
|
|
730
|
+
peak.header_hash, True
|
|
731
|
+
)[0]
|
|
728
732
|
sub_slots_for_peak = await self.full_node.blockchain.get_sp_and_ip_sub_slots(peak.header_hash)
|
|
729
733
|
assert sub_slots_for_peak is not None
|
|
730
734
|
ip_sub_slot: Optional[EndOfSubSlotBundle] = sub_slots_for_peak[1]
|
|
@@ -795,8 +799,8 @@ class FullNodeAPI:
|
|
|
795
799
|
return None
|
|
796
800
|
|
|
797
801
|
async with self.full_node.timelord_lock:
|
|
798
|
-
sp_vdfs: Optional[SignagePoint] = self.full_node.full_node_store.
|
|
799
|
-
request.challenge_chain_sp
|
|
802
|
+
sp_vdfs: Optional[SignagePoint] = self.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
|
|
803
|
+
request.challenge_chain_sp, request.challenge_hash, request.signage_point_index
|
|
800
804
|
)
|
|
801
805
|
|
|
802
806
|
if sp_vdfs is None:
|
|
@@ -835,10 +839,7 @@ class FullNodeAPI:
|
|
|
835
839
|
# 3. In a future sub-slot that we already know of
|
|
836
840
|
|
|
837
841
|
# Grab best transactions from Mempool for given tip target
|
|
838
|
-
|
|
839
|
-
block_generator: Optional[BlockGenerator] = None
|
|
840
|
-
additions: Optional[list[Coin]] = []
|
|
841
|
-
removals: Optional[list[Coin]] = []
|
|
842
|
+
new_block_gen: Optional[NewBlockGenerator]
|
|
842
843
|
async with self.full_node.blockchain.priority_mutex.acquire(priority=BlockchainMutexPriority.high):
|
|
843
844
|
peak: Optional[BlockRecord] = self.full_node.blockchain.get_peak()
|
|
844
845
|
|
|
@@ -863,12 +864,31 @@ class FullNodeAPI:
|
|
|
863
864
|
while not curr_l_tb.is_transaction_block:
|
|
864
865
|
curr_l_tb = self.full_node.blockchain.block_record(curr_l_tb.prev_hash)
|
|
865
866
|
try:
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
867
|
+
# TODO: once we're confident in the new block creation,
|
|
868
|
+
# make it default to 1
|
|
869
|
+
block_version = self.full_node.config.get("block_creation", 0)
|
|
870
|
+
block_timeout = self.full_node.config.get("block_creation_timeout", 2.0)
|
|
871
|
+
if block_version == 0:
|
|
872
|
+
create_block = self.full_node.mempool_manager.create_block_generator
|
|
873
|
+
elif block_version == 1:
|
|
874
|
+
create_block = self.full_node.mempool_manager.create_block_generator2
|
|
875
|
+
else:
|
|
876
|
+
self.log.warning(f"Unknown 'block_creation' config: {block_version}")
|
|
877
|
+
create_block = self.full_node.mempool_manager.create_block_generator
|
|
878
|
+
|
|
879
|
+
new_block_gen = create_block(curr_l_tb.header_hash, block_timeout)
|
|
880
|
+
|
|
881
|
+
if (
|
|
882
|
+
new_block_gen is not None and peak.height < self.full_node.constants.HARD_FORK_HEIGHT
|
|
883
|
+
): # pragma: no cover
|
|
884
|
+
self.log.error("Cannot farm blocks pre-hard fork")
|
|
885
|
+
|
|
869
886
|
except Exception as e:
|
|
870
887
|
self.log.error(f"Traceback: {traceback.format_exc()}")
|
|
871
888
|
self.full_node.log.error(f"Error making spend bundle {e} peak: {peak}")
|
|
889
|
+
new_block_gen = None
|
|
890
|
+
else:
|
|
891
|
+
new_block_gen = None
|
|
872
892
|
|
|
873
893
|
def get_plot_sig(to_sign: bytes32, _extra: G1Element) -> G2Element:
|
|
874
894
|
if to_sign == request.challenge_chain_sp:
|
|
@@ -962,12 +982,15 @@ class FullNodeAPI:
|
|
|
962
982
|
if sub_slot.challenge_chain.new_sub_slot_iters is not None:
|
|
963
983
|
sub_slot_iters = sub_slot.challenge_chain.new_sub_slot_iters
|
|
964
984
|
|
|
985
|
+
tx_peak = self.full_node.blockchain.get_tx_peak()
|
|
965
986
|
required_iters: uint64 = calculate_iterations_quality(
|
|
966
|
-
self.full_node.constants
|
|
987
|
+
self.full_node.constants,
|
|
967
988
|
quality_string,
|
|
968
|
-
request.proof_of_space.size,
|
|
989
|
+
request.proof_of_space.size(),
|
|
969
990
|
difficulty,
|
|
970
991
|
request.challenge_chain_sp,
|
|
992
|
+
sub_slot_iters,
|
|
993
|
+
tx_peak.height if tx_peak is not None else uint32(0),
|
|
971
994
|
)
|
|
972
995
|
sp_iters: uint64 = calculate_sp_iters(self.full_node.constants, sub_slot_iters, request.signage_point_index)
|
|
973
996
|
ip_iters: uint64 = calculate_ip_iters(
|
|
@@ -1005,10 +1028,7 @@ class FullNodeAPI:
|
|
|
1005
1028
|
timestamp,
|
|
1006
1029
|
self.full_node.blockchain,
|
|
1007
1030
|
b"",
|
|
1008
|
-
|
|
1009
|
-
aggregate_signature,
|
|
1010
|
-
additions,
|
|
1011
|
-
removals,
|
|
1031
|
+
new_block_gen,
|
|
1012
1032
|
prev_b,
|
|
1013
1033
|
finished_sub_slots,
|
|
1014
1034
|
)
|
|
@@ -1065,9 +1085,6 @@ class FullNodeAPI:
|
|
|
1065
1085
|
self.full_node.blockchain,
|
|
1066
1086
|
b"",
|
|
1067
1087
|
None,
|
|
1068
|
-
G2Element(),
|
|
1069
|
-
None,
|
|
1070
|
-
None,
|
|
1071
1088
|
prev_b,
|
|
1072
1089
|
finished_sub_slots,
|
|
1073
1090
|
)
|
|
@@ -1220,7 +1237,7 @@ class FullNodeAPI:
|
|
|
1220
1237
|
)
|
|
1221
1238
|
# strip the hint from additions, and compute the puzzle hash for
|
|
1222
1239
|
# removals
|
|
1223
|
-
removals_and_additions = ([
|
|
1240
|
+
removals_and_additions = ([name for name, _ in removals], [name for name, _ in additions])
|
|
1224
1241
|
elif block.is_transaction_block():
|
|
1225
1242
|
# This is a transaction block with just reward coins.
|
|
1226
1243
|
removals_and_additions = ([], [])
|
|
@@ -1377,7 +1394,7 @@ class FullNodeAPI:
|
|
|
1377
1394
|
if status == MempoolInclusionStatus.SUCCESS:
|
|
1378
1395
|
response = wallet_protocol.TransactionAck(spend_name, uint8(status.value), error_name)
|
|
1379
1396
|
else:
|
|
1380
|
-
# If
|
|
1397
|
+
# If it failed/pending, but it previously succeeded (in mempool), this is idempotence, return SUCCESS
|
|
1381
1398
|
if self.full_node.mempool_manager.get_spendbundle(spend_name) is not None:
|
|
1382
1399
|
response = wallet_protocol.TransactionAck(
|
|
1383
1400
|
spend_name, uint8(MempoolInclusionStatus.SUCCESS.value), None
|
|
@@ -1652,7 +1669,7 @@ class FullNodeAPI:
|
|
|
1652
1669
|
end_time - start_time,
|
|
1653
1670
|
)
|
|
1654
1671
|
|
|
1655
|
-
response =
|
|
1672
|
+
response = RespondToPhUpdates(request.puzzle_hashes, request.min_height, list(states))
|
|
1656
1673
|
msg = make_msg(ProtocolMessageTypes.respond_to_ph_updates, response)
|
|
1657
1674
|
return msg
|
|
1658
1675
|
|