Skip to content

Use current timestamp in invoice preimage#256

Closed
t-bast wants to merge 1 commit into
masterfrom
timestamp-preimage
Closed

Use current timestamp in invoice preimage#256
t-bast wants to merge 1 commit into
masterfrom
timestamp-preimage

Conversation

@t-bast

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

Copy link
Copy Markdown
Member

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

t-bast commented May 4, 2021

Copy link
Copy Markdown
Member Author

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