-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ms.wallet refactor #10146
Ms.wallet refactor #10146
Conversation
# Conflicts: # chia/wallet/wallet_node.py # chia/wallet/wallet_state_manager.py
This pull request introduces 1 alert when merging 9adfe90 into 3b16013 - view on LGTM.com new alerts:
|
final_coin_state: List[CoinState] = [] | ||
for coin_state_entry in all_coins_state: | ||
if coin_state_entry.spent_height is not None: | ||
if coin_state_entry.spent_height <= fork_height: | ||
final_coin_state.append(coin_state_entry) | ||
elif coin_state_entry.created_height is not None: | ||
if coin_state_entry.created_height <= fork_height: | ||
final_coin_state.append(coin_state_entry) | ||
return final_coin_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the function is called filter_foo
, why not use filter
:^)
I think this is
def accept(coin_state):
sh = coin_state.spent_height
if sh is not None:
return sh <= fork_height
ch = coin_state.created_height
return ch is not None and ch <= fork_height
return list(filter(accept, all_coins_state))
(And I said this before, but I think half of the list casts in the code base are unnecessary.)
This pull request introduces 1 alert when merging 9091b7d into 3b16013 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging a0e7346 into 419f88f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging de68b58 into 419f88f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 532c6c5 into 419f88f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging cecd4fa into 419f88f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging fa140c7 into 419f88f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 4fa85c9 into 231ef6f - view on LGTM.com new alerts:
|
@@ -364,8 +364,7 @@ async def get_coin_state_by_ids( | |||
self, | |||
include_spent_coins: bool, | |||
coin_ids: List[bytes32], | |||
start_height: uint32 = uint32(0), | |||
end_height: uint32 = uint32((2 ** 32) - 1), | |||
min_height: uint32 = uint32(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice there's no unit test for this function, in tests/core/full_node/test_coin_store.py
. It would be good to have one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, yes that would be good considering it's in the coin store.
This pull request introduces 2 alerts when merging 7a612e3 into 231ef6f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 2ee4143 into 231ef6f - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 0af30de into e479586 - view on LGTM.com new alerts:
|
peak = self.blockchain.get_peak() | ||
if len(coin_states) > 0 and fork_height is not None: | ||
await self.update_wallets(peak.height, fork_height, peak.header_hash, coin_states) | ||
await self.send_peak_to_wallets() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change the order of state update <-> new peak messages ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but only in the case where the full node is syncing up, which is not the usual case. It was wrong before, it should be first the new state then the new_peak_wallet
@@ -23,11 +23,11 @@ async def test_too_many_messages(self): | |||
# Too many messages | |||
r = RateLimiter(incoming=True) | |||
new_tx_message = make_msg(ProtocolMessageTypes.new_transaction, bytes([1] * 40)) | |||
for i in range(3000): | |||
for i in range(4900): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to the rest of the changes in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it is not, it was just a flaky test that needed a fix.
This is a significant change in how syncing works in the wallet. It is now organized as a queue where one of four things can get processed at once:
The subscriptions are prioritized to ensure we don't miss data. State updates are cached by header hash (not height) and reorgs are now processed correctly. Many different bugs and race conditions are fixed by this change. Also, there is a performance improvement in untrusted sync.
A full node bug in coin store is also fixed (affected wallet protocol), where the min height was not being looked up correctly.
TODO: