chia-blockchain 2.5.2rc2__py3-none-any.whl → 2.5.3__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/__init__.py +7 -0
- chia/_tests/blockchain/blockchain_test_utils.py +1 -1
- chia/_tests/blockchain/test_augmented_chain.py +54 -5
- chia/_tests/blockchain/test_blockchain.py +5 -12
- chia/_tests/blockchain/test_blockchain_transactions.py +3 -5
- chia/_tests/blockchain/test_get_block_generator.py +2 -2
- chia/_tests/blockchain/test_lookup_fork_chain.py +2 -2
- chia/_tests/clvm/benchmark_costs.py +2 -1
- chia/_tests/clvm/coin_store.py +4 -3
- chia/_tests/clvm/test_chialisp_deserialization.py +2 -2
- chia/_tests/clvm/test_curry_and_treehash.py +1 -1
- chia/_tests/clvm/test_puzzle_compression.py +2 -2
- chia/_tests/clvm/test_puzzles.py +2 -2
- chia/_tests/clvm/test_singletons.py +2 -2
- chia/_tests/clvm/test_spend_sim.py +1 -1
- chia/_tests/cmds/cmd_test_utils.py +2 -2
- chia/_tests/cmds/test_click_types.py +2 -2
- chia/_tests/cmds/test_cmd_framework.py +6 -6
- chia/_tests/cmds/test_show.py +4 -3
- chia/_tests/cmds/test_tx_config_args.py +1 -1
- chia/_tests/cmds/testing_classes.py +2 -2
- chia/_tests/cmds/wallet/test_consts.py +2 -2
- chia/_tests/cmds/wallet/test_did.py +2 -2
- chia/_tests/cmds/wallet/test_nft.py +2 -2
- chia/_tests/cmds/wallet/test_notifications.py +3 -2
- chia/_tests/cmds/wallet/test_vcs.py +2 -2
- chia/_tests/cmds/wallet/test_wallet.py +4 -8
- chia/_tests/conftest.py +4 -3
- chia/_tests/connection_utils.py +2 -2
- chia/_tests/core/cmds/test_keys.py +1 -2
- chia/_tests/core/cmds/test_wallet.py +2 -2
- chia/_tests/core/consensus/test_block_creation.py +2 -2
- chia/_tests/core/consensus/test_pot_iterations.py +1 -1
- chia/_tests/core/custom_types/test_coin.py +2 -2
- chia/_tests/core/custom_types/test_proof_of_space.py +2 -2
- chia/_tests/core/custom_types/test_spend_bundle.py +2 -2
- chia/_tests/core/data_layer/conftest.py +1 -1
- 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 +2 -2
- chia/_tests/core/data_layer/test_data_store.py +1 -1
- chia/_tests/core/data_layer/test_data_store_schema.py +1 -1
- chia/_tests/core/data_layer/util.py +2 -1
- chia/_tests/core/farmer/test_farmer_api.py +1 -1
- chia/_tests/core/full_node/full_sync/test_full_sync.py +1 -7
- chia/_tests/core/full_node/ram_db.py +2 -1
- chia/_tests/core/full_node/stores/test_block_store.py +2 -2
- chia/_tests/core/full_node/stores/test_coin_store.py +2 -2
- chia/_tests/core/full_node/stores/test_full_node_store.py +3 -3
- chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
- chia/_tests/core/full_node/stores/test_sync_store.py +1 -1
- chia/_tests/core/full_node/test_address_manager.py +1 -1
- chia/_tests/core/full_node/test_block_height_map.py +2 -2
- chia/_tests/core/full_node/test_conditions.py +1 -1
- chia/_tests/core/full_node/test_full_node.py +346 -164
- chia/_tests/core/full_node/test_generator_tools.py +3 -2
- chia/_tests/core/full_node/test_hint_management.py +2 -2
- chia/_tests/core/full_node/test_performance.py +2 -15
- chia/_tests/core/full_node/test_subscriptions.py +1 -1
- chia/_tests/core/full_node/test_transactions.py +186 -185
- chia/_tests/core/full_node/test_tx_processing_queue.py +1 -1
- chia/_tests/core/make_block_generator.py +2 -2
- chia/_tests/core/mempool/test_mempool.py +165 -22
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
- chia/_tests/core/mempool/test_mempool_fee_protocol.py +1 -1
- chia/_tests/core/mempool/test_mempool_manager.py +476 -66
- chia/_tests/core/mempool/test_mempool_performance.py +2 -2
- chia/_tests/core/mempool/test_singleton_fast_forward.py +19 -25
- chia/_tests/core/node_height.py +2 -1
- chia/_tests/core/server/test_capabilities.py +1 -1
- chia/_tests/core/server/test_dos.py +36 -28
- chia/_tests/core/server/test_loop.py +3 -3
- chia/_tests/core/server/test_rate_limits.py +1 -1
- chia/_tests/core/server/test_server.py +2 -2
- chia/_tests/core/services/test_services.py +1 -1
- chia/_tests/core/ssl/test_ssl.py +1 -1
- chia/_tests/core/test_coins.py +2 -1
- chia/_tests/core/test_cost_calculation.py +2 -2
- chia/_tests/core/test_crawler.py +2 -2
- chia/_tests/core/test_db_conversion.py +2 -2
- chia/_tests/core/test_db_validation.py +26 -13
- chia/_tests/core/test_farmer_harvester_rpc.py +2 -2
- chia/_tests/core/test_full_node_rpc.py +2 -2
- chia/_tests/core/test_merkle_set.py +2 -2
- chia/_tests/core/test_program.py +2 -2
- chia/_tests/core/test_rpc_util.py +1 -1
- chia/_tests/core/test_seeder.py +1 -1
- chia/_tests/core/util/test_block_cache.py +3 -3
- chia/_tests/core/util/test_jsonify.py +3 -2
- chia/_tests/core/util/test_keychain.py +3 -3
- chia/_tests/core/util/test_streamable.py +3 -4
- chia/_tests/environments/wallet.py +3 -2
- chia/_tests/farmer_harvester/test_farmer.py +3 -4
- chia/_tests/farmer_harvester/test_farmer_harvester.py +2 -2
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +2 -2
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +3 -4
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -1
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +2 -2
- chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
- chia/_tests/fee_estimation/test_mempoolitem_height_added.py +3 -4
- chia/_tests/generator/test_compression.py +20 -10
- chia/_tests/generator/test_rom.py +7 -9
- chia/_tests/plot_sync/test_delta.py +2 -2
- chia/_tests/plot_sync/test_plot_sync.py +2 -2
- chia/_tests/plot_sync/test_receiver.py +2 -2
- chia/_tests/plot_sync/test_sender.py +2 -2
- chia/_tests/plot_sync/test_sync_simulated.py +2 -2
- chia/_tests/plot_sync/util.py +3 -2
- chia/_tests/plotting/test_plot_manager.py +1 -1
- chia/_tests/pools/test_pool_cli_parsing.py +3 -2
- chia/_tests/pools/test_pool_cmdline.py +2 -2
- chia/_tests/pools/test_pool_puzzles_lifecycle.py +3 -3
- chia/_tests/pools/test_pool_rpc.py +4 -5
- chia/_tests/pools/test_pool_wallet.py +1 -1
- chia/_tests/pools/test_wallet_pool_store.py +2 -2
- chia/_tests/rpc/test_rpc_client.py +1 -1
- chia/_tests/rpc/test_rpc_server.py +1 -1
- chia/_tests/simulation/test_simulation.py +36 -8
- chia/_tests/simulation/test_simulator.py +5 -5
- chia/_tests/simulation/test_start_simulator.py +2 -2
- chia/_tests/timelord/test_new_peak.py +2 -2
- chia/_tests/tools/test_run_block.py +3 -2
- chia/_tests/util/benchmark_cost.py +2 -2
- chia/_tests/util/benchmarks.py +17 -6
- chia/_tests/util/blockchain.py +2 -1
- chia/_tests/util/blockchain_mock.py +9 -5
- chia/_tests/util/build_network_protocol_files.py +2 -1
- chia/_tests/util/constants.py +2 -1
- chia/_tests/util/full_sync.py +6 -3
- chia/_tests/util/gen_ssl_certs.py +2 -2
- chia/_tests/util/generator_tools_testing.py +4 -3
- chia/_tests/util/get_name_puzzle_conditions.py +2 -2
- chia/_tests/util/misc.py +16 -2
- chia/_tests/util/network_protocol_data.py +17 -7
- chia/_tests/util/run_block.py +6 -8
- chia/_tests/util/setup_nodes.py +4 -3
- chia/_tests/util/spend_sim.py +9 -5
- chia/_tests/util/test_condition_tools.py +2 -2
- chia/_tests/util/test_config.py +2 -1
- chia/_tests/util/test_errors.py +2 -1
- chia/_tests/util/test_full_block_utils.py +17 -7
- chia/_tests/util/test_misc.py +1 -1
- chia/_tests/util/test_network_protocol_test.py +24 -24
- chia/_tests/util/test_replace_str_to_bytes.py +2 -2
- chia/_tests/util/test_trusted_peer.py +1 -1
- chia/_tests/util/time_out_assert.py +20 -7
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +2 -2
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +5 -6
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +17 -15
- chia/_tests/wallet/cat_wallet/test_trades.py +2 -2
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +2 -2
- chia/_tests/wallet/clawback/test_clawback_metadata.py +2 -2
- chia/_tests/wallet/conftest.py +3 -3
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +3 -5
- chia/_tests/wallet/db_wallet/test_dl_offers.py +2 -2
- chia/_tests/wallet/db_wallet/test_dl_wallet.py +433 -384
- chia/_tests/wallet/did_wallet/test_did.py +3 -3
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +2 -2
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +2 -2
- chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +3 -4
- chia/_tests/wallet/nft_wallet/test_nft_offers.py +1293 -703
- chia/_tests/wallet/nft_wallet/test_nft_puzzles.py +28 -30
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +2 -2
- chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +2 -2
- chia/_tests/wallet/rpc/config.py +1 -1
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +2 -2
- chia/_tests/wallet/rpc/test_wallet_rpc.py +20 -77
- chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +9 -7
- chia/_tests/wallet/sync/test_wallet_sync.py +79 -31
- chia/_tests/wallet/test_clvm_streamable.py +2 -2
- chia/_tests/wallet/test_coin_management.py +7 -7
- chia/_tests/wallet/test_coin_selection.py +20 -2
- chia/_tests/wallet/test_conditions.py +2 -2
- chia/_tests/wallet/test_debug_spend_bundle.py +2 -2
- chia/_tests/wallet/test_new_wallet_protocol.py +2 -2
- chia/_tests/wallet/test_nft_store.py +2 -2
- chia/_tests/wallet/test_notifications.py +2 -2
- chia/_tests/wallet/test_puzzle_store.py +2 -2
- chia/_tests/wallet/test_sign_coin_spends.py +2 -2
- chia/_tests/wallet/test_signer_protocol.py +3 -3
- chia/_tests/wallet/test_singleton.py +3 -11
- chia/_tests/wallet/test_singleton_lifecycle_fast.py +12 -13
- chia/_tests/wallet/test_singleton_store.py +2 -4
- chia/_tests/wallet/test_transaction_store.py +2 -2
- chia/_tests/wallet/test_util.py +2 -2
- chia/_tests/wallet/test_wallet.py +53 -49
- chia/_tests/wallet/test_wallet_action_scope.py +24 -6
- chia/_tests/wallet/test_wallet_blockchain.py +1 -1
- chia/_tests/wallet/test_wallet_coin_store.py +2 -2
- chia/_tests/wallet/test_wallet_interested_store.py +2 -2
- chia/_tests/wallet/test_wallet_node.py +3 -3
- chia/_tests/wallet/test_wallet_retry.py +3 -3
- chia/_tests/wallet/test_wallet_state_manager.py +8 -8
- chia/_tests/wallet/test_wallet_test_framework.py +1 -1
- chia/_tests/wallet/test_wallet_trade_store.py +2 -2
- chia/_tests/wallet/test_wallet_utils.py +2 -2
- chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py +3 -2
- chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +15 -15
- chia/_tests/wallet/vc_wallet/test_vc_wallet.py +5 -3
- chia/_tests/wallet/wallet_block_tools.py +15 -7
- chia/_tests/weight_proof/test_weight_proof.py +3 -3
- chia/cmds/chia.py +0 -2
- chia/cmds/cmd_classes.py +3 -3
- chia/cmds/cmd_helpers.py +4 -4
- chia/cmds/cmds_util.py +2 -2
- chia/cmds/coin_funcs.py +3 -2
- chia/cmds/coins.py +1 -1
- chia/cmds/data.py +2 -2
- chia/cmds/data_funcs.py +3 -2
- chia/cmds/db_upgrade_func.py +2 -2
- chia/cmds/db_validate_func.py +15 -8
- chia/cmds/farm.py +2 -4
- chia/cmds/keys.py +0 -2
- chia/cmds/keys_funcs.py +1 -1
- chia/cmds/netspace_funcs.py +2 -1
- chia/cmds/param_types.py +2 -2
- chia/cmds/plotnft.py +2 -2
- chia/cmds/plotnft_funcs.py +2 -2
- chia/cmds/rpc.py +1 -1
- chia/cmds/show.py +1 -2
- chia/cmds/show_funcs.py +6 -3
- chia/cmds/signer.py +1 -2
- chia/cmds/sim.py +1 -2
- chia/cmds/sim_funcs.py +2 -2
- chia/cmds/wallet.py +2 -2
- chia/cmds/wallet_funcs.py +4 -11
- chia/consensus/block_body_validation.py +3 -4
- chia/consensus/block_creation.py +10 -6
- chia/consensus/block_header_validation.py +3 -4
- chia/consensus/block_record.py +2 -3
- chia/consensus/block_rewards.py +1 -1
- chia/consensus/blockchain.py +20 -17
- chia/consensus/blockchain_interface.py +5 -4
- chia/consensus/coinbase.py +2 -2
- chia/consensus/constants.py +1 -1
- chia/consensus/cost_calculator.py +2 -1
- chia/consensus/default_constants.py +4 -3
- chia/consensus/deficit.py +3 -2
- chia/consensus/difficulty_adjustment.py +8 -9
- chia/consensus/find_fork_point.py +4 -3
- chia/consensus/full_block_to_block_record.py +4 -3
- chia/consensus/get_block_challenge.py +4 -3
- chia/consensus/get_block_generator.py +3 -2
- chia/consensus/make_sub_epoch_summary.py +3 -2
- chia/consensus/multiprocess_validation.py +9 -4
- chia/consensus/pos_quality.py +1 -1
- chia/consensus/pot_iterations.py +4 -3
- chia/consensus/vdf_info_computation.py +4 -3
- chia/daemon/client.py +1 -1
- chia/daemon/keychain_server.py +1 -1
- chia/daemon/server.py +1 -1
- chia/daemon/windows_signal.py +1 -1
- chia/data_layer/data_layer.py +4 -3
- chia/data_layer/data_layer_errors.py +1 -1
- chia/data_layer/data_layer_util.py +2 -2
- chia/data_layer/data_layer_wallet.py +47 -69
- chia/data_layer/data_store.py +1 -1
- chia/data_layer/dl_wallet_store.py +5 -6
- chia/data_layer/download_data.py +1 -1
- chia/data_layer/s3_plugin_service.py +4 -4
- chia/data_layer/singleton_record.py +23 -0
- chia/data_layer/util/benchmark.py +2 -1
- chia/farmer/farmer.py +4 -6
- chia/farmer/farmer_api.py +4 -6
- chia/full_node/bitcoin_fee_estimator.py +2 -1
- chia/full_node/block_height_map.py +2 -2
- chia/full_node/block_store.py +8 -9
- chia/{util → full_node}/check_fork_next_block.py +2 -1
- chia/full_node/coin_store.py +10 -10
- chia/full_node/fee_estimate.py +2 -1
- chia/full_node/fee_estimation.py +2 -1
- chia/full_node/fee_estimator.py +2 -1
- chia/full_node/fee_estimator_interface.py +1 -1
- chia/full_node/fee_history.py +2 -1
- chia/full_node/fee_tracker.py +2 -1
- chia/full_node/full_node.py +15 -13
- chia/full_node/full_node_api.py +12 -32
- chia/full_node/full_node_store.py +4 -3
- chia/full_node/hint_management.py +2 -1
- chia/full_node/hint_store.py +3 -3
- chia/full_node/mempool.py +80 -12
- chia/full_node/mempool_check_conditions.py +6 -7
- chia/full_node/mempool_manager.py +168 -21
- chia/full_node/pending_tx_cache.py +2 -2
- chia/full_node/subscriptions.py +2 -2
- chia/full_node/sync_store.py +2 -3
- chia/full_node/tx_processing_queue.py +2 -1
- chia/full_node/weight_proof.py +5 -8
- chia/harvester/harvester.py +5 -3
- chia/harvester/harvester_api.py +2 -2
- chia/introducer/introducer.py +30 -2
- chia/introducer/introducer_api.py +9 -1
- chia/legacy/keyring.py +1 -2
- chia/plot_sync/exceptions.py +2 -1
- chia/plot_sync/receiver.py +2 -2
- chia/plot_sync/sender.py +1 -1
- chia/plotting/cache.py +2 -2
- chia/plotting/check_plots.py +4 -2
- chia/plotting/create_plots.py +1 -1
- chia/plotting/manager.py +3 -3
- chia/plotting/util.py +2 -2
- chia/pools/pool_config.py +1 -1
- chia/pools/pool_puzzles.py +23 -17
- chia/pools/pool_wallet.py +22 -9
- chia/pools/pool_wallet_info.py +2 -2
- chia/protocols/farmer_protocol.py +3 -6
- chia/protocols/full_node_protocol.py +3 -2
- chia/protocols/harvester_protocol.py +3 -4
- chia/protocols/pool_protocol.py +2 -2
- chia/protocols/shared_protocol.py +2 -1
- chia/protocols/timelord_protocol.py +4 -4
- chia/protocols/wallet_protocol.py +2 -2
- chia/rpc/data_layer_rpc_api.py +3 -4
- chia/rpc/data_layer_rpc_client.py +3 -2
- chia/rpc/farmer_rpc_api.py +2 -2
- chia/rpc/farmer_rpc_client.py +2 -1
- chia/rpc/full_node_rpc_api.py +3 -2
- chia/rpc/full_node_rpc_client.py +3 -2
- chia/rpc/harvester_rpc_api.py +2 -1
- chia/rpc/rpc_client.py +2 -2
- chia/rpc/rpc_server.py +1 -1
- chia/rpc/wallet_request_types.py +2 -62
- chia/rpc/wallet_rpc_api.py +98 -628
- chia/rpc/wallet_rpc_client.py +5 -253
- chia/seeder/crawl_store.py +1 -1
- chia/seeder/crawler.py +2 -2
- chia/seeder/peer_record.py +2 -1
- chia/seeder/start_crawler.py +3 -1
- chia/server/address_manager.py +2 -1
- chia/server/address_manager_store.py +1 -1
- chia/server/capabilities.py +2 -1
- chia/server/introducer_peers.py +2 -1
- chia/server/node_discovery.py +1 -1
- chia/server/outbound_message.py +2 -1
- chia/server/server.py +2 -2
- chia/server/start_data_layer.py +2 -1
- chia/server/start_farmer.py +3 -1
- chia/server/start_full_node.py +4 -2
- chia/server/start_harvester.py +3 -1
- chia/server/start_introducer.py +12 -1
- chia/server/start_service.py +2 -1
- chia/server/start_timelord.py +3 -1
- chia/server/start_wallet.py +3 -1
- chia/server/upnp.py +1 -2
- chia/server/ws_connection.py +3 -4
- chia/simulator/add_blocks_in_batches.py +5 -3
- chia/simulator/block_tools.py +16 -12
- chia/simulator/full_node_simulator.py +9 -14
- chia/simulator/setup_services.py +5 -3
- chia/simulator/simulator_full_node_rpc_api.py +3 -2
- chia/simulator/simulator_full_node_rpc_client.py +3 -2
- chia/simulator/simulator_protocol.py +3 -2
- chia/simulator/simulator_test_tools.py +2 -2
- chia/simulator/start_simulator.py +3 -2
- chia/simulator/wallet_tools.py +3 -4
- chia/timelord/iters_from_block.py +4 -4
- chia/timelord/timelord.py +7 -12
- chia/timelord/timelord_api.py +3 -3
- chia/timelord/timelord_state.py +4 -3
- chia/types/block_protocol.py +2 -2
- chia/types/blockchain_format/coin.py +2 -2
- chia/types/blockchain_format/program.py +1 -1
- chia/types/blockchain_format/proof_of_space.py +3 -4
- chia/types/blockchain_format/tree_hash.py +1 -1
- chia/types/blockchain_format/vdf.py +3 -4
- chia/types/clvm_cost.py +1 -1
- chia/types/coin_record.py +4 -3
- chia/types/coin_spend.py +1 -1
- chia/types/eligible_coin_spends.py +9 -5
- chia/types/fee_rate.py +1 -1
- chia/types/generator_types.py +3 -3
- chia/types/internal_mempool_item.py +3 -2
- chia/types/mempool_item.py +10 -3
- chia/types/mempool_submission_status.py +2 -1
- chia/types/mojos.py +1 -1
- chia/types/peer_info.py +2 -1
- chia/types/transaction_queue_entry.py +2 -1
- chia/types/unfinished_header_block.py +4 -4
- chia/types/validation_state.py +2 -1
- chia/types/weight_proof.py +1 -9
- chia/util/augmented_chain.py +20 -9
- chia/util/block_cache.py +8 -4
- chia/util/condition_tools.py +2 -2
- chia/util/full_block_utils.py +3 -4
- chia/util/generator_tools.py +2 -2
- chia/util/initial-config.yaml +2 -11
- chia/util/network.py +2 -2
- chia/util/prev_transaction_block.py +2 -1
- chia/util/task_timing.py +1 -1
- chia/util/vdf_prover.py +3 -3
- chia/util/ws_message.py +1 -1
- chia/wallet/cat_wallet/cat_info.py +3 -2
- chia/wallet/cat_wallet/cat_outer_puzzle.py +3 -2
- chia/wallet/cat_wallet/cat_utils.py +6 -4
- chia/wallet/cat_wallet/cat_wallet.py +16 -18
- chia/wallet/cat_wallet/lineage_store.py +2 -1
- chia/wallet/coin_selection.py +5 -5
- chia/wallet/conditions.py +22 -16
- chia/wallet/db_wallet/db_wallet_puzzles.py +15 -15
- chia/wallet/derivation_record.py +2 -2
- chia/wallet/derive_keys.py +2 -2
- chia/wallet/did_wallet/did_info.py +3 -2
- chia/wallet/did_wallet/did_wallet.py +41 -19
- chia/wallet/did_wallet/did_wallet_puzzles.py +18 -12
- chia/wallet/driver_protocol.py +1 -1
- chia/wallet/lineage_proof.py +3 -2
- chia/wallet/nft_wallet/metadata_outer_puzzle.py +6 -7
- chia/wallet/nft_wallet/nft_info.py +5 -5
- chia/wallet/nft_wallet/nft_puzzle_utils.py +293 -0
- chia/wallet/nft_wallet/nft_puzzles.py +21 -298
- chia/wallet/nft_wallet/nft_wallet.py +47 -62
- chia/wallet/nft_wallet/ownership_outer_puzzle.py +4 -8
- chia/wallet/nft_wallet/singleton_outer_puzzle.py +3 -2
- chia/wallet/nft_wallet/transfer_program_puzzle.py +6 -10
- chia/wallet/nft_wallet/uncurry_nft.py +6 -8
- chia/wallet/notification_manager.py +5 -5
- chia/wallet/notification_store.py +3 -2
- chia/wallet/outer_puzzles.py +2 -1
- chia/wallet/puzzles/clawback/drivers.py +21 -8
- chia/wallet/puzzles/clawback/metadata.py +3 -2
- chia/wallet/puzzles/clawback/puzzle_decorator.py +5 -4
- chia/wallet/puzzles/deployed_puzzle_hashes.json +0 -10
- chia/wallet/puzzles/p2_conditions.py +3 -2
- chia/wallet/puzzles/p2_delegated_conditions.py +3 -2
- chia/wallet/puzzles/p2_delegated_puzzle.py +3 -2
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +3 -3
- chia/wallet/puzzles/p2_m_of_n_delegate_direct.py +3 -2
- chia/wallet/puzzles/p2_puzzle_hash.py +4 -3
- chia/wallet/puzzles/puzzle_utils.py +3 -2
- chia/wallet/puzzles/singleton_top_layer.py +26 -10
- chia/wallet/puzzles/singleton_top_layer_v1_1.py +21 -9
- chia/wallet/puzzles/tails.py +21 -129
- chia/wallet/signer_protocol.py +3 -2
- chia/wallet/singleton.py +12 -6
- chia/wallet/singleton_record.py +3 -2
- chia/wallet/trade_manager.py +31 -55
- chia/wallet/trade_record.py +3 -2
- chia/wallet/trading/offer.py +14 -13
- chia/wallet/trading/trade_store.py +3 -4
- chia/wallet/transaction_record.py +2 -2
- chia/wallet/util/blind_signer_tl.py +3 -2
- chia/wallet/util/compute_hints.py +3 -2
- chia/wallet/util/compute_memos.py +2 -2
- chia/wallet/util/curry_and_treehash.py +1 -2
- chia/wallet/util/merkle_tree.py +1 -1
- chia/wallet/util/merkle_utils.py +1 -1
- chia/wallet/util/new_peak_queue.py +2 -1
- chia/wallet/util/notifications.py +5 -4
- chia/wallet/util/peer_request_cache.py +3 -2
- chia/wallet/util/puzzle_compression.py +6 -4
- chia/wallet/util/puzzle_decorator.py +6 -4
- chia/wallet/util/query_filter.py +3 -2
- chia/wallet/util/tx_config.py +3 -3
- chia/wallet/util/wallet_sync_utils.py +2 -2
- chia/wallet/util/wallet_types.py +2 -3
- chia/wallet/vc_wallet/cr_cat_drivers.py +18 -22
- chia/wallet/vc_wallet/cr_cat_wallet.py +14 -10
- chia/wallet/vc_wallet/cr_outer_puzzle.py +2 -2
- chia/wallet/vc_wallet/vc_drivers.py +50 -68
- chia/wallet/vc_wallet/vc_store.py +2 -2
- chia/wallet/vc_wallet/vc_wallet.py +47 -15
- chia/wallet/wallet.py +51 -46
- chia/wallet/wallet_action_scope.py +4 -0
- chia/wallet/wallet_blockchain.py +12 -7
- chia/wallet/wallet_coin_record.py +3 -2
- chia/wallet/wallet_coin_store.py +3 -2
- chia/wallet/wallet_info.py +2 -1
- chia/wallet/wallet_interested_store.py +3 -2
- chia/wallet/wallet_nft_store.py +4 -4
- chia/wallet/wallet_node.py +3 -4
- chia/wallet/wallet_pool_store.py +3 -4
- chia/wallet/wallet_protocol.py +19 -5
- chia/wallet/wallet_puzzle_store.py +2 -2
- chia/wallet/wallet_retry_store.py +3 -6
- chia/wallet/wallet_singleton_store.py +2 -2
- chia/wallet/wallet_state_manager.py +20 -197
- chia/wallet/wallet_transaction_store.py +2 -2
- chia/wallet/wallet_user_store.py +2 -1
- chia/wallet/wallet_weight_proof_handler.py +3 -2
- {chia_blockchain-2.5.2rc2.dist-info → chia_blockchain-2.5.3.dist-info}/METADATA +3 -2
- chia_blockchain-2.5.3.dist-info/RECORD +891 -0
- mozilla-ca/cacert.pem +64 -33
- chia/_tests/clvm/test_condition_codes.py +0 -13
- chia/_tests/cmds/wallet/test_dao.py +0 -565
- chia/_tests/wallet/dao_wallet/__init__.py +0 -0
- chia/_tests/wallet/dao_wallet/config.py +0 -3
- chia/_tests/wallet/dao_wallet/test_dao_clvm.py +0 -1330
- chia/_tests/wallet/dao_wallet/test_dao_wallets.py +0 -3488
- chia/cmds/dao.py +0 -1064
- chia/cmds/dao_funcs.py +0 -598
- chia/consensus/puzzles/__init__.py +0 -0
- chia/consensus/puzzles/chialisp_deserialisation.clsp +0 -69
- chia/consensus/puzzles/chialisp_deserialisation.clsp.hex +0 -1
- chia/consensus/puzzles/rom_bootstrap_generator.clsp +0 -37
- chia/consensus/puzzles/rom_bootstrap_generator.clsp.hex +0 -1
- chia/full_node/puzzles/__init__.py +0 -0
- chia/full_node/puzzles/block_program_zero.clsp +0 -14
- chia/full_node/puzzles/block_program_zero.clsp.hex +0 -1
- chia/full_node/puzzles/decompress_coin_spend_entry.clsp +0 -5
- chia/full_node/puzzles/decompress_coin_spend_entry.clsp.hex +0 -1
- chia/full_node/puzzles/decompress_coin_spend_entry_with_prefix.clsp +0 -7
- chia/full_node/puzzles/decompress_coin_spend_entry_with_prefix.clsp.hex +0 -1
- chia/full_node/puzzles/decompress_puzzle.clsp +0 -6
- chia/full_node/puzzles/decompress_puzzle.clsp.hex +0 -1
- chia/pools/puzzles/__init__.py +0 -0
- chia/pools/puzzles/pool_member_innerpuz.clsp +0 -70
- chia/pools/puzzles/pool_member_innerpuz.clsp.hex +0 -1
- chia/pools/puzzles/pool_waitingroom_innerpuz.clsp +0 -69
- chia/pools/puzzles/pool_waitingroom_innerpuz.clsp.hex +0 -1
- chia/simulator/simulator_constants.py +0 -13
- chia/types/blockchain_format/foliage.py +0 -8
- chia/types/blockchain_format/pool_target.py +0 -5
- chia/types/blockchain_format/reward_chain_block.py +0 -6
- chia/types/blockchain_format/sized_bytes.py +0 -11
- chia/util/ints.py +0 -19
- chia/wallet/cat_wallet/dao_cat_info.py +0 -28
- chia/wallet/cat_wallet/dao_cat_wallet.py +0 -669
- chia/wallet/cat_wallet/puzzles/__init__.py +0 -0
- chia/wallet/cat_wallet/puzzles/cat_truths.clib +0 -31
- chia/wallet/cat_wallet/puzzles/cat_v2.clsp +0 -397
- chia/wallet/cat_wallet/puzzles/cat_v2.clsp.hex +0 -1
- chia/wallet/cat_wallet/puzzles/delegated_tail.clsp +0 -25
- chia/wallet/cat_wallet/puzzles/delegated_tail.clsp.hex +0 -1
- chia/wallet/cat_wallet/puzzles/everything_with_signature.clsp +0 -15
- chia/wallet/cat_wallet/puzzles/everything_with_signature.clsp.hex +0 -1
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id.clsp +0 -26
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id.clsp.hex +0 -1
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id_or_singleton.clsp +0 -42
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id_or_singleton.clsp.hex +0 -1
- chia/wallet/cat_wallet/puzzles/genesis_by_puzzle_hash.clsp +0 -24
- chia/wallet/cat_wallet/puzzles/genesis_by_puzzle_hash.clsp.hex +0 -1
- chia/wallet/dao_wallet/__init__.py +0 -0
- chia/wallet/dao_wallet/dao_info.py +0 -61
- chia/wallet/dao_wallet/dao_utils.py +0 -811
- chia/wallet/dao_wallet/dao_wallet.py +0 -2119
- chia/wallet/did_wallet/puzzles/__init__.py +0 -0
- chia/wallet/did_wallet/puzzles/did_innerpuz.clsp +0 -135
- chia/wallet/did_wallet/puzzles/did_innerpuz.clsp.hex +0 -1
- chia/wallet/payment.py +0 -33
- chia/wallet/puzzles/augmented_condition.clsp +0 -13
- chia/wallet/puzzles/augmented_condition.clsp.hex +0 -1
- chia/wallet/puzzles/condition_codes.clib +0 -77
- chia/wallet/puzzles/curry-and-treehash.clib +0 -102
- chia/wallet/puzzles/curry.clib +0 -135
- chia/wallet/puzzles/curry_by_index.clib +0 -16
- chia/wallet/puzzles/dao_cat_eve.clsp +0 -17
- chia/wallet/puzzles/dao_cat_eve.clsp.hex +0 -1
- chia/wallet/puzzles/dao_cat_launcher.clsp +0 -36
- chia/wallet/puzzles/dao_cat_launcher.clsp.hex +0 -1
- chia/wallet/puzzles/dao_finished_state.clsp +0 -35
- chia/wallet/puzzles/dao_finished_state.clsp.hex +0 -1
- chia/wallet/puzzles/dao_finished_state.clsp.hex.sha256tree +0 -1
- chia/wallet/puzzles/dao_lockup.clsp +0 -288
- chia/wallet/puzzles/dao_lockup.clsp.hex +0 -1
- chia/wallet/puzzles/dao_lockup.clsp.hex.sha256tree +0 -1
- chia/wallet/puzzles/dao_proposal.clsp +0 -377
- chia/wallet/puzzles/dao_proposal.clsp.hex +0 -1
- chia/wallet/puzzles/dao_proposal.clsp.hex.sha256tree +0 -1
- chia/wallet/puzzles/dao_proposal_timer.clsp +0 -78
- chia/wallet/puzzles/dao_proposal_timer.clsp.hex +0 -1
- chia/wallet/puzzles/dao_proposal_timer.clsp.hex.sha256tree +0 -1
- chia/wallet/puzzles/dao_proposal_validator.clsp +0 -87
- chia/wallet/puzzles/dao_proposal_validator.clsp.hex +0 -1
- chia/wallet/puzzles/dao_proposal_validator.clsp.hex.sha256tree +0 -1
- chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp +0 -240
- chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex +0 -1
- chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex.sha256tree +0 -1
- chia/wallet/puzzles/dao_treasury.clsp +0 -115
- chia/wallet/puzzles/dao_treasury.clsp.hex +0 -1
- chia/wallet/puzzles/dao_update_proposal.clsp +0 -44
- chia/wallet/puzzles/dao_update_proposal.clsp.hex +0 -1
- chia/wallet/puzzles/json.clib +0 -25
- chia/wallet/puzzles/merkle_utils.clib +0 -18
- chia/wallet/puzzles/notification.clsp +0 -7
- chia/wallet/puzzles/notification.clsp.hex +0 -1
- chia/wallet/puzzles/p2_1_of_n.clsp +0 -22
- chia/wallet/puzzles/p2_1_of_n.clsp.hex +0 -1
- chia/wallet/puzzles/p2_conditions.clsp +0 -3
- chia/wallet/puzzles/p2_conditions.clsp.hex +0 -1
- chia/wallet/puzzles/p2_delegated_conditions.clsp +0 -18
- chia/wallet/puzzles/p2_delegated_conditions.clsp.hex +0 -1
- chia/wallet/puzzles/p2_delegated_puzzle.clsp +0 -19
- chia/wallet/puzzles/p2_delegated_puzzle.clsp.hex +0 -1
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp +0 -91
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp.hex +0 -1
- chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp +0 -108
- chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp.hex +0 -1
- chia/wallet/puzzles/p2_parent.clsp +0 -19
- chia/wallet/puzzles/p2_parent.clsp.hex +0 -1
- chia/wallet/puzzles/p2_puzzle_hash.clsp +0 -18
- chia/wallet/puzzles/p2_puzzle_hash.clsp.hex +0 -1
- chia/wallet/puzzles/p2_singleton.clsp +0 -30
- chia/wallet/puzzles/p2_singleton.clsp.hex +0 -1
- chia/wallet/puzzles/p2_singleton_aggregator.clsp +0 -81
- chia/wallet/puzzles/p2_singleton_aggregator.clsp.hex +0 -1
- chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp +0 -50
- chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp.hex +0 -1
- chia/wallet/puzzles/p2_singleton_via_delegated_puzzle.clsp +0 -47
- chia/wallet/puzzles/p2_singleton_via_delegated_puzzle.clsp.hex +0 -1
- chia/wallet/puzzles/settlement_payments.clsp +0 -49
- chia/wallet/puzzles/settlement_payments.clsp.hex +0 -1
- chia/wallet/puzzles/sha256tree.clib +0 -11
- chia/wallet/puzzles/singleton_launcher.clsp +0 -16
- chia/wallet/puzzles/singleton_launcher.clsp.hex +0 -1
- chia/wallet/puzzles/singleton_top_layer.clsp +0 -177
- chia/wallet/puzzles/singleton_top_layer.clsp.hex +0 -1
- chia/wallet/puzzles/singleton_top_layer_v1_1.clsp +0 -107
- chia/wallet/puzzles/singleton_top_layer_v1_1.clsp.hex +0 -1
- chia/wallet/puzzles/singleton_truths.clib +0 -21
- chia/wallet/vc_wallet/cr_puzzles/__init__.py +0 -0
- chia/wallet/vc_wallet/cr_puzzles/conditions_w_fee_announce.clsp +0 -3
- chia/wallet/vc_wallet/cr_puzzles/conditions_w_fee_announce.clsp.hex +0 -1
- chia/wallet/vc_wallet/cr_puzzles/credential_restriction.clsp +0 -304
- chia/wallet/vc_wallet/cr_puzzles/credential_restriction.clsp.hex +0 -1
- chia/wallet/vc_wallet/cr_puzzles/flag_proofs_checker.clsp +0 -45
- chia/wallet/vc_wallet/cr_puzzles/flag_proofs_checker.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/__init__.py +0 -0
- chia/wallet/vc_wallet/vc_puzzles/covenant_layer.clsp +0 -30
- chia/wallet/vc_wallet/vc_puzzles/covenant_layer.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/eml_covenant_morpher.clsp +0 -75
- chia/wallet/vc_wallet/vc_puzzles/eml_covenant_morpher.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/eml_transfer_program_covenant_adapter.clsp +0 -32
- chia/wallet/vc_wallet/vc_puzzles/eml_transfer_program_covenant_adapter.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/eml_update_metadata_with_DID.clsp +0 -80
- chia/wallet/vc_wallet/vc_puzzles/eml_update_metadata_with_DID.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/exigent_metadata_layer.clsp +0 -163
- chia/wallet/vc_wallet/vc_puzzles/exigent_metadata_layer.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/p2_announced_delegated_puzzle.clsp +0 -16
- chia/wallet/vc_wallet/vc_puzzles/p2_announced_delegated_puzzle.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/standard_vc_backdoor_puzzle.clsp +0 -74
- chia/wallet/vc_wallet/vc_puzzles/standard_vc_backdoor_puzzle.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/std_parent_morpher.clsp +0 -23
- chia/wallet/vc_wallet/vc_puzzles/std_parent_morpher.clsp.hex +0 -1
- chia/wallet/vc_wallet/vc_puzzles/viral_backdoor.clsp +0 -64
- chia/wallet/vc_wallet/vc_puzzles/viral_backdoor.clsp.hex +0 -1
- chia_blockchain-2.5.2rc2.dist-info/RECORD +0 -1042
- {chia_blockchain-2.5.2rc2.dist-info → chia_blockchain-2.5.3.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.2rc2.dist-info → chia_blockchain-2.5.3.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.2rc2.dist-info → chia_blockchain-2.5.3.dist-info}/entry_points.txt +0 -0
chia/full_node/mempool.py
CHANGED
|
@@ -9,23 +9,24 @@ from enum import Enum
|
|
|
9
9
|
from time import monotonic
|
|
10
10
|
from typing import Callable, Optional
|
|
11
11
|
|
|
12
|
-
from chia_rs import AugSchemeMPL, Coin, G2Element
|
|
12
|
+
from chia_rs import AugSchemeMPL, Coin, ConsensusConstants, G2Element, solution_generator_backrefs
|
|
13
|
+
from chia_rs.sized_bytes import bytes32
|
|
14
|
+
from chia_rs.sized_ints import uint32, uint64
|
|
13
15
|
|
|
14
|
-
from chia.consensus.constants import ConsensusConstants
|
|
15
16
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
16
17
|
from chia.full_node.fee_estimation import FeeMempoolInfo, MempoolInfo, MempoolItemInfo
|
|
17
18
|
from chia.full_node.fee_estimator_interface import FeeEstimatorInterface
|
|
18
|
-
from chia.types.blockchain_format.
|
|
19
|
+
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
19
20
|
from chia.types.clvm_cost import CLVMCost
|
|
20
21
|
from chia.types.coin_spend import CoinSpend
|
|
21
|
-
from chia.types.eligible_coin_spends import EligibleCoinSpends, UnspentLineageInfo
|
|
22
|
+
from chia.types.eligible_coin_spends import EligibleCoinSpends, SkipDedup, UnspentLineageInfo
|
|
23
|
+
from chia.types.generator_types import BlockGenerator
|
|
22
24
|
from chia.types.internal_mempool_item import InternalMempoolItem
|
|
23
25
|
from chia.types.mempool_item import MempoolItem
|
|
24
26
|
from chia.types.spend_bundle import SpendBundle
|
|
25
27
|
from chia.util.batches import to_batches
|
|
26
28
|
from chia.util.db_wrapper import SQLITE_MAX_VARIABLE_NUMBER
|
|
27
29
|
from chia.util.errors import Err
|
|
28
|
-
from chia.util.ints import uint32, uint64
|
|
29
30
|
|
|
30
31
|
log = logging.getLogger(__name__)
|
|
31
32
|
|
|
@@ -451,10 +452,20 @@ class Mempool:
|
|
|
451
452
|
item.fee / item.cost,
|
|
452
453
|
),
|
|
453
454
|
)
|
|
454
|
-
all_coin_spends = [
|
|
455
|
-
|
|
455
|
+
all_coin_spends = []
|
|
456
|
+
# item.name is a property
|
|
457
|
+
# only compute its name once (the spend bundle name)
|
|
458
|
+
item_name = item.name
|
|
459
|
+
for coin_id, bcs in item.bundle_coin_spends.items():
|
|
460
|
+
# any FF spend should be indexed by its latest singleton coin
|
|
461
|
+
# ID, this way we'll find it when the singleton is spent
|
|
462
|
+
if bcs.latest_singleton_coin is not None:
|
|
463
|
+
all_coin_spends.append((bcs.latest_singleton_coin, item_name))
|
|
464
|
+
else:
|
|
465
|
+
all_coin_spends.append((coin_id, item_name))
|
|
466
|
+
conn.executemany("INSERT OR IGNORE INTO spends VALUES(?, ?)", all_coin_spends)
|
|
456
467
|
|
|
457
|
-
self._items[
|
|
468
|
+
self._items[item_name] = InternalMempoolItem(
|
|
458
469
|
item.spend_bundle, item.conds, item.height_added_to_mempool, item.bundle_coin_spends
|
|
459
470
|
)
|
|
460
471
|
self._total_cost += item.cost
|
|
@@ -464,6 +475,11 @@ class Mempool:
|
|
|
464
475
|
self.fee_estimator.add_mempool_item(info, MempoolItemInfo(item.cost, item.fee, item.height_added_to_mempool))
|
|
465
476
|
return MempoolAddInfo(removals, None)
|
|
466
477
|
|
|
478
|
+
# each tuple holds new_coin_id, current_coin_id, mempool item name
|
|
479
|
+
def update_spend_index(self, spends_to_update: list[tuple[bytes32, bytes32, bytes32]]) -> None:
|
|
480
|
+
with self._db_conn as conn:
|
|
481
|
+
conn.executemany("UPDATE OR REPLACE spends SET coin_id=? WHERE coin_id=? AND tx=?", spends_to_update)
|
|
482
|
+
|
|
467
483
|
def at_full_capacity(self, cost: int) -> bool:
|
|
468
484
|
"""
|
|
469
485
|
Checks whether the mempool is at full capacity and cannot accept a transaction with size cost.
|
|
@@ -471,12 +487,53 @@ class Mempool:
|
|
|
471
487
|
|
|
472
488
|
return self._total_cost + cost > self.mempool_info.max_size_in_cost
|
|
473
489
|
|
|
490
|
+
async def create_block_generator(
|
|
491
|
+
self,
|
|
492
|
+
get_unspent_lineage_info_for_puzzle_hash: Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]],
|
|
493
|
+
constants: ConsensusConstants,
|
|
494
|
+
height: uint32,
|
|
495
|
+
item_inclusion_filter: Optional[Callable[[bytes32], bool]] = None,
|
|
496
|
+
) -> Optional[tuple[BlockGenerator, G2Element, list[Coin], list[Coin]]]:
|
|
497
|
+
"""
|
|
498
|
+
height is needed in case we fast-forward a transaction and we need to
|
|
499
|
+
re-run its puzzle.
|
|
500
|
+
"""
|
|
501
|
+
|
|
502
|
+
mempool_bundle = await self.create_bundle_from_mempool_items(
|
|
503
|
+
get_unspent_lineage_info_for_puzzle_hash, constants, height, item_inclusion_filter
|
|
504
|
+
)
|
|
505
|
+
if mempool_bundle is None:
|
|
506
|
+
return None
|
|
507
|
+
|
|
508
|
+
spend_bundle, additions = mempool_bundle
|
|
509
|
+
removals = spend_bundle.removals()
|
|
510
|
+
log.info(f"Add rem: {len(additions)} {len(removals)}")
|
|
511
|
+
|
|
512
|
+
# since the hard fork has activated, block generators are
|
|
513
|
+
# allowed to be serialized with CLVM back-references. We can do that
|
|
514
|
+
# unconditionally.
|
|
515
|
+
start_time = monotonic()
|
|
516
|
+
spends = [(cs.coin, bytes(cs.puzzle_reveal), bytes(cs.solution)) for cs in spend_bundle.coin_spends]
|
|
517
|
+
block_program = solution_generator_backrefs(spends)
|
|
518
|
+
|
|
519
|
+
duration = monotonic() - start_time
|
|
520
|
+
log.log(
|
|
521
|
+
logging.INFO if duration < 1 else logging.WARNING,
|
|
522
|
+
f"serializing block generator took {duration:0.2f} seconds",
|
|
523
|
+
)
|
|
524
|
+
return (
|
|
525
|
+
BlockGenerator(SerializedProgram.from_bytes(block_program), []),
|
|
526
|
+
spend_bundle.aggregated_signature,
|
|
527
|
+
additions,
|
|
528
|
+
removals,
|
|
529
|
+
)
|
|
530
|
+
|
|
474
531
|
async def create_bundle_from_mempool_items(
|
|
475
532
|
self,
|
|
476
|
-
item_inclusion_filter: Callable[[bytes32], bool],
|
|
477
533
|
get_unspent_lineage_info_for_puzzle_hash: Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]],
|
|
478
534
|
constants: ConsensusConstants,
|
|
479
535
|
height: uint32,
|
|
536
|
+
item_inclusion_filter: Optional[Callable[[bytes32], bool]] = None,
|
|
480
537
|
) -> Optional[tuple[SpendBundle, list[Coin]]]:
|
|
481
538
|
cost_sum = 0 # Checks that total cost does not exceed block maximum
|
|
482
539
|
fee_sum = 0 # Checks that total fees don't exceed 64 bits
|
|
@@ -506,7 +563,7 @@ class Mempool:
|
|
|
506
563
|
if current_time - bundle_creation_start > 1:
|
|
507
564
|
log.info(f"exiting early, already spent {current_time - bundle_creation_start:0.2f} s")
|
|
508
565
|
break
|
|
509
|
-
if not item_inclusion_filter(name):
|
|
566
|
+
if item_inclusion_filter is not None and not item_inclusion_filter(name):
|
|
510
567
|
continue
|
|
511
568
|
try:
|
|
512
569
|
assert item.conds is not None
|
|
@@ -517,11 +574,18 @@ class Mempool:
|
|
|
517
574
|
# we want to keep looking for smaller transactions that
|
|
518
575
|
# might fit, but we also want to avoid spending too much
|
|
519
576
|
# time on potentially expensive ones, hence this shortcut.
|
|
577
|
+
if any(
|
|
578
|
+
map(
|
|
579
|
+
lambda spend_data: (spend_data.eligible_for_dedup or spend_data.eligible_for_fast_forward),
|
|
580
|
+
item.bundle_coin_spends.values(),
|
|
581
|
+
)
|
|
582
|
+
):
|
|
583
|
+
log.info("Skipping transaction with dedup or FF spends {item.name}")
|
|
584
|
+
continue
|
|
585
|
+
|
|
520
586
|
unique_coin_spends = []
|
|
521
587
|
unique_additions = []
|
|
522
588
|
for spend_data in item.bundle_coin_spends.values():
|
|
523
|
-
if spend_data.eligible_for_dedup or spend_data.eligible_for_fast_forward:
|
|
524
|
-
raise Exception(f"Skipping transaction with eligible coin(s): {name.hex()}")
|
|
525
589
|
unique_coin_spends.append(spend_data.coin_spend)
|
|
526
590
|
unique_additions.extend(spend_data.additions)
|
|
527
591
|
cost_saving = 0
|
|
@@ -569,8 +633,12 @@ class Mempool:
|
|
|
569
633
|
# find transactions small enough to fit at this point
|
|
570
634
|
if self.mempool_info.max_block_clvm_cost - cost_sum < MIN_COST_THRESHOLD:
|
|
571
635
|
break
|
|
636
|
+
except SkipDedup as e:
|
|
637
|
+
log.info(f"{e}")
|
|
638
|
+
continue
|
|
572
639
|
except Exception as e:
|
|
573
640
|
log.info(f"Exception while checking a mempool item for deduplication: {e}")
|
|
641
|
+
skipped_items += 1
|
|
574
642
|
continue
|
|
575
643
|
if processed_spend_bundles == 0:
|
|
576
644
|
return None
|
|
@@ -3,28 +3,27 @@ from __future__ import annotations
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
+
from chia_puzzles_py.programs import CHIALISP_DESERIALISATION
|
|
6
7
|
from chia_rs import (
|
|
8
|
+
ConsensusConstants,
|
|
7
9
|
get_flags_for_height_and_constants,
|
|
8
10
|
run_chia_program,
|
|
9
11
|
)
|
|
10
12
|
from chia_rs import get_puzzle_and_solution_for_coin2 as get_puzzle_and_solution_for_coin_rust
|
|
13
|
+
from chia_rs.sized_bytes import bytes32
|
|
14
|
+
from chia_rs.sized_ints import uint32, uint64
|
|
11
15
|
|
|
12
|
-
from chia.consensus.constants import ConsensusConstants
|
|
13
16
|
from chia.types.blockchain_format.coin import Coin
|
|
14
17
|
from chia.types.blockchain_format.program import Program
|
|
15
|
-
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
16
18
|
from chia.types.coin_record import CoinRecord
|
|
17
19
|
from chia.types.coin_spend import CoinSpend, CoinSpendWithConditions, SpendInfo, make_spend
|
|
18
20
|
from chia.types.generator_types import BlockGenerator
|
|
19
21
|
from chia.types.spend_bundle_conditions import SpendBundleConditions
|
|
20
22
|
from chia.util.condition_tools import conditions_for_solution
|
|
21
23
|
from chia.util.errors import Err
|
|
22
|
-
from chia.util.ints import uint32, uint64
|
|
23
|
-
from chia.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile
|
|
24
24
|
|
|
25
|
-
DESERIALIZE_MOD =
|
|
26
|
-
|
|
27
|
-
)
|
|
25
|
+
DESERIALIZE_MOD = Program.from_bytes(CHIALISP_DESERIALISATION)
|
|
26
|
+
|
|
28
27
|
|
|
29
28
|
log = logging.getLogger(__name__)
|
|
30
29
|
|
|
@@ -5,14 +5,23 @@ import logging
|
|
|
5
5
|
import time
|
|
6
6
|
from collections.abc import Awaitable, Collection
|
|
7
7
|
from concurrent.futures import Executor, ThreadPoolExecutor
|
|
8
|
-
from dataclasses import dataclass
|
|
8
|
+
from dataclasses import dataclass, field
|
|
9
9
|
from typing import Callable, Optional, TypeVar
|
|
10
10
|
|
|
11
|
-
from chia_rs import
|
|
11
|
+
from chia_rs import (
|
|
12
|
+
ELIGIBLE_FOR_DEDUP,
|
|
13
|
+
ELIGIBLE_FOR_FF,
|
|
14
|
+
BLSCache,
|
|
15
|
+
ConsensusConstants,
|
|
16
|
+
G2Element,
|
|
17
|
+
supports_fast_forward,
|
|
18
|
+
validate_clvm_and_signature,
|
|
19
|
+
)
|
|
20
|
+
from chia_rs.sized_bytes import bytes32
|
|
21
|
+
from chia_rs.sized_ints import uint32, uint64
|
|
12
22
|
from chiabip158 import PyBIP158
|
|
13
23
|
|
|
14
24
|
from chia.consensus.block_record import BlockRecordProtocol
|
|
15
|
-
from chia.consensus.constants import ConsensusConstants
|
|
16
25
|
from chia.consensus.cost_calculator import NPCResult
|
|
17
26
|
from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator
|
|
18
27
|
from chia.full_node.fee_estimation import FeeBlockInfo, MempoolInfo, MempoolItemInfo
|
|
@@ -21,11 +30,11 @@ from chia.full_node.mempool import MEMPOOL_ITEM_FEE_LIMIT, Mempool, MempoolRemov
|
|
|
21
30
|
from chia.full_node.mempool_check_conditions import mempool_check_time_locks
|
|
22
31
|
from chia.full_node.pending_tx_cache import ConflictTxCache, PendingTxCache
|
|
23
32
|
from chia.types.blockchain_format.coin import Coin
|
|
24
|
-
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
25
33
|
from chia.types.clvm_cost import CLVMCost
|
|
26
34
|
from chia.types.coin_record import CoinRecord
|
|
27
35
|
from chia.types.eligible_coin_spends import EligibilityAndAdditions, UnspentLineageInfo
|
|
28
36
|
from chia.types.fee_rate import FeeRate
|
|
37
|
+
from chia.types.generator_types import BlockGenerator
|
|
29
38
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
30
39
|
from chia.types.mempool_item import BundleCoinSpend, MempoolItem
|
|
31
40
|
from chia.types.spend_bundle import SpendBundle
|
|
@@ -33,7 +42,6 @@ from chia.types.spend_bundle_conditions import SpendBundleConditions
|
|
|
33
42
|
from chia.util.db_wrapper import SQLITE_INT_MAX
|
|
34
43
|
from chia.util.errors import Err, ValidationError
|
|
35
44
|
from chia.util.inline_executor import InlineExecutor
|
|
36
|
-
from chia.util.ints import uint32, uint64
|
|
37
45
|
|
|
38
46
|
log = logging.getLogger(__name__)
|
|
39
47
|
|
|
@@ -50,6 +58,24 @@ class TimelockConditions:
|
|
|
50
58
|
assert_before_seconds: Optional[uint64] = None
|
|
51
59
|
|
|
52
60
|
|
|
61
|
+
@dataclass
|
|
62
|
+
class LineageInfoCache:
|
|
63
|
+
_fun: Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]]
|
|
64
|
+
_cache: dict[bytes32, Optional[UnspentLineageInfo]] = field(default_factory=dict)
|
|
65
|
+
|
|
66
|
+
async def get_unspent_lineage_info(self, puzzle_hash: bytes32) -> Optional[UnspentLineageInfo]:
|
|
67
|
+
# we rely on KeyError to distinguish between a stored
|
|
68
|
+
# None value and a missing entry
|
|
69
|
+
try:
|
|
70
|
+
return self._cache[puzzle_hash]
|
|
71
|
+
except KeyError:
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
ret = await self._fun(puzzle_hash)
|
|
75
|
+
self._cache[puzzle_hash] = ret
|
|
76
|
+
return ret
|
|
77
|
+
|
|
78
|
+
|
|
53
79
|
def compute_assert_height(
|
|
54
80
|
removal_coin_records: dict[bytes32, CoinRecord],
|
|
55
81
|
conds: SpendBundleConditions,
|
|
@@ -183,7 +209,7 @@ class MempoolManager:
|
|
|
183
209
|
if single_threaded:
|
|
184
210
|
self.pool = InlineExecutor()
|
|
185
211
|
else:
|
|
186
|
-
self.pool = ThreadPoolExecutor(max_workers=2)
|
|
212
|
+
self.pool = ThreadPoolExecutor(max_workers=2, thread_name_prefix="mempool-")
|
|
187
213
|
|
|
188
214
|
# The mempool will correspond to a certain peak
|
|
189
215
|
self.peak: Optional[BlockRecordProtocol] = None
|
|
@@ -198,10 +224,10 @@ class MempoolManager:
|
|
|
198
224
|
def shut_down(self) -> None:
|
|
199
225
|
self.pool.shutdown(wait=True)
|
|
200
226
|
|
|
227
|
+
# TODO: remove this, use create_generator() instead
|
|
201
228
|
async def create_bundle_from_mempool(
|
|
202
229
|
self,
|
|
203
230
|
last_tb_header_hash: bytes32,
|
|
204
|
-
get_unspent_lineage_info_for_puzzle_hash: Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]],
|
|
205
231
|
item_inclusion_filter: Optional[Callable[[bytes32], bool]] = None,
|
|
206
232
|
) -> Optional[tuple[SpendBundle, list[Coin]]]:
|
|
207
233
|
"""
|
|
@@ -209,16 +235,32 @@ class MempoolManager:
|
|
|
209
235
|
additions and removals in that spend_bundle
|
|
210
236
|
"""
|
|
211
237
|
|
|
238
|
+
lineage_cache = LineageInfoCache(self.get_unspent_lineage_info_for_puzzle_hash)
|
|
239
|
+
|
|
240
|
+
if self.peak is None or self.peak.header_hash != last_tb_header_hash:
|
|
241
|
+
return None
|
|
242
|
+
return await self.mempool.create_bundle_from_mempool_items(
|
|
243
|
+
lineage_cache.get_unspent_lineage_info, self.constants, self.peak.height, item_inclusion_filter
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
async def create_block_generator(
|
|
247
|
+
self,
|
|
248
|
+
last_tb_header_hash: bytes32,
|
|
249
|
+
item_inclusion_filter: Optional[Callable[[bytes32], bool]] = None,
|
|
250
|
+
) -> Optional[tuple[BlockGenerator, G2Element, list[Coin], list[Coin]]]:
|
|
251
|
+
"""
|
|
252
|
+
Returns a block generator program, the aggregate signature and all additions and removals, for a new block
|
|
253
|
+
"""
|
|
212
254
|
if self.peak is None or self.peak.header_hash != last_tb_header_hash:
|
|
213
255
|
return None
|
|
214
|
-
if item_inclusion_filter is None:
|
|
215
256
|
|
|
216
|
-
|
|
217
|
-
return True
|
|
257
|
+
lineage_cache = LineageInfoCache(self.get_unspent_lineage_info_for_puzzle_hash)
|
|
218
258
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
259
|
+
return await self.mempool.create_block_generator(
|
|
260
|
+
lineage_cache.get_unspent_lineage_info,
|
|
261
|
+
self.constants,
|
|
262
|
+
self.peak.height,
|
|
263
|
+
item_inclusion_filter,
|
|
222
264
|
)
|
|
223
265
|
|
|
224
266
|
def get_filter(self) -> bytes:
|
|
@@ -320,6 +362,9 @@ class MempoolManager:
|
|
|
320
362
|
spend_name: bytes32,
|
|
321
363
|
first_added_height: uint32,
|
|
322
364
|
get_coin_records: Optional[Callable[[Collection[bytes32]], Awaitable[list[CoinRecord]]]] = None,
|
|
365
|
+
get_unspent_lineage_info_for_puzzle_hash: Optional[
|
|
366
|
+
Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]]
|
|
367
|
+
] = None,
|
|
323
368
|
) -> SpendBundleAddInfo:
|
|
324
369
|
"""
|
|
325
370
|
Validates and adds to mempool a new_spend with the given NPCResult, and spend_name, and the current mempool.
|
|
@@ -346,13 +391,17 @@ class MempoolManager:
|
|
|
346
391
|
|
|
347
392
|
if get_coin_records is None:
|
|
348
393
|
get_coin_records = self.get_coin_records
|
|
394
|
+
|
|
395
|
+
if get_unspent_lineage_info_for_puzzle_hash is None:
|
|
396
|
+
get_unspent_lineage_info_for_puzzle_hash = self.get_unspent_lineage_info_for_puzzle_hash
|
|
397
|
+
|
|
349
398
|
err, item, remove_items = await self.validate_spend_bundle(
|
|
350
399
|
new_spend,
|
|
351
400
|
conds,
|
|
352
401
|
spend_name,
|
|
353
402
|
first_added_height,
|
|
354
403
|
get_coin_records,
|
|
355
|
-
|
|
404
|
+
get_unspent_lineage_info_for_puzzle_hash,
|
|
356
405
|
)
|
|
357
406
|
if err is None:
|
|
358
407
|
# No error, immediately add to mempool, after removing conflicting TXs.
|
|
@@ -441,13 +490,16 @@ class MempoolManager:
|
|
|
441
490
|
EligibilityAndAdditions(is_eligible_for_dedup=False, spend_additions=[], ff_puzzle_hash=None),
|
|
442
491
|
)
|
|
443
492
|
mark_as_fast_forward = eligibility_info.ff_puzzle_hash is not None and supports_fast_forward(coin_spend)
|
|
493
|
+
latest_singleton_coin = None
|
|
444
494
|
if mark_as_fast_forward:
|
|
445
495
|
# Make sure the fast forward spend still has a version that is
|
|
446
496
|
# still unspent, because if the singleton has been melted, the
|
|
447
497
|
# fast forward spend will never become valid.
|
|
448
498
|
assert eligibility_info.ff_puzzle_hash is not None
|
|
449
|
-
|
|
499
|
+
lineage_info = await get_unspent_lineage_info_for_puzzle_hash(eligibility_info.ff_puzzle_hash)
|
|
500
|
+
if lineage_info is None:
|
|
450
501
|
return Err.DOUBLE_SPEND, None, []
|
|
502
|
+
latest_singleton_coin = lineage_info.coin_id
|
|
451
503
|
fast_forward_coin_ids.add(coin_id)
|
|
452
504
|
# We are now able to check eligibility of both dedup and fast forward
|
|
453
505
|
if not (eligibility_info.is_eligible_for_dedup or mark_as_fast_forward):
|
|
@@ -457,6 +509,7 @@ class MempoolManager:
|
|
|
457
509
|
eligible_for_dedup=eligibility_info.is_eligible_for_dedup,
|
|
458
510
|
eligible_for_fast_forward=mark_as_fast_forward,
|
|
459
511
|
additions=eligibility_info.spend_additions,
|
|
512
|
+
latest_singleton_coin=latest_singleton_coin,
|
|
460
513
|
)
|
|
461
514
|
|
|
462
515
|
if removal_names != removal_names_from_coin_spends:
|
|
@@ -675,6 +728,8 @@ class MempoolManager:
|
|
|
675
728
|
use_optimization: bool = self.peak is not None and new_peak.prev_transaction_block_hash == self.peak.header_hash
|
|
676
729
|
self.peak = new_peak
|
|
677
730
|
|
|
731
|
+
lineage_cache = LineageInfoCache(self.get_unspent_lineage_info_for_puzzle_hash)
|
|
732
|
+
|
|
678
733
|
if use_optimization and spent_coins is not None:
|
|
679
734
|
# We don't reinitialize a mempool, just kick removed items
|
|
680
735
|
# transactions in the mempool may be spending multiple coins,
|
|
@@ -682,12 +737,81 @@ class MempoolManager:
|
|
|
682
737
|
# find the same transaction multiple times. We put them in a set
|
|
683
738
|
# to deduplicate
|
|
684
739
|
spendbundle_ids_to_remove: set[bytes32] = set()
|
|
740
|
+
|
|
741
|
+
# rebasing a fast forward spend is more expensive than to just
|
|
742
|
+
# evict the item. So, any FF spend we may need to rebase, defer
|
|
743
|
+
# them until after we've gone through all spends
|
|
744
|
+
deferred_ff_items: set[tuple[bytes32, bytes32]] = set()
|
|
745
|
+
|
|
685
746
|
for spend in spent_coins:
|
|
686
747
|
items = self.mempool.get_items_by_coin_id(spend)
|
|
687
748
|
for item in items:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
749
|
+
# this is a property, compute it once
|
|
750
|
+
item_name = item.name
|
|
751
|
+
|
|
752
|
+
# if we've already decided to remove this mempool item
|
|
753
|
+
# because of some other coin, we don't need to do any more
|
|
754
|
+
# work
|
|
755
|
+
if item_name in spendbundle_ids_to_remove:
|
|
756
|
+
continue
|
|
757
|
+
|
|
758
|
+
bcs = item.bundle_coin_spends.get(spend)
|
|
759
|
+
if bcs is not None and bcs.latest_singleton_coin is None:
|
|
760
|
+
# this is a regular coin spend that's now made it into
|
|
761
|
+
# a block and we just evict its mempool item
|
|
762
|
+
included_items.append(MempoolItemInfo(item.cost, item.fee, item.height_added_to_mempool))
|
|
763
|
+
self.remove_seen(item_name)
|
|
764
|
+
spendbundle_ids_to_remove.add(item_name)
|
|
765
|
+
continue
|
|
766
|
+
|
|
767
|
+
deferred_ff_items.add((spend, item_name))
|
|
768
|
+
|
|
769
|
+
# fast forward spends are indexed under the latest singleton coin ID
|
|
770
|
+
# if it's spent, we need to update the index in the mempool. This
|
|
771
|
+
# list lets us perform a bulk update
|
|
772
|
+
# new_coin_id, current_coin_id, mempool item name
|
|
773
|
+
spends_to_update: list[tuple[bytes32, bytes32, bytes32]] = []
|
|
774
|
+
|
|
775
|
+
for spend, item_name in deferred_ff_items:
|
|
776
|
+
if item_name in spendbundle_ids_to_remove:
|
|
777
|
+
continue
|
|
778
|
+
# there may be multiple matching spends in the mempool
|
|
779
|
+
# item, for the same singleton
|
|
780
|
+
found_matches = 0
|
|
781
|
+
for bcs in item.bundle_coin_spends.values():
|
|
782
|
+
if bcs.latest_singleton_coin != spend:
|
|
783
|
+
continue
|
|
784
|
+
found_matches += 1
|
|
785
|
+
|
|
786
|
+
# TODO: in the future, we could pass this new coin ID
|
|
787
|
+
# into new_peak() and avoid this DB lookup
|
|
788
|
+
lineage_info = await lineage_cache.get_unspent_lineage_info(bcs.coin_spend.coin.puzzle_hash)
|
|
789
|
+
if lineage_info is None:
|
|
790
|
+
# this singleton no longer has an unspent coin with
|
|
791
|
+
# this puzzle-hash. FF is not longer available and we
|
|
792
|
+
# just need to evict this mempool item
|
|
793
|
+
self.remove_seen(item_name)
|
|
794
|
+
spendbundle_ids_to_remove.add(item_name)
|
|
795
|
+
break
|
|
796
|
+
|
|
797
|
+
spends_to_update.append((lineage_info.coin_id, spend, item_name))
|
|
798
|
+
bcs.latest_singleton_coin = lineage_info.coin_id
|
|
799
|
+
|
|
800
|
+
if found_matches == 0: # pragma: no cover
|
|
801
|
+
# We are not expected to get here. this is all
|
|
802
|
+
# defensive to get rid of the spend bundle or patch
|
|
803
|
+
# it up
|
|
804
|
+
log.warning(
|
|
805
|
+
f"MempoolItem indexed as spending coin: {spend}, "
|
|
806
|
+
f"but spend is not found in item: {item_name}. Evicting mempool item"
|
|
807
|
+
)
|
|
808
|
+
# we don't expect this to happen, so evict the
|
|
809
|
+
# item as a precaution
|
|
810
|
+
spendbundle_ids_to_remove.add(item_name)
|
|
811
|
+
|
|
812
|
+
if len(spends_to_update) > 0:
|
|
813
|
+
self.mempool.update_spend_index(spends_to_update)
|
|
814
|
+
|
|
691
815
|
mempool_item_removals.append(
|
|
692
816
|
self.mempool.remove_from_pool(list(spendbundle_ids_to_remove), MempoolRemoveReason.BLOCK_INCLUSION)
|
|
693
817
|
)
|
|
@@ -730,6 +854,7 @@ class MempoolManager:
|
|
|
730
854
|
item.spend_bundle_name,
|
|
731
855
|
item.height_added_to_mempool,
|
|
732
856
|
local_get_coin_records,
|
|
857
|
+
lineage_cache.get_unspent_lineage_info,
|
|
733
858
|
)
|
|
734
859
|
# Only add to `seen` if inclusion worked, so it can be resubmitted in case of a reorg
|
|
735
860
|
if info.status == MempoolInclusionStatus.SUCCESS:
|
|
@@ -751,6 +876,7 @@ class MempoolManager:
|
|
|
751
876
|
item.spend_bundle_name,
|
|
752
877
|
item.height_added_to_mempool,
|
|
753
878
|
self.get_coin_records,
|
|
879
|
+
lineage_cache.get_unspent_lineage_info,
|
|
754
880
|
)
|
|
755
881
|
if info.status == MempoolInclusionStatus.SUCCESS:
|
|
756
882
|
txs_added.append(NewPeakItem(item.spend_bundle_name, item.spend_bundle, item.conds))
|
|
@@ -808,6 +934,13 @@ def can_replace(
|
|
|
808
934
|
assert_height: Optional[uint32] = None
|
|
809
935
|
assert_before_height: Optional[uint32] = None
|
|
810
936
|
assert_before_seconds: Optional[uint64] = None
|
|
937
|
+
# we don't allow replacing mempool items with new ones that remove
|
|
938
|
+
# eligibility for dedup and fast-forward. Doing so could be abused by
|
|
939
|
+
# denying such spends from operating as intended
|
|
940
|
+
# collect all coins that are eligible for dedup and FF in the existing items
|
|
941
|
+
existing_ff_spends: set[bytes32] = set()
|
|
942
|
+
existing_dedup_spends: set[bytes32] = set()
|
|
943
|
+
|
|
811
944
|
for item in conflicting_items:
|
|
812
945
|
conflicting_fees += item.fee
|
|
813
946
|
conflicting_cost += item.cost
|
|
@@ -817,10 +950,14 @@ def can_replace(
|
|
|
817
950
|
# bundle with AB with a higher fee. An attacker then replaces the bundle with just B with a higher
|
|
818
951
|
# fee than AB therefore kicking out A altogether. The better way to solve this would be to keep a cache
|
|
819
952
|
# of booted transactions like A, and retry them after they get removed from mempool due to a conflict.
|
|
820
|
-
for
|
|
821
|
-
if
|
|
822
|
-
log.debug(
|
|
953
|
+
for coin_id, bcs in item.bundle_coin_spends.items():
|
|
954
|
+
if coin_id not in removal_names:
|
|
955
|
+
log.debug("Rejecting conflicting tx as it does not spend conflicting coin %s", coin_id)
|
|
823
956
|
return False
|
|
957
|
+
if bcs.eligible_for_fast_forward:
|
|
958
|
+
existing_ff_spends.add(bytes32(coin_id))
|
|
959
|
+
if bcs.eligible_for_dedup:
|
|
960
|
+
existing_dedup_spends.add(bytes32(coin_id))
|
|
824
961
|
|
|
825
962
|
assert_height = optional_max(assert_height, item.assert_height)
|
|
826
963
|
assert_before_height = optional_min(assert_before_height, item.assert_before_height)
|
|
@@ -866,5 +1003,15 @@ def can_replace(
|
|
|
866
1003
|
)
|
|
867
1004
|
return False
|
|
868
1005
|
|
|
1006
|
+
if len(existing_ff_spends) > 0 or len(existing_dedup_spends) > 0:
|
|
1007
|
+
for coin_id, bcs in new_item.bundle_coin_spends.items():
|
|
1008
|
+
if not bcs.eligible_for_fast_forward and coin_id in existing_ff_spends:
|
|
1009
|
+
log.debug("Rejecting conflicting tx due to changing ELIGIBLE_FOR_FF of coin spend %s", coin_id)
|
|
1010
|
+
return False
|
|
1011
|
+
|
|
1012
|
+
if not bcs.eligible_for_dedup and coin_id in existing_dedup_spends:
|
|
1013
|
+
log.debug("Rejecting conflicting tx due to changing ELIGIBLE_FOR_DEDUP of coin spend %s", coin_id)
|
|
1014
|
+
return False
|
|
1015
|
+
|
|
869
1016
|
log.info(f"Replacing conflicting tx in mempool. New tx fee: {new_item.fee}, old tx fees: {conflicting_fees}")
|
|
870
1017
|
return True
|
|
@@ -3,11 +3,11 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
+
from chia_rs.sized_bytes import bytes32
|
|
7
|
+
from chia_rs.sized_ints import uint32
|
|
6
8
|
from sortedcontainers import SortedDict
|
|
7
9
|
|
|
8
|
-
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
9
10
|
from chia.types.mempool_item import MempoolItem
|
|
10
|
-
from chia.util.ints import uint32
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@dataclass
|
chia/full_node/subscriptions.py
CHANGED
|
@@ -4,10 +4,10 @@ import logging
|
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
|
|
6
6
|
from chia_rs import Coin
|
|
7
|
+
from chia_rs.sized_bytes import bytes32
|
|
8
|
+
from chia_rs.sized_ints import uint64
|
|
7
9
|
|
|
8
|
-
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
9
10
|
from chia.types.spend_bundle_conditions import SpendBundleConditions
|
|
10
|
-
from chia.util.ints import uint64
|
|
11
11
|
|
|
12
12
|
log = logging.getLogger(__name__)
|
|
13
13
|
|
chia/full_node/sync_store.py
CHANGED
|
@@ -9,9 +9,8 @@ from dataclasses import dataclass, field
|
|
|
9
9
|
from typing import Optional
|
|
10
10
|
|
|
11
11
|
import typing_extensions
|
|
12
|
-
|
|
13
|
-
from
|
|
14
|
-
from chia.util.ints import uint32, uint128
|
|
12
|
+
from chia_rs.sized_bytes import bytes32
|
|
13
|
+
from chia_rs.sized_ints import uint32, uint128
|
|
15
14
|
|
|
16
15
|
log = logging.getLogger(__name__)
|
|
17
16
|
|
|
@@ -6,7 +6,8 @@ from dataclasses import dataclass
|
|
|
6
6
|
from queue import SimpleQueue
|
|
7
7
|
from typing import Optional
|
|
8
8
|
|
|
9
|
-
from
|
|
9
|
+
from chia_rs.sized_bytes import bytes32
|
|
10
|
+
|
|
10
11
|
from chia.types.transaction_queue_entry import TransactionQueueEntry
|
|
11
12
|
|
|
12
13
|
|
chia/full_node/weight_proof.py
CHANGED
|
@@ -10,10 +10,13 @@ from concurrent.futures.process import ProcessPoolExecutor
|
|
|
10
10
|
from multiprocessing.context import BaseContext
|
|
11
11
|
from typing import IO, Optional
|
|
12
12
|
|
|
13
|
+
from chia_rs import ConsensusConstants, SubEpochChallengeSegment, SubEpochData, SubEpochSegments, SubSlotData
|
|
14
|
+
from chia_rs.sized_bytes import bytes32
|
|
15
|
+
from chia_rs.sized_ints import uint8, uint32, uint64, uint128
|
|
16
|
+
|
|
13
17
|
from chia.consensus.block_header_validation import validate_finished_header_block
|
|
14
18
|
from chia.consensus.block_record import BlockRecord
|
|
15
19
|
from chia.consensus.blockchain_interface import BlockchainInterface
|
|
16
|
-
from chia.consensus.constants import ConsensusConstants
|
|
17
20
|
from chia.consensus.deficit import calculate_deficit
|
|
18
21
|
from chia.consensus.full_block_to_block_record import header_block_to_sub_block_record
|
|
19
22
|
from chia.consensus.pot_iterations import (
|
|
@@ -25,7 +28,6 @@ from chia.consensus.pot_iterations import (
|
|
|
25
28
|
from chia.consensus.vdf_info_computation import get_signage_point_vdf_info
|
|
26
29
|
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
|
27
30
|
from chia.types.blockchain_format.proof_of_space import verify_and_get_quality_string
|
|
28
|
-
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
29
31
|
from chia.types.blockchain_format.slots import ChallengeChainSubSlot, RewardChainSubSlot
|
|
30
32
|
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
|
|
31
33
|
from chia.types.blockchain_format.vdf import VDFInfo, VDFProof, validate_vdf
|
|
@@ -34,16 +36,11 @@ from chia.types.header_block import HeaderBlock
|
|
|
34
36
|
from chia.types.validation_state import ValidationState
|
|
35
37
|
from chia.types.weight_proof import (
|
|
36
38
|
RecentChainData,
|
|
37
|
-
SubEpochChallengeSegment,
|
|
38
|
-
SubEpochData,
|
|
39
|
-
SubEpochSegments,
|
|
40
|
-
SubSlotData,
|
|
41
39
|
WeightProof,
|
|
42
40
|
)
|
|
43
41
|
from chia.util.batches import to_batches
|
|
44
42
|
from chia.util.block_cache import BlockCache
|
|
45
43
|
from chia.util.hash import std_hash
|
|
46
|
-
from chia.util.ints import uint8, uint32, uint64, uint128
|
|
47
44
|
from chia.util.setproctitle import getproctitle, setproctitle
|
|
48
45
|
from chia.util.task_referencer import create_referenced_task
|
|
49
46
|
|
|
@@ -647,7 +644,7 @@ class WeightProofHandler:
|
|
|
647
644
|
fork_point_index = idx
|
|
648
645
|
|
|
649
646
|
if fork_point_index <= 2:
|
|
650
|
-
# Two
|
|
647
|
+
# Two summaries can have different blocks and still be identical
|
|
651
648
|
# This gets resolved after one full sub epoch
|
|
652
649
|
return uint32(0), 0
|
|
653
650
|
|
chia/harvester/harvester.py
CHANGED
|
@@ -10,9 +10,10 @@ from concurrent.futures.thread import ThreadPoolExecutor
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from typing import TYPE_CHECKING, Any, ClassVar, Optional, cast
|
|
12
12
|
|
|
13
|
+
from chia_rs import ConsensusConstants
|
|
14
|
+
from chia_rs.sized_ints import uint32
|
|
13
15
|
from typing_extensions import Literal
|
|
14
16
|
|
|
15
|
-
from chia.consensus.constants import ConsensusConstants
|
|
16
17
|
from chia.plot_sync.sender import Sender
|
|
17
18
|
from chia.plotting.manager import PlotManager
|
|
18
19
|
from chia.plotting.util import (
|
|
@@ -40,7 +41,6 @@ from chia.server.outbound_message import NodeType
|
|
|
40
41
|
from chia.server.server import ChiaServer
|
|
41
42
|
from chia.server.ws_connection import WSChiaConnection
|
|
42
43
|
from chia.util.cpu import available_logical_cores
|
|
43
|
-
from chia.util.ints import uint32
|
|
44
44
|
|
|
45
45
|
log = logging.getLogger(__name__)
|
|
46
46
|
|
|
@@ -94,7 +94,9 @@ class Harvester:
|
|
|
94
94
|
root_path, refresh_parameter=refresh_parameter, refresh_callback=self._plot_refresh_callback
|
|
95
95
|
)
|
|
96
96
|
self._shut_down = False
|
|
97
|
-
self.executor = concurrent.futures.ThreadPoolExecutor(
|
|
97
|
+
self.executor = concurrent.futures.ThreadPoolExecutor(
|
|
98
|
+
max_workers=config["num_threads"], thread_name_prefix="harvester-"
|
|
99
|
+
)
|
|
98
100
|
self._server = None
|
|
99
101
|
self.constants = constants
|
|
100
102
|
self.state_changed_callback: Optional[StateChangedProtocol] = None
|