-
Notifications
You must be signed in to change notification settings - Fork 57
fix(consensus): more robust catch up sync #1646
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
Changes from all commits
335c902
1848884
5322cb3
f3472d1
ab14d35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,24 +24,22 @@ impl Validator<Transaction> for TransactionNetworkValidator { | |||||||||||||||||||||||||||||
| type Context = (); | ||||||||||||||||||||||||||||||
| type Error = TransactionValidationError; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| fn validate(&self, _context: &Self::Context, input: &Transaction) -> Result<(), Self::Error> { | ||||||||||||||||||||||||||||||
| match input { | ||||||||||||||||||||||||||||||
| Transaction::V1(tx) => { | ||||||||||||||||||||||||||||||
| let tx_network = Network::try_from(tx.network()).map_err(|error| Self::Error::UnknownNetwork { | ||||||||||||||||||||||||||||||
| byte: tx.network(), | ||||||||||||||||||||||||||||||
| details: error.to_string(), | ||||||||||||||||||||||||||||||
| })?; | ||||||||||||||||||||||||||||||
| if tx_network == self.network { | ||||||||||||||||||||||||||||||
| Ok(()) | ||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||
| warn!(target: LOG_TARGET, "TransactionNetworkValidator - FAIL: mismatching networks: TX: {} != Current: {}", tx_network, self.network); | ||||||||||||||||||||||||||||||
| Err(Self::Error::NetworkMismatch { | ||||||||||||||||||||||||||||||
| actual: self.network, | ||||||||||||||||||||||||||||||
| expected: tx_network, | ||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| fn validate(&self, _context: &Self::Context, tx: &Transaction) -> Result<(), Self::Error> { | ||||||||||||||||||||||||||||||
| let tx_network = | ||||||||||||||||||||||||||||||
| Network::try_from(tx.network()).map_err(|error| TransactionValidationError::UnknownNetwork { | ||||||||||||||||||||||||||||||
| byte: tx.network(), | ||||||||||||||||||||||||||||||
| details: error.to_string(), | ||||||||||||||||||||||||||||||
| })?; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if tx_network != self.network { | ||||||||||||||||||||||||||||||
| warn!(target: LOG_TARGET, "TransactionNetworkValidator - FAIL: mismatching networks: TX: {} != Current: {}", tx_network, self.network); | ||||||||||||||||||||||||||||||
| return Err(Self::Error::NetworkMismatch { | ||||||||||||||||||||||||||||||
| actual: self.network, | ||||||||||||||||||||||||||||||
| expected: tx_network, | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Comment on lines
+34
to
40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix swapped The
The warning message confirms this interpretation: Apply this diff to correct the field assignment: if tx_network != self.network {
warn!(target: LOG_TARGET, "TransactionNetworkValidator - FAIL: mismatching networks: TX: {} != Current: {}", tx_network, self.network);
return Err(Self::Error::NetworkMismatch {
- actual: self.network,
- expected: tx_network,
+ actual: tx_network,
+ expected: self.network,
});
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Ok(()) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
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.
Update the LOG_TARGET constant to reflect the renamed struct.
The LOG_TARGET still references
"is_shard_applicable"but the struct has been renamed toBasicValidations. This inconsistency could make debugging confusing.Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents