Skip to content

Use current timestamp in invoice preimage #256

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

Closed
wants to merge 1 commit into from
Closed

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Apr 21, 2021

In case our random number generator completely fails, we may end up generating the same payment preimage for unrelated payments.

To mitigate that, we use the current time at the end of the preimage.
This still leaves at least 192 bits of randomness which is more than enough.

NB: wallets who want to leverage this (e.g. Phoenix) will need to call this new function instead of randomBytes32() when generating an invoice.

In case our random number generator completely fails, we may end up
generating the same payment preimage for unrelated payments.

To mitigate that, we use the current time at the end of the preimage.
This still leaves at least 192 bits of randomness which is more than enough.
@t-bast t-bast requested review from sstone and dpad85 April 21, 2021 07:35
@t-bast
Copy link
Member Author

t-bast commented May 4, 2021

Closing in favor of #258

We don't want our preimages to look different from other wallet's preimages, because it would give intermediate node information about the recipient.

@t-bast t-bast closed this May 4, 2021
@t-bast t-bast deleted the timestamp-preimage branch May 4, 2021 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant