Feedback
Sign in./start

Site navigation

Theme

Learn

  • Roadmaps

Build

  • Projects
  • Developer Tools

Contribute

  • Open Source Projects
  • Issues
  • Reviews
  • First Contribution
  • BountiesSoon
  • Feedback

Prove

  • Builders

Ecosystem

  • Partners
  • Get Funded↗
  • HackathonsSoon
Sign in./start-building

Become an Open Source Builder. Learn. Build. Contribute. Prove.

Feedback welcome — open a GitHub issue.

Learn

RoadmapsStart Building

Build

ProjectsDeveloper Tools

Contribute

Open Source ProjectsIssuesReviewsFirst ContributionSupportFeedback

Prove

Builders Directory

Account

Sign in

Legal

PrivacyTermsCredits

© 2026 Pull // code MIT · curriculum CC BY-SA 4.0

PrivacyTermsCredits

lesson // lightning

Failure Handling

Handle payment failures, retries, and error propagation safely.

advanced5 days

Public lesson — sign in to track progress on this roadmap.

./sign-in

On this page

Learning objectives

  • Categorize permanent vs transient payment failures
  • Retry with updated pathfinding knowledge
  • Avoid unsafe refund UX mistakes

study // plan

Lessons are primers. Start with Step 1 (required reading) when present, then follow the numbered steps in the article. Depth comes from primary sources, labs, reflection, and evidence.

Research on Bitcoin Search

Step 1 // Required reading

Complete these before the numbered steps in the lesson body. Links are listed here once — not repeated below.

  • boltBOLT4 failure messages

Reflection prompts

  1. Explain Failure Handling to a teammate without jargon - what problem does it solve?
  2. What would break in production if you misunderstood Failure Handling?
  3. Which BOLT (or implementation doc) is the source of truth for this topic, and what did you verify there?

Lab // Failure triage

Complete Steps 2–3. Trigger or simulate a failed payment on Polar (wrong amount route, closed channel, or expired invoice). Classify transient vs permanent and write your retry policy.

evidence required

  • ·Failure evidence (error text, Polar UI, or simulated scenario notes)
  • ·Classification: transient vs permanent + retry yes/no
  • ·Idempotency note (payment hash / key) for merchant UX
  • ·Link to BOLT4 failures section you used
  1. 01

    Worked mental model

    Re-read the diagrams in this lesson once out loud in plain language. If you cannot explain the flow to a friend without jargon, pause and revisit the Mastering Bitcoin / Mastering Lightning chapters linked in Resources. Chapter references are intentional, not decorative.

  2. 02

    Hands-on habit

    Every protocol idea should be paired with one local experiment. That habit turns reading into builder instinct.

    1. Reproduce the happy path on regtest (or Polar for Lightning)
    2. Break it on purpose (wrong fee, expired invoice, offline peer)
    3. Write down what error you saw and which layer produced it (wallet, node, mempool, peer)
  3. 03

    Glossary check

    Pick three terms from this lesson and define them in one sentence each without opening notes. Weak definitions mean the lesson is not finished yet.

  4. 04

    Resource order

    Use Resources in order: narrative book chapter first, then BIP/BOLT for precision, then implementation docs for commands. Jumping straight to RPC flags without the mental model creates brittle knowledge.

Most Lightning payments fail at least once before succeeding. Good software treats failure as information, not as a dead end.

Complete Step 1 // Required reading in the study plan above, then continue here.

Step 2 — Core idea: transient vs permanent

Naive “try once and show error” UX makes Lightning feel broken. Smart retries with fee budgets make it feel instant.

ClassExamplesAction
TransientImbalance, unknown liquidity, tight feesUpdate scores / route; retry within budget
PermanentInvalid invoice, unknown peer, exhausted expiryStop; surface clear error

Loading diagram…

Parse errors, retry when sensible, stop when permanent.

Idempotency

Never double-charge a merchant because a retry raced a slow success. Key payments by payment hash / idempotency keys.

Done when: You can triage one failure into transient vs permanent without guessing.

Step 3 — Triage a failure (lab)

Cause or simulate a failure. Classify it. State retry policy and idempotency key.

Done when: Lab evidence (failure + classification + idempotency + source) is complete.

Next lesson

Lightning Attack Surface — congestion, probing, watchtowers, and CVE lessons.

further reading

  • bookMastering the Lightning Network

    Ch. 8: Routing failures context

  • articleBitcoin Optech: Payment reliability

progress // sign in

Reading is public. Sign in to mark lessons complete, sync across devices, and unlock your roadmap.

./sign-in-to-track

discussion

Discussion

prevMultipath PaymentsnextLightning Attack Surface

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.

No questions yet — be the first to ask.