Lender creates timelock#208
Merged
Merged
Conversation
af02337 to
dfbb53c
Compare
This comment has been minimized.
This comment has been minimized.
bonomat
reviewed
Aug 2, 2021
bonomat
reviewed
Aug 2, 2021
|
|
||
| // calculate the absolute timelock from the loan term | ||
| let current_height = self.elementsd.get_blockcount().await?; | ||
| let term_in_minutes = payload.term * 24 * 60; |
Member
There was a problem hiding this comment.
I think the loan term should be a unix timestamp. Nothing to do in this PR but I recorded it here: comit-network/baru#41
Member
Author
As stated above: Sometimes it does, sometimes it does not. Repay is unstable but was not touched, so I think it has been unstable all along. |
Member
Author
|
Member
Author
Member
Instead of calculating the absolute timelock and serving it in the loan offer, we use relative term in days in the offer and calculate the actual timelock upon loan request.
This should help us to see more deterministic logs upon repay because the UTXOs that are skipped should always be in the same order. An unordered vec does not cause (known) bugs, but the log output can be confusing. Since this sorting should not be expensive we put it in.
a958f84 to
3ca9232
Compare
Time is hard and u32 for timestamp does not help 😅
With the timelock represented as Unix timestamp (in seconds since the epoch) we also have to filter for loans to liquidate using a Unix timestamp of the current time.
29b84d4 to
fd5131a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of calculating the absolute timelock for the loan offer (which would mean that it already "declines" while the user is still chosing a loan) we use relative loan term in days and the absolute timelock is calculated by the lender upon loan request. The borrower has to check that the timelock is as expected when signing the loan (has to check anyway).
includes upgrading to baru
0.2:)fixes #220