-
Notifications
You must be signed in to change notification settings - Fork 7
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
Bugfix get list of payments does not search right range #1067
Bugfix get list of payments does not search right range #1067
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.
) | ||
|
||
return payments_list | ||
|
||
|
||
def get_first_block_from_timestamp(sci: SmartContractsInterface, timestamp: int) -> Block: |
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.
This function is almost the same as in BlocksHelper.get_first_block_after
, only marks greater or equal
in 73 and 78 lines are different. Is it necessary?
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.
it is, these marks are everything ;) In the long run we could make a PR in SCI
repo to move it there and extract some common code, but to fix problem in concent
, what's done here is enough
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.
issue: #1068
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.
Since timestamps are integers these two invocations are equivalent:
get_first_block_from_timestamp(ts) == get_first_block_after(ts - 1)
so this function is not necessary at all (nor any changes to SCI)
first_block_after_payment_number = get_first_block_from_timestamp(payment_interface, min_block_timestamp).number | ||
latest_block_number = payment_interface.get_block_number() | ||
if latest_block_number - first_block_after_payment_number < payment_interface.REQUIRED_CONFS: | ||
return [] |
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'm wondering if it won't be better that if this would be a variable?
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.
Will this ever change? What could actually cause this situation? Maybe exception is better then? And maybe logging?
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.
in short: an empty list should be returned
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.
Some clean up is needed.
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.
59787c1
to
7eacfa1
Compare
… for it Now the function returns only confirmed blocks, so if there are no suitable blocks, an empty list is returned.
36f6547
to
3aee642
Compare
resolves: #960