Skip to content

JDC needs token expiration logic #335

@plebhash

Description

@plebhash

as explained on option 3. of #299 (comment)

on #314 we introduced a FIFO queue of tokens into JDC

however, this leaves room for edge cases where empty mempool ends up in tokens being consumed in long intervals (where they might have already expired on JDS side)

so JDC should:

  • have a constant for TOKEN_TIMEOUT_SECS
  • keep track of each token allocation Instant
  • have some monitor task that iterates over all tokens and calls allocate_tokens when tokens have expired

note: #299 introduced this temporary workaround to JDS:

// see https://github.com/stratum-mining/sv2-apps/issues/335
const TEMPORARY_TIMEOUT_MULTIPLIER: u64 = 144;

/// Timeout for allocated tokens that haven't yet been activated.
/// Ideally 10 minutes, temporarily 24h. see https://github.com/stratum-mining/sv2-apps/issues/335
const ALLOCATED_TOKEN_TIMEOUT_SECS: u64 = TEMPORARY_TIMEOUT_MULTIPLIER * 60 * 10;

TEMPORARY_TIMEOUT_MULTIPLIER should be removed when this issue is closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo 📝

    Status

    Todo 📝

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions