-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TransactionsHandle propagation commands should not adhere to caching #12079
TransactionsHandle propagation commands should not adhere to caching #12079
Conversation
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.
cool, functionally this is correct.
only have style nits
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
enum CachePolicy { | ||
IgnoreCache, | ||
RespectCache, | ||
} |
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'd like to rename this slightly to something like
enum PropgateKind {
/// Default propgation mode, filters out txs that we already sent or received
Basic,
/// Always propagate, even if we already sent or received the txs.
Forced,
}
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.
ah, I see we already have an enum that is used with that name.
we need a new enum just for this, with the two variants. this should not change the existing enum
@mattsse done, Created a new enum |
9f31bdc
to
7f297b8
Compare
1e1a2ae
to
452e053
Compare
Closes #12033
Description:
This pull request addresses the issue where manual propagation commands in
TransactionsHandle
were adhering to caching, preventing forced broadcasts. The following changes have been made:Added
PropgateKind
Enum:Introduced a
PropagateKind
enum with variantsBasic
andForced
to control caching behavior during transaction propagation.Modified Propagation Methods:
Updated methods such as
propagate_full_transactions_to_peer
,propagate_hashes_to
, andpropagate_transactions
to accept aPropgateKind
parameter.Updated Manual Propagation Commands:
In the
on_command
method, manual propagation commands now usePropgateKind::Basic
to bypass the cache, allowing forced broadcasts.Ensured Regular Propagation Respects Cache:
Regular propagation commands continue to use
PropgateKind::Forced
, maintaining the caching mechanism to optimize network usage.Updated Tests:
Modified existing tests and added new ones to cover scenarios with both cache policies, ensuring that the caching behavior is as expected.
@mattsse Please review the changes and let me know if any adjustments are needed.