From 747c3002fd1fe7eb3df270ec81a7f1d3935b2f17 Mon Sep 17 00:00:00 2001 From: Wizz Wallet <153743376+wizz-wallet-dev@users.noreply.github.com> Date: Sun, 6 Oct 2024 16:25:41 +0800 Subject: [PATCH] Remove `is_integer_num` for better analysis --- electrumx/lib/atomicals_blueprint_builder.py | 3 +-- electrumx/lib/util_atomicals.py | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/electrumx/lib/atomicals_blueprint_builder.py b/electrumx/lib/atomicals_blueprint_builder.py index 64c3b3e1..52ecfa87 100644 --- a/electrumx/lib/atomicals_blueprint_builder.py +++ b/electrumx/lib/atomicals_blueprint_builder.py @@ -8,7 +8,6 @@ compact_to_location_id_bytes, is_compact_atomical_id, is_custom_colored_operation, - is_integer_num, is_mint_operation, is_op_return_dmitem_payment_marker_atomical_id, is_op_return_subrealm_payment_marker_atomical_id, @@ -1025,7 +1024,7 @@ def are_payments_satisfied(self, expected_payment_outputs): # There is no value defined or the expected payment is below the dust limit, or skip it expected_output_payment_value = expected_output_payment_value_dict.get("v", None) if ( - not is_integer_num(expected_output_payment_value) + not isinstance(expected_output_payment_value, int) or expected_output_payment_value < SUBNAME_MIN_PAYMENT_DUST_LIMIT ): continue diff --git a/electrumx/lib/util_atomicals.py b/electrumx/lib/util_atomicals.py index 7d98bed0..0270a0e1 100644 --- a/electrumx/lib/util_atomicals.py +++ b/electrumx/lib/util_atomicals.py @@ -148,12 +148,6 @@ def is_sanitized_dict_whitelist_only(d: dict, allow_bytes=False): return True -def is_integer_num(n): - if isinstance(n, int): - return True - return False - - # Check whether the value is hex string def is_hex_string(value): if not isinstance(value, str): @@ -1518,7 +1512,7 @@ def validate_subrealm_rules_outputs_format(outputs): return False # Reject if one of the entries expects less than the minimum payment amount expected_output_id = expected_output_value.get("id") expected_output_qty = expected_output_value.get("v") - if not is_integer_num(expected_output_qty) or expected_output_qty < SUBNAME_MIN_PAYMENT_DUST_LIMIT: + if not isinstance(expected_output_qty, int) or expected_output_qty < SUBNAME_MIN_PAYMENT_DUST_LIMIT: print_subrealm_calculate_log("validate_subrealm_rules_outputs_format: invalid expected output value") return False # Reject if one of the entries expects less than the minimum payment amount # If there is a type restriction on the payment type then ensure it is a valid atomical id