Skip to content

Randomize PendingHTLCsForwardable::time_forwardable internally #1101

Open
@TheBlueMatt

Description

@TheBlueMatt

Prior to having a generic "get random value" API in the KeysInterface, we'd simply documented that the user should ranomize PendingHTLCsForwardable's forwardable time themselves. However, we shouldn't push that complexity onto users if we can avoid it, and since we now have a random bytes source, we can do it internally. This would involve simply taking a byte or 2 bytes at a time out of a buffer refilled from KeysInterface::get_secure_random_bytes when it runs out and multiplying time_forwardable by those bytes as u8/16, then dividing to get them back into the *(1-5) range, or so.

When we do that, we can probably skip the randomization in the on-reload forwardable event generation, see #1076 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions