diff --git a/chia/_tests/core/consensus/test_pot_iterations.py b/chia/_tests/core/consensus/test_pot_iterations.py index 6dcf1ecea066..7a7c741c7fff 100644 --- a/chia/_tests/core/consensus/test_pot_iterations.py +++ b/chia/_tests/core/consensus/test_pot_iterations.py @@ -68,7 +68,7 @@ def test_calculate_ip_iters(self): ip_iters = calculate_ip_iters(test_constants, ssi, uint8(13), required_iters) assert ip_iters == sp_iters + test_constants.NUM_SP_INTERVALS_EXTRA * sp_interval_iters + required_iters - required_iters = uint64(int(ssi * 4 / 300)) + required_iters = uint64(ssi * 4 / 300) ip_iters = calculate_ip_iters(test_constants, ssi, uint8(13), required_iters) assert ip_iters == sp_iters + test_constants.NUM_SP_INTERVALS_EXTRA * sp_interval_iters + required_iters assert sp_iters < ip_iters diff --git a/chia/_tests/core/full_node/test_full_node.py b/chia/_tests/core/full_node/test_full_node.py index 88aa137698e8..268a270b9306 100644 --- a/chia/_tests/core/full_node/test_full_node.py +++ b/chia/_tests/core/full_node/test_full_node.py @@ -548,7 +548,7 @@ async def test_request_peers( async def have_msgs(full_node_peers: FullNodePeers) -> bool: assert full_node_peers.address_manager is not None await full_node_peers.address_manager.add_to_new_table( - [TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(int(time.time()) - 1000))], + [TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(time.time() - 1000))], None, ) assert server_2._port is not None diff --git a/chia/_tests/core/test_crawler.py b/chia/_tests/core/test_crawler.py index 05a48e1913fe..865944b165db 100644 --- a/chia/_tests/core/test_crawler.py +++ b/chia/_tests/core/test_crawler.py @@ -111,7 +111,7 @@ async def test_crawler_to_db(crawler_service_no_loop: CrawlerService, one_node: uint64(0), uint32(0), uint64(0), - uint64(int(time.time())), + uint64(time.time()), uint64(0), "undefined", uint64(0), @@ -153,8 +153,8 @@ async def test_crawler_peer_cleanup( uint64(0), uint32(0), uint64(0), - uint64(int(time.time())), - uint64(int((datetime.now() - timedelta(days=idx * 10)).timestamp())), + uint64(time.time()), + uint64((datetime.now() - timedelta(days=idx * 10)).timestamp()), "undefined", uint64(0), tls_version="unknown", diff --git a/chia/_tests/core/test_seeder.py b/chia/_tests/core/test_seeder.py index 342e7dcf46f8..09099a82d84d 100644 --- a/chia/_tests/core/test_seeder.py +++ b/chia/_tests/core/test_seeder.py @@ -83,7 +83,7 @@ def database_peers() -> dict[str, PeerReliability]: uint64(0), uint32(0), uint64(0), - uint64(int(time.time())), + uint64(time.time()), uint64(0), "undefined", uint64(0), diff --git a/chia/_tests/plot_sync/test_sender.py b/chia/_tests/plot_sync/test_sender.py index ea011082ce5f..40fda2d2cfc5 100644 --- a/chia/_tests/plot_sync/test_sender.py +++ b/chia/_tests/plot_sync/test_sender.py @@ -75,7 +75,7 @@ def new_expected_response(sync_id: int, message_id: int, message_type: ProtocolM def new_response_message(sync_id: int, message_id: int, message_type: ProtocolMessageTypes) -> PlotSyncResponse: return PlotSyncResponse( - plot_sync_identifier(uint64(sync_id), uint64(message_id)), int16(int(message_type.value)), None + plot_sync_identifier(uint64(sync_id), uint64(message_id)), int16(message_type.value), None ) response_message = new_response_message(0, 1, ProtocolMessageTypes.plot_sync_start) @@ -97,7 +97,7 @@ def new_response_message(sync_id: int, message_id: int, message_type: ProtocolMe expected_response.identifier.sync_id, expected_response.identifier.message_id, ) - expired_message = PlotSyncResponse(expired_identifier, int16(int(ProtocolMessageTypes.plot_sync_start.value)), None) + expired_message = PlotSyncResponse(expired_identifier, int16(ProtocolMessageTypes.plot_sync_start.value), None) assert not sender.set_response(expired_message) # Test invalid sync-id sender._response = new_expected_response(2, 0, ProtocolMessageTypes.plot_sync_start) diff --git a/chia/_tests/plot_sync/test_sync_simulated.py b/chia/_tests/plot_sync/test_sync_simulated.py index 1be1b8a51591..8cbc9e20e35a 100644 --- a/chia/_tests/plot_sync/test_sync_simulated.py +++ b/chia/_tests/plot_sync/test_sync_simulated.py @@ -140,7 +140,7 @@ def validate_plot_sync(self) -> None: assert plot_info.pool_contract_puzzle_hash == synced_plot.pool_contract_puzzle_hash assert plot_info.plot_public_key == synced_plot.plot_public_key assert plot_info.file_size == synced_plot.file_size - assert uint64(int(plot_info.time_modified)) == synced_plot.time_modified + assert uint64(plot_info.time_modified) == synced_plot.time_modified for plot_info in self.invalid: assert plot_info.prover.get_filename() not in self.plot_sync_receiver.plots() assert plot_info.prover.get_filename() in self.plot_sync_receiver.invalid() diff --git a/chia/_tests/plot_sync/util.py b/chia/_tests/plot_sync/util.py index 761a6f0fbec6..e619e759436e 100644 --- a/chia/_tests/plot_sync/util.py +++ b/chia/_tests/plot_sync/util.py @@ -38,7 +38,7 @@ def get_dummy_connection(node_type: NodeType, peer_id: bytes32) -> WSChiaConnect def plot_sync_identifier(current_sync_id: uint64, message_id: uint64) -> PlotSyncIdentifier: - return PlotSyncIdentifier(uint64(int(time.time())), current_sync_id, message_id) + return PlotSyncIdentifier(uint64(time.time()), current_sync_id, message_id) @contextlib.asynccontextmanager diff --git a/chia/cmds/wallet_funcs.py b/chia/cmds/wallet_funcs.py index 5052a2fe6dbc..9cc877999db8 100644 --- a/chia/cmds/wallet_funcs.py +++ b/chia/cmds/wallet_funcs.py @@ -525,7 +525,7 @@ async def make_offer( assert hrp is not None unit = units[hrp] except ValueError: - id = uint32(int(name)) + id = uint32(name) if id == 1: name = "XCH" unit = units["chia"] diff --git a/chia/consensus/block_rewards.py b/chia/consensus/block_rewards.py index 1d71c9e3e69b..1c1d0447a5aa 100644 --- a/chia/consensus/block_rewards.py +++ b/chia/consensus/block_rewards.py @@ -17,17 +17,17 @@ def calculate_pool_reward(height: uint32) -> uint64: """ if height == 0: - return uint64(int((7 / 8) * 21000000 * _mojo_per_chia)) + return uint64((7 / 8) * 21000000 * _mojo_per_chia) elif height < 3 * _blocks_per_year: - return uint64(int((7 / 8) * 2 * _mojo_per_chia)) + return uint64((7 / 8) * 2 * _mojo_per_chia) elif height < 6 * _blocks_per_year: - return uint64(int((7 / 8) * 1 * _mojo_per_chia)) + return uint64((7 / 8) * 1 * _mojo_per_chia) elif height < 9 * _blocks_per_year: - return uint64(int((7 / 8) * 0.5 * _mojo_per_chia)) + return uint64((7 / 8) * 0.5 * _mojo_per_chia) elif height < 12 * _blocks_per_year: - return uint64(int((7 / 8) * 0.25 * _mojo_per_chia)) + return uint64((7 / 8) * 0.25 * _mojo_per_chia) else: - return uint64(int((7 / 8) * 0.125 * _mojo_per_chia)) + return uint64((7 / 8) * 0.125 * _mojo_per_chia) def calculate_base_farmer_reward(height: uint32) -> uint64: @@ -40,14 +40,14 @@ def calculate_base_farmer_reward(height: uint32) -> uint64: rates increase continuously. """ if height == 0: - return uint64(int((1 / 8) * 21000000 * _mojo_per_chia)) + return uint64((1 / 8) * 21000000 * _mojo_per_chia) elif height < 3 * _blocks_per_year: - return uint64(int((1 / 8) * 2 * _mojo_per_chia)) + return uint64((1 / 8) * 2 * _mojo_per_chia) elif height < 6 * _blocks_per_year: - return uint64(int((1 / 8) * 1 * _mojo_per_chia)) + return uint64((1 / 8) * 1 * _mojo_per_chia) elif height < 9 * _blocks_per_year: - return uint64(int((1 / 8) * 0.5 * _mojo_per_chia)) + return uint64((1 / 8) * 0.5 * _mojo_per_chia) elif height < 12 * _blocks_per_year: - return uint64(int((1 / 8) * 0.25 * _mojo_per_chia)) + return uint64((1 / 8) * 0.25 * _mojo_per_chia) else: - return uint64(int((1 / 8) * 0.125 * _mojo_per_chia)) + return uint64((1 / 8) * 0.125 * _mojo_per_chia) diff --git a/chia/data_layer/data_layer_wallet.py b/chia/data_layer/data_layer_wallet.py index ae389c3d7bf7..5c1be14ee7bd 100644 --- a/chia/data_layer/data_layer_wallet.py +++ b/chia/data_layer/data_layer_wallet.py @@ -536,7 +536,7 @@ async def create_update_state_spend( dl_tx = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=new_puz_hash, amount=uint64(singleton_record.lineage_proof.amount), fee_amount=fee, @@ -731,7 +731,7 @@ async def delete_mirror( interface.side_effects.transactions.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=new_puzhash, amount=uint64(mirror_coin.amount), fee_amount=fee, diff --git a/chia/farmer/farmer_api.py b/chia/farmer/farmer_api.py index c88850b4bc51..3a084212964d 100644 --- a/chia/farmer/farmer_api.py +++ b/chia/farmer/farmer_api.py @@ -73,7 +73,7 @@ async def new_proof_of_space( """ if new_proof_of_space.sp_hash not in self.farmer.number_of_responses: self.farmer.number_of_responses[new_proof_of_space.sp_hash] = 0 - self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(int(time.time())) + self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(time.time()) max_pos_per_sp = 5 @@ -170,14 +170,14 @@ async def new_proof_of_space( new_proof_of_space.proof, ) ) - self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(int(time.time())) + self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(time.time()) self.farmer.quality_str_to_identifiers[computed_quality_string] = ( new_proof_of_space.plot_identifier, new_proof_of_space.challenge_hash, new_proof_of_space.sp_hash, peer.peer_node_id, ) - self.farmer.cache_add_time[computed_quality_string] = uint64(int(time.time())) + self.farmer.cache_add_time[computed_quality_string] = uint64(time.time()) await peer.send_message(make_msg(ProtocolMessageTypes.request_signatures, request)) @@ -558,7 +558,7 @@ async def new_signage_point(self, new_signage_point: farmer_protocol.NewSignageP pool_dict[key] = strip_old_entries(pairs=pool_dict[key], before=cutoff_24h) - now = uint64(int(time.time())) + now = uint64(time.time()) self.farmer.cache_add_time[new_signage_point.challenge_chain_sp] = now missing_signage_points = self.farmer.check_missing_signage_points(now, new_signage_point) self.farmer.state_changed( diff --git a/chia/full_node/full_node.py b/chia/full_node/full_node.py index fe8ea89985f7..01d041216569 100644 --- a/chia/full_node/full_node.py +++ b/chia/full_node/full_node.py @@ -887,7 +887,7 @@ async def send_peak_to_timelords( async def synced(self, block_is_current_at: Optional[uint64] = None) -> bool: if block_is_current_at is None: - block_is_current_at = uint64(int(time.time() - 60 * 7)) + block_is_current_at = uint64(time.time() - 60 * 7) if "simulator" in str(self.config.get("selected_network")): return True # sim is always synced because it has no peers curr: Optional[BlockRecord] = self.blockchain.get_peak() diff --git a/chia/full_node/full_node_api.py b/chia/full_node/full_node_api.py index aa892e9cb910..3c9da355cafe 100644 --- a/chia/full_node/full_node_api.py +++ b/chia/full_node/full_node_api.py @@ -1001,14 +1001,14 @@ def get_pool_sig(_1: PoolTarget, _2: Optional[G1Element]) -> Optional[G2Element] ) # The block's timestamp must be greater than the previous transaction block's timestamp - timestamp = uint64(int(time.time())) + timestamp = uint64(time.time()) curr: Optional[BlockRecord] = prev_b while curr is not None and not curr.is_transaction_block and curr.height != 0: curr = self.full_node.blockchain.try_block_record(curr.prev_hash) if curr is not None: assert curr.timestamp is not None if timestamp <= curr.timestamp: - timestamp = uint64(int(curr.timestamp + 1)) + timestamp = uint64(curr.timestamp + 1) self.log.info("Starting to make the unfinished block") unfinished_block: UnfinishedBlock = create_unfinished_block( diff --git a/chia/full_node/full_node_rpc_api.py b/chia/full_node/full_node_rpc_api.py index c6bf67f94c02..cd08ce424dfa 100644 --- a/chia/full_node/full_node_rpc_api.py +++ b/chia/full_node/full_node_rpc_api.py @@ -521,7 +521,7 @@ async def get_block_record_by_height(self, request: dict[str, Any]) -> EndpointR if "height" not in request: raise ValueError("No height in request") height = request["height"] - header_height = uint32(int(height)) + header_height = uint32(height) peak_height = self.service.blockchain.get_peak_height() if peak_height is None or header_height > peak_height: raise ValueError(f"Block height {height} not found in chain") @@ -610,7 +610,7 @@ async def get_network_space(self, request: dict[str, Any]) -> EndpointResult: * additional_difficulty_constant * eligible_plots_filter_multiplier ) - return {"space": uint128(int(network_space_bytes_estimate))} + return {"space": uint128(network_space_bytes_estimate)} async def get_coin_records_by_puzzle_hash(self, request: dict[str, Any]) -> EndpointResult: """ diff --git a/chia/full_node/weight_proof.py b/chia/full_node/weight_proof.py index e397ec4ba026..71886ad759fe 100644 --- a/chia/full_node/weight_proof.py +++ b/chia/full_node/weight_proof.py @@ -673,7 +673,7 @@ def _get_weights_for_sampling( q = 1 - delta**u # todo check division and type conversions weight = q * float(total_weight) - weight_to_check.append(uint128(int(weight))) + weight_to_check.append(uint128(weight)) weight_to_check.sort() return weight_to_check diff --git a/chia/harvester/harvester_api.py b/chia/harvester/harvester_api.py index b547102b4354..eb229a3a7639 100644 --- a/chia/harvester/harvester_api.py +++ b/chia/harvester/harvester_api.py @@ -287,7 +287,7 @@ async def lookup_challenge( msg = make_msg(ProtocolMessageTypes.new_proof_of_space, response) await peer.send_message(msg) - now = uint64(int(time.time())) + now = uint64(time.time()) farming_info = FarmingInfo( new_challenge.challenge_hash, diff --git a/chia/plot_sync/sender.py b/chia/plot_sync/sender.py index 74be15cae2cf..707d5b7d8731 100644 --- a/chia/plot_sync/sender.py +++ b/chia/plot_sync/sender.py @@ -46,7 +46,7 @@ def _convert_plot_info_list(plot_infos: list[PlotInfo]) -> list[Plot]: pool_contract_puzzle_hash=plot_info.pool_contract_puzzle_hash, plot_public_key=plot_info.plot_public_key, file_size=uint64(plot_info.file_size), - time_modified=uint64(int(plot_info.time_modified)), + time_modified=uint64(plot_info.time_modified), compression_level=plot_info.prover.get_compression_level(), ) ) @@ -72,7 +72,7 @@ class MessageGenerator(Generic[T]): args: Iterable[object] def generate(self) -> tuple[PlotSyncIdentifier, T]: - identifier = PlotSyncIdentifier(uint64(int(time.time())), self.sync_id, self.message_id) + identifier = PlotSyncIdentifier(uint64(time.time()), self.sync_id, self.message_id) payload = self.payload_type(identifier, *self.args) return identifier, payload @@ -277,7 +277,7 @@ def sync_start(self, count: float, initial: bool) -> None: PlotSyncStart, initial, self._last_sync_id, - uint32(int(count)), + uint32(count), self._harvesting_mode, ) diff --git a/chia/plotting/cache.py b/chia/plotting/cache.py index c70504d4c31f..96852446a04d 100644 --- a/chia/plotting/cache.py +++ b/chia/plotting/cache.py @@ -113,7 +113,7 @@ def save(self) -> None: cache_entry.pool_public_key, cache_entry.pool_contract_puzzle_hash, cache_entry.plot_public_key, - uint64(int(cache_entry.last_use)), + uint64(cache_entry.last_use), ) for path, cache_entry in self.items() } diff --git a/chia/pools/pool_wallet.py b/chia/pools/pool_wallet.py index ce08ab78aa33..2366aed6bc98 100644 --- a/chia/pools/pool_wallet.py +++ b/chia/pools/pool_wallet.py @@ -525,7 +525,7 @@ async def generate_travel_transactions(self, fee: uint64, action_scope: WalletAc interface.side_effects.transactions.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=new_full_puzzle.get_tree_hash(), amount=uint64(1), fee_amount=fee, @@ -792,7 +792,7 @@ async def claim_pool_rewards( ), ) - current_time = uint64(int(time.time())) + current_time = uint64(time.time()) # The claim spend, minus the fee amount from the main wallet async with action_scope.use() as interface: interface.side_effects.transactions.append( diff --git a/chia/protocols/pool_protocol.py b/chia/protocols/pool_protocol.py index 2d61eb02ca3e..298af3688f9f 100644 --- a/chia/protocols/pool_protocol.py +++ b/chia/protocols/pool_protocol.py @@ -168,7 +168,7 @@ class ErrorResponse(Streamable): # Get the current authentication token according to "Farmer authentication" in SPECIFICATION.md def get_current_authentication_token(timeout: uint8) -> uint64: - return uint64(int(int(time.time() / 60) / timeout)) + return uint64(int(time.time() / 60) / timeout) # Validate a given authentication token against our local time diff --git a/chia/rpc/rpc_server.py b/chia/rpc/rpc_server.py index f39399b7fef7..fc5c2d89af26 100644 --- a/chia/rpc/rpc_server.py +++ b/chia/rpc/rpc_server.py @@ -292,7 +292,7 @@ async def get_connections(self, request: dict[str, Any]) -> EndpointResult: async def open_connection(self, request: dict[str, Any]) -> EndpointResult: host = request["host"] port = request["port"] - target_node: PeerInfo = PeerInfo(await resolve(host, prefer_ipv6=self.prefer_ipv6), uint16(int(port))) + target_node: PeerInfo = PeerInfo(await resolve(host, prefer_ipv6=self.prefer_ipv6), uint16(port)) on_connect = None if hasattr(self.rpc_api.service, "on_connect"): on_connect = self.rpc_api.service.on_connect diff --git a/chia/seeder/crawler.py b/chia/seeder/crawler.py index 762c3e5f3999..193c00ae8f24 100644 --- a/chia/seeder/crawler.py +++ b/chia/seeder/crawler.py @@ -180,7 +180,7 @@ async def load_bootstrap_peers(self) -> None: uint64(0), uint32(0), uint64(0), - uint64(int(time.time())), + uint64(time.time()), uint64(0), "undefined", uint64(0), @@ -248,7 +248,7 @@ async def crawl(self) -> None: uint64(0), uint32(0), uint64(0), - uint64(int(time.time())), + uint64(time.time()), uint64(response_peer.timestamp), "undefined", uint64(0), diff --git a/chia/server/address_manager.py b/chia/server/address_manager.py index 14ba11a6fd5c..4a3cb6f9f913 100644 --- a/chia/server/address_manager.py +++ b/chia/server/address_manager.py @@ -129,8 +129,8 @@ def parse(cls, data: io.BytesIO) -> ExtendedPeerInfo: def from_string(cls, peer_str: str) -> ExtendedPeerInfo: blobs = peer_str.split(" ") assert len(blobs) == 5 - peer_info = TimestampedPeerInfo(blobs[0], uint16(int(blobs[1])), uint64(int(blobs[2]))) - src_peer = PeerInfo(blobs[3], uint16(int(blobs[4]))) + peer_info = TimestampedPeerInfo(blobs[0], uint16(blobs[1]), uint64(blobs[2])) + src_peer = PeerInfo(blobs[3], uint16(blobs[4])) return cls(peer_info, src_peer) def get_tried_bucket(self, key: int) -> int: diff --git a/chia/server/introducer_peers.py b/chia/server/introducer_peers.py index 9c8c055a2a4b..4d5524a2487f 100644 --- a/chia/server/introducer_peers.py +++ b/chia/server/introducer_peers.py @@ -48,7 +48,7 @@ def add(self, peer: Optional[PeerInfo]) -> bool: return False p = VettedPeer(peer.host, peer.port) - p.time_added = uint64(int(time.time())) + p.time_added = uint64(time.time()) if p in self._peers: return True diff --git a/chia/server/node_discovery.py b/chia/server/node_discovery.py index f8fa48a28c07..b34c4bbb0d02 100644 --- a/chia/server/node_discovery.py +++ b/chia/server/node_discovery.py @@ -119,7 +119,7 @@ async def on_connect(self, peer: WSChiaConnection) -> None: timestamped_peer_info = TimestampedPeerInfo( peer.peer_info.host, peer.peer_server_port, - uint64(int(time.time())), + uint64(time.time()), ) await self.address_manager.add_to_new_table([timestamped_peer_info], peer.get_peer_info(), 0) if self.relay_queue is not None: @@ -247,7 +247,7 @@ async def _connect_to_peers(self, random: Random) -> None: dns_server_index: int = 0 tried_all_dns_servers: bool = False local_peerinfo: Optional[PeerInfo] = await self.server.get_peer_info() - last_timestamp_local_info: uint64 = uint64(int(time.time())) + last_timestamp_local_info: uint64 = uint64(time.time()) last_collision_timestamp = 0 if self.initial_wait > 0: @@ -372,7 +372,7 @@ async def _connect_to_peers(self, random: Random) -> None: continue if time.time() - last_timestamp_local_info > 1800 or local_peerinfo is None: local_peerinfo = await self.server.get_peer_info() - last_timestamp_local_info = uint64(int(time.time())) + last_timestamp_local_info = uint64(time.time()) if local_peerinfo is not None and addr == local_peerinfo: continue got_peer = True @@ -465,7 +465,7 @@ async def _add_peers_common( current_peer = TimestampedPeerInfo( peer.host, peer.port, - uint64(int(time.time() - 5 * 24 * 60 * 60)), + uint64(time.time() - 5 * 24 * 60 * 60), ) else: current_peer = peer @@ -534,7 +534,7 @@ async def _periodically_self_advertise_and_clean_data(self) -> None: TimestampedPeerInfo( peer.host, peer.port, - uint64(int(time.time())), + uint64(time.time()), ) ] msg = make_msg( diff --git a/chia/simulator/block_tools.py b/chia/simulator/block_tools.py index b129b5fb251f..e51143c08e16 100644 --- a/chia/simulator/block_tools.py +++ b/chia/simulator/block_tools.py @@ -772,7 +772,7 @@ def get_consecutive_blocks( seed, force_overflow=force_overflow, skip_slots=skip_slots, - timestamp=(uint64(int(time.time())) if genesis_timestamp is None else genesis_timestamp), + timestamp=(uint64(time.time()) if genesis_timestamp is None else genesis_timestamp), ) self.log.info(f"Created block 0 iters: {genesis.total_iters}") num_empty_slots_added = skip_slots @@ -1311,7 +1311,7 @@ def create_genesis_block( skip_slots: int = 0, ) -> FullBlock: if timestamp is None: - timestamp = uint64(int(time.time())) + timestamp = uint64(time.time()) finished_sub_slots: list[EndOfSubSlotBundle] = [] unfinished_block: Optional[UnfinishedBlock] = None diff --git a/chia/wallet/cat_wallet/cat_wallet.py b/chia/wallet/cat_wallet/cat_wallet.py index d35447785373..37a062137efe 100644 --- a/chia/wallet/cat_wallet/cat_wallet.py +++ b/chia/wallet/cat_wallet/cat_wallet.py @@ -174,7 +174,7 @@ async def create_new_cat_wallet( cat_record = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=(await self.convert_puzzle_hash(cat_coin.puzzle_hash)), amount=uint64(cat_coin.amount), fee_amount=fee, @@ -794,7 +794,7 @@ async def generate_signed_transaction( interface.side_effects.transactions.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=puzzle_hashes[0], amount=uint64(payment_sum), fee_amount=fee, diff --git a/chia/wallet/did_wallet/did_wallet.py b/chia/wallet/did_wallet/did_wallet.py index 219bfb177003..f5b8e919cd3c 100644 --- a/chia/wallet/did_wallet/did_wallet.py +++ b/chia/wallet/did_wallet/did_wallet.py @@ -650,7 +650,7 @@ async def create_update_spend( ) did_record = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=await action_scope.get_puzzle_hash( self.wallet_state_manager, override_reuse_puzhash_with=True ), @@ -736,7 +736,7 @@ async def transfer_did( ) did_record = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=await action_scope.get_puzzle_hash( self.wallet_state_manager, override_reuse_puzhash_with=True ), @@ -817,7 +817,7 @@ async def create_message_spend( unsigned_spend_bundle = WalletSpendBundle(list_of_coinspends, G2Element()) tx = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=p2_ph, amount=uint64(coin.amount), fee_amount=uint64(0), @@ -1026,7 +1026,7 @@ async def generate_new_decentralised_id( did_record = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), amount=uint64(amount), to_puzzle_hash=await action_scope.get_puzzle_hash( self.wallet_state_manager, override_reuse_puzhash_with=True @@ -1170,12 +1170,12 @@ def deserialize_backup_data(backup_data: str) -> DIDInfo: :return: DIDInfo """ details = backup_data.split(":") - origin = Coin(bytes32.fromhex(details[0]), bytes32.fromhex(details[1]), uint64(int(details[2]))) + origin = Coin(bytes32.fromhex(details[0]), bytes32.fromhex(details[1]), uint64(details[2])) backup_ids = [] if len(details[3]) > 0: for d in details[3].split(","): backup_ids.append(bytes32.from_hexstr(d)) - num_of_backup_ids_needed = uint64(int(details[5])) + num_of_backup_ids_needed = uint64(details[5]) if num_of_backup_ids_needed > len(backup_ids): raise Exception innerpuz: Program = Program.from_bytes(bytes.fromhex(details[4])) diff --git a/chia/wallet/nft_wallet/nft_wallet.py b/chia/wallet/nft_wallet/nft_wallet.py index 72882e184cb4..056d6b0ce662 100644 --- a/chia/wallet/nft_wallet/nft_wallet.py +++ b/chia/wallet/nft_wallet/nft_wallet.py @@ -615,7 +615,7 @@ async def generate_signed_transaction( } tx = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=puzzle_hashes[0], amount=uint64(payment_sum), fee_amount=fee, @@ -1404,7 +1404,7 @@ async def mint_from_did( interface.side_effects.transactions.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=innerpuz.get_tree_hash(), amount=uint64(1), fee_amount=fee, diff --git a/chia/wallet/trade_manager.py b/chia/wallet/trade_manager.py index e4d8ee473e08..a64693e54f7f 100644 --- a/chia/wallet/trade_manager.py +++ b/chia/wallet/trade_manager.py @@ -359,7 +359,7 @@ async def cancel_pending_offers( incoming_tx = TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=new_ph, amount=uint64(coin.amount), fee_amount=fee, @@ -447,7 +447,7 @@ async def create_offer_for_ids( success, created_offer, error = result - now = uint64(int(time.time())) + now = uint64(time.time()) trade_offer: TradeRecord = TradeRecord( confirmed_at_index=uint32(0), accepted_at_time=None, @@ -726,7 +726,7 @@ async def calculate_tx_records_for_offer(self, offer: Offer, validate: bool) -> txs.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=to_puzzle_hash, amount=uint64(addition.amount), fee_amount=uint64(0), @@ -786,7 +786,7 @@ async def calculate_tx_records_for_offer(self, offer: Offer, validate: bool) -> txs.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=to_puzzle_hash, amount=uint64(sent_amount), fee_amount=all_fees, @@ -883,8 +883,8 @@ async def respond_to_offer( trade_record: TradeRecord = TradeRecord( confirmed_at_index=uint32(0), - accepted_at_time=uint64(int(time.time())), - created_at_time=uint64(int(time.time())), + accepted_at_time=uint64(time.time()), + created_at_time=uint64(time.time()), is_my_offer=False, sent=uint32(0), offer=bytes(complete_offer), diff --git a/chia/wallet/vc_wallet/cr_cat_wallet.py b/chia/wallet/vc_wallet/cr_cat_wallet.py index 0862d3af55d6..79ef077b7250 100644 --- a/chia/wallet/vc_wallet/cr_cat_wallet.py +++ b/chia/wallet/vc_wallet/cr_cat_wallet.py @@ -660,7 +660,7 @@ async def generate_signed_transaction( tx_list = [ TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=payment.puzzle_hash, amount=payment.amount, fee_amount=fee, @@ -791,7 +791,7 @@ async def claim_pending_approval_balance( interface.side_effects.transactions.append( TransactionRecord( confirmed_at_height=uint32(0), - created_at_time=uint64(int(time.time())), + created_at_time=uint64(time.time()), to_puzzle_hash=to_puzzle_hash, amount=uint64(sum(c.amount for c in coins)), fee_amount=fee, diff --git a/chia/wallet/vc_wallet/vc_wallet.py b/chia/wallet/vc_wallet/vc_wallet.py index b386f4e9b688..05fa929d57a6 100644 --- a/chia/wallet/vc_wallet/vc_wallet.py +++ b/chia/wallet/vc_wallet/vc_wallet.py @@ -200,7 +200,7 @@ async def launch_new_vc( puzzle = await self.standard_wallet.puzzle_for_puzzle_hash(coin.puzzle_hash) coin_spends.append(make_spend(coin, puzzle, solution)) spend_bundle = WalletSpendBundle(coin_spends, G2Element()) - now = uint64(int(time.time())) + now = uint64(time.time()) add_list: list[Coin] = list(spend_bundle.additions()) rem_list: list[Coin] = list(spend_bundle.removals()) vc_record: VCRecord = VCRecord(vc, uint32(0)) @@ -339,7 +339,7 @@ async def generate_signed_transaction( ) # pragma: no cover add_list: list[Coin] = list(spend_bundle.additions()) rem_list: list[Coin] = list(spend_bundle.removals()) - now = uint64(int(time.time())) + now = uint64(time.time()) async with action_scope.use() as interface: interface.side_effects.transactions.append( diff --git a/chia/wallet/wallet.py b/chia/wallet/wallet.py index ca4bae5daf02..a9355089d88a 100644 --- a/chia/wallet/wallet.py +++ b/chia/wallet/wallet.py @@ -420,7 +420,7 @@ async def generate_signed_transaction( assert len(transaction) > 0 spend_bundle = WalletSpendBundle(transaction, G2Element()) - now = uint64(int(time.time())) + now = uint64(time.time()) add_list: list[Coin] = list(spend_bundle.additions()) rem_list: list[Coin] = list(spend_bundle.removals()) diff --git a/chia/wallet/wallet_rpc_api.py b/chia/wallet/wallet_rpc_api.py index 6cac029b9008..70b242adecff 100644 --- a/chia/wallet/wallet_rpc_api.py +++ b/chia/wallet/wallet_rpc_api.py @@ -1283,13 +1283,13 @@ async def _get_wallet_balance(self, wallet_id: uint32) -> dict[str, Any]: return wallet_balance async def get_wallet_balance(self, request: dict[str, Any]) -> EndpointResult: - wallet_id = uint32(int(request["wallet_id"])) + wallet_id = uint32(request["wallet_id"]) wallet_balance = await self._get_wallet_balance(wallet_id) return {"wallet_balance": wallet_balance} async def get_wallet_balances(self, request: dict[str, Any]) -> EndpointResult: try: - wallet_ids: list[uint32] = [uint32(int(wallet_id)) for wallet_id in request["wallet_ids"]] + wallet_ids: list[uint32] = [uint32(wallet_id) for wallet_id in request["wallet_ids"]] except (TypeError, KeyError): wallet_ids = list(self.service.wallet_state_manager.wallets.keys()) wallet_balances: dict[uint32, dict[str, Any]] = {} @@ -1562,7 +1562,7 @@ async def get_next_address(self, request: dict[str, Any]) -> EndpointResult: create_new = True else: create_new = False - wallet_id = uint32(int(request["wallet_id"])) + wallet_id = uint32(request["wallet_id"]) wallet = self.service.wallet_state_manager.wallets[wallet_id] selected = self.service.config["selected_network"] prefix = self.service.config["network_overrides"]["config"][selected]["address_prefix"] diff --git a/chia/wallet/wallet_rpc_client.py b/chia/wallet/wallet_rpc_client.py index e4157c992c9b..b1c30ced85f1 100644 --- a/chia/wallet/wallet_rpc_client.py +++ b/chia/wallet/wallet_rpc_client.py @@ -708,7 +708,7 @@ async def cat_asset_id_to_name(self, asset_id: bytes32) -> Optional[tuple[Option except ValueError: return None - wallet_id: Optional[uint32] = None if res["wallet_id"] is None else uint32(int(res["wallet_id"])) + wallet_id: Optional[uint32] = None if res["wallet_id"] is None else uint32(res["wallet_id"]) return wallet_id, res["name"] async def get_cat_name(self, wallet_id: int) -> str: diff --git a/chia/wallet/wallet_state_manager.py b/chia/wallet/wallet_state_manager.py index 62f5e8f975af..d4e7035ee990 100644 --- a/chia/wallet/wallet_state_manager.py +++ b/chia/wallet/wallet_state_manager.py @@ -963,7 +963,7 @@ async def spend_clawback_coins( assert len(clawback_coins) > 0 coin_spends: list[CoinSpend] = [] message: bytes32 = std_hash(b"".join([c.name() for c in clawback_coins.keys()])) - now: uint64 = uint64(int(time.time())) + now: uint64 = uint64(time.time()) derivation_record: Optional[DerivationRecord] = None amount: uint64 = uint64(0) for coin, metadata in clawback_coins.items(): @@ -1878,7 +1878,7 @@ async def _add_coin_states( to_puzzle_hash=( await self.convert_puzzle_hash(wallet_identifier.id, to_puzzle_hash) ), - amount=uint64(int(amount)), + amount=uint64(amount), fee_amount=uint64(fee), confirmed=True, sent=uint32(0),