-
Notifications
You must be signed in to change notification settings - Fork 827
Move weight constants in the Weight
type
#1826
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
Conversation
54aff43
to
23ca71f
Compare
bitcoin/src/merkle_tree/block.rs
Outdated
@@ -276,7 +276,7 @@ impl PartialMerkleTree { | |||
return Err(NoTransactions); | |||
}; | |||
// check for excessively high numbers of transactions | |||
if self.num_transactions > MAX_BLOCK_WEIGHT / MIN_TRANSACTION_WEIGHT { | |||
if self.num_transactions as u64 > (Weight::MAX_BLOCK / Weight::MIN_TRANSACTION.to_wu()).to_wu() { |
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.
impl Div<Weight> for Weight
could have been useful here...
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.
Why it's not Weight::MAX_BLOCK.to_wu() / Weight::MIN_TRANSACTION.to_wu()
?
Anyway, I wouldn't mind having Div
since it properly returns unitless number but it might look a bit strange.
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.
Why it's not Weight::MAX_BLOCK.to_wu() / Weight::MIN_TRANSACTION.to_wu()?
Yeah that could have been better, I went for the Div impl in the latest version
deprecate constants::MAX_BLOCK_WEIGHT and constants::MIN_TRANSACTION_WEIGHT to nicely redirect users to the constants in the Weight type
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.
ACK fc7c251
Note that if we're doing |
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.
ACK fc7c251
ACK :) |
deprecate constants::MAX_BLOCK_WEIGHT and constants::MIN_TRANSACTION_WEIGHT to nicely redirect users to the constants in the Weight type