mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2025-01-08 10:25:24 +03:00
wallet: Refactor new_peak
in WalletStateManager
and PoolWallet
(#16262)
This commit is contained in:
parent
22b2a31374
commit
4ee7fe27be
@ -918,7 +918,7 @@ class PoolWallet:
|
||||
await self.publish_transactions(absorb_transaction, fee_tx)
|
||||
return absorb_transaction, fee_tx
|
||||
|
||||
async def new_peak(self, peak_height: uint64) -> None:
|
||||
async def new_peak(self, peak_height: uint32) -> None:
|
||||
# This gets called from the WalletStateManager whenever there is a new peak
|
||||
|
||||
pool_wallet_info: PoolWalletInfo = await self.get_current_state()
|
||||
|
@ -1095,7 +1095,7 @@ class WalletNode:
|
||||
await self.wallet_state_manager.blockchain.set_finished_sync_up_to(new_peak.height)
|
||||
# todo why do we call this if there was an exception / the sync is not finished
|
||||
async with self.wallet_state_manager.lock:
|
||||
await self.wallet_state_manager.new_peak(new_peak)
|
||||
await self.wallet_state_manager.new_peak(new_peak.height)
|
||||
|
||||
async def new_peak_from_trusted(
|
||||
self, new_peak_hb: HeaderBlock, latest_timestamp: uint64, peer: WSChiaConnection
|
||||
|
@ -24,7 +24,7 @@ from chia.pools.pool_puzzles import (
|
||||
solution_to_pool_state,
|
||||
)
|
||||
from chia.pools.pool_wallet import PoolWallet
|
||||
from chia.protocols.wallet_protocol import CoinState, NewPeakWallet
|
||||
from chia.protocols.wallet_protocol import CoinState
|
||||
from chia.rpc.rpc_server import StateChangedProtocol
|
||||
from chia.server.outbound_message import NodeType
|
||||
from chia.server.server import ChiaServer
|
||||
@ -2193,11 +2193,11 @@ class WalletStateManager:
|
||||
|
||||
return filtered
|
||||
|
||||
async def new_peak(self, peak: NewPeakWallet) -> None:
|
||||
async def new_peak(self, height: uint32) -> None:
|
||||
for wallet_id, wallet in self.wallets.items():
|
||||
if wallet.type() == WalletType.POOLING_WALLET:
|
||||
assert isinstance(wallet, PoolWallet)
|
||||
await wallet.new_peak(uint64(peak.height))
|
||||
await wallet.new_peak(height)
|
||||
current_time = int(time.time())
|
||||
|
||||
if self.wallet_node.last_wallet_tx_resend_time < current_time - self.wallet_node.wallet_tx_resend_timeout_secs:
|
||||
|
Loading…
Reference in New Issue
Block a user