Skip to content

docs: expand concept docs and add comprehensive troubleshooting guide#74

Open
HappySonnyDev wants to merge 1 commit into
doc_2.0from
doc_wsy
Open

docs: expand concept docs and add comprehensive troubleshooting guide#74
HappySonnyDev wants to merge 1 commit into
doc_2.0from
doc_wsy

Conversation

@HappySonnyDev

Copy link
Copy Markdown
Collaborator
  • Expand unidirectional-channel.mdx with relay node setup, liquidity management, and payment flow details
  • Expand hold-invoice.mdx with full lifecycle, trust model, and settlement scenarios
  • Expand invoice-guide.mdx with creation parameters, payment flow, and status tracking
  • Expand payment-lifecycle.mdx with session/attempt model, fee budgeting, and error handling
  • Expand multi-hop.mdx with relay node operation, routing algorithm, and retry behavior
  • Expand trampoline-routing.mdx with two-level onion, feature negotiation, and constraints
  • Add payment, channel, invoice, and trampoline error sections to troubleshooting.mdx
  • Add TLC glossary entry and update glossary link path

- Expand unidirectional-channel.mdx with relay node setup, liquidity management, and payment flow details
- Expand hold-invoice.mdx with full lifecycle, trust model, and settlement scenarios
- Expand invoice-guide.mdx with creation parameters, payment flow, and status tracking
- Expand payment-lifecycle.mdx with session/attempt model, fee budgeting, and error handling
- Expand multi-hop.mdx with relay node operation, routing algorithm, and retry behavior
- Expand trampoline-routing.mdx with two-level onion, feature negotiation, and constraints
- Add payment, channel, invoice, and trampoline error sections to troubleshooting.mdx
- Add TLC glossary entry and update glossary link path
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fiber-docs Ready Ready Preview, Comment Jun 15, 2026 6:34am

Request Review


Or using `fnn-cli`:
<Callout>
The `funding_amount` is in **shannons** (1 CKB = 10⁸ shannons). By default, 99 CKB is reserved for the channel reserve (98 CKB minimum cell capacity + 1 CKB default shutdown fee), so the available balance for payments is `funding_amount - 99_00000000` shannons. This default can be adjusted via the `FIBER_AUTO_ACCEPT_CHANNEL_CKB_FUNDING_AMOUNT` environment variable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FIBER_AUTO_ACCEPT_CHANNEL_CKB_FUNDING_AMOUNT env var controls the auto-accept funding contribution, not the channel reserve itself.

"is_public": false,
"is_one_way": true,
"is_acceptor": false,
"state": { "state_name": "CHANNEL_READY" },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"state": { "state_name": "CHANNEL_READY" },
"state": { "state_name": "ChannelReady" },

| # | Field | Required | Size | Description |
|---|-------|----------|------|-------------|
| 1 | `timestamp` | Yes | 128 bits | Milliseconds since the UNIX epoch |
| 2 | `payment_hash` | Yes | 256 bits | Unique identifier of the invoice. Derived from `blake2b_256(preimage)` for hold invoices, or randomly generated for AMP invoices |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we specify that when neither payment_preimage nor payment_hash is supplied, Fiber generates a random preimage for a regular invoice; for hold invoices, the caller supplies payment_hash; the hash algorithm is ckb_hash by default unless sha256 is set?

| `TemporaryChannelFailure` | A channel temporarily lacks liquidity (retryable) |

A PaymentAttempt represents a single routing attempt for a portion of the payment amount. A PaymentSession can have one or more attempts (for multi-path payments).
The `last_error` and `last_error_code` fields on the session provide the most recent failure reason.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally, Fiber tracks last_error and last_error_code on PaymentSession, but the public RPC response exposes the latest failure message as failed_error.

2. A nested **trampoline onion packet** (embedded in the payment onion's custom records) encodes the trampoline hops and their instructions
3. Each trampoline node peels its layer, performs its own route-finding to the next trampoline node (or the final recipient), and forwards the payment

Trampoline routing is especially useful for mobile or light nodes that do not maintain a full network graph. The maximum number of trampoline hops is 5, and trampoline routing forces single-path (non-MPP) payments.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/nervosnetwork/fiber/blob/v0.8.1/crates/fiber-lib/src/fiber/payment.rs#L239-L241, should we say "MPP is only allowed with a single trampoline hop; multiple trampoline hops force single-path behavior."

- One or more attempts failed with retryable errors, and the retry limit has been reached.

**Solutions**:
- Check `last_error` on the payment to identify which attempt failed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, should we use failed_error here as that's the field from RPC output.


**Solutions**:
- Double-check that you are using the exact preimage that was used to compute the `payment_hash`.
- If generating preimages programmatically, verify the hash immediately after creation: `sha256(preimage) == payment_hash`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hardcoding sha256(preimage) here, can we use the invoice’s hash algorithm instead since the default is ckb_hash

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.

2 participants