Skip to content

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 dpad85 and sstone 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.

2 participants