diff --git a/fusion/fusion.py b/fusion/fusion.py index 0b503d1..8b483d1 100644 --- a/fusion/fusion.py +++ b/fusion/fusion.py @@ -64,14 +64,17 @@ P2_MOD: Program = load_clvm("p2_fusion.clsp", package_or_requirement="clsp", recompile=True) -AGG_SIG_ME_ADDITIONAL_DATA = DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA +PREFIX = os.environ.get("PREFIX", "xch") + +logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s") +logger = logging.getLogger() + MAX_BLOCK_COST_CLVM = DEFAULT_CONSTANTS.MAX_BLOCK_COST_CLVM SINGLETON_AMOUNT = uint64(1) FEE_TARGET_SIZE = int(os.environ.get('FEE_TARGET_SIZE', 1000)) COIN_TARGET_SIZE = SINGLETON_AMOUNT + FEE_TARGET_SIZE #1 singleton + 50000 fee DERIVATIONS = int(os.environ.get('DERIVATIONS', 1000)) -PREFIX = os.environ.get("PREFIX", "xch") SINGLETON_INNER: Program = load_clvm("fusion_singleton.clsp", package_or_requirement="clsp", recompile=True) @@ -80,15 +83,25 @@ full_node_rpc_port = config["full_node"]["rpc_port"] # 8555 wallet_rpc_port = config["wallet"]["rpc_port"] # 9256 +agg_sig_config = None + +TESTNET = os.environ.get("TESTNET", "testnet10") + +if PREFIX == 'txch': + try: + agg_sig_config = bytes32.from_hexstr(config["farmer"]["network_overrides"]["constants"][TESTNET]["AGG_SIG_ME_ADDITIONAL_DATA"]) + logger.info(f"Loaded AGG_SIG_ME_ADDITIONAL_DATA override: {agg_sig_config}") + except Exception as e: + logger.warning(f"Tried loading AGG_SIG_ME_ADDITIONAL_DATA from config. Exception {e}") + +AGG_SIG_ME_ADDITIONAL_DATA = agg_sig_config or DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA + wallet_keys = [] puzzle_reveals = {} # track coins spent recently to make sure they are not re-selected during pending block confirmations recent_coins: deque = deque([], 1000) -logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s") -logger = logging.getLogger() - class Fusion: @@ -567,8 +580,8 @@ async def make_swap_spend_bundle(self, singleton_launcher_id, singleton_inner_pu SerializedProgram.from_program(full_solution) ) - spend_bundle = await sign_coin_spends([singleton_claim_coinsol], wallet_keyf, - self.get_synthetic_private_key_for_puzzle_hash, + spend_bundle = await sign_coin_spends([singleton_claim_coinsol], wallet_keyf, + self.get_synthetic_private_key_for_puzzle_hash, AGG_SIG_ME_ADDITIONAL_DATA, MAX_BLOCK_COST_CLVM, [puzzle_hash_for_synthetic_public_key]) return spend_bundle diff --git a/pytest.ini b/pytest.ini index c1a40d1..3189c8d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,5 +7,6 @@ log_cli_level = INFO env = PREFIX=txch + TESTNET=simulator FINGERPRINT=1307711849 CHIA_ROOT=~/.chia/simulator/main diff --git a/tests/test_fusion.py b/tests/test_fusion.py index cb19028..55d7314 100644 --- a/tests/test_fusion.py +++ b/tests/test_fusion.py @@ -50,7 +50,6 @@ prefix = "txch" logger = logging.getLogger() - ################################################################################################################## # NOTE: use one you have in your local simulator here! FINGERPRINT = int(os.environ.get('FINGERPRINT'))