stallReasonText function

String stallReasonText(
  1. WalletLocalizations l10n,
  2. StallReason reason
)

Implementation

String stallReasonText(WalletLocalizations l10n, StallReason reason) {
  switch (reason) {
    case StallReason.endpointUnreachable:
      return l10n.walletStallEndpoint;
    case StallReason.torUnavailable:
      return l10n.walletStallTor;
    case StallReason.storageFull:
      return l10n.walletStallStorage;
    case StallReason.chainReorg:
      return l10n.walletStallReorg;
    case StallReason.internal:
      return l10n.walletStallInternal;
    // T0-1b: the server ANSWERED and the answer was wrong — the mirror image
    // of `internal`. Copy says "switch servers", never "check your
    // connection" (that is the endpoint arm) and never "restore" (internal).
    case StallReason.endpointMisbehaving:
      return l10n.walletStallEndpointMisbehaving;
    // T0-1c-R2: the wallet's starting height is above the chain as this
    // server reports it. The wallet cannot tell a behind server from a
    // starting height set above the real tip — and that height has TWO
    // producers, the birthday typed at restore and `rescan_from(Some(h))`
    // (§4n-review row 7), so the copy says "the starting block this wallet
    // is set to", never "you entered when restoring". It names both next
    // steps — check the height, or try another server — and never "check
    // your connection" or "restore".
    case StallReason.birthdayInFuture:
      return l10n.walletStallBirthdayInFuture;
    // R10: this device's storage was busy or briefly unreadable (a WAL race, a
    // locked iPhone) — transient, the store is intact, and the SDK retries.
    // Never "restore" (that is `internal`, a corrupt store) and never a
    // connection or server remedy.
    case StallReason.storageUnavailable:
      return l10n.walletStallStorageUnavailable;
    case StallReason.unknown:
      return l10n.walletStallUnknown;
  }
}