Skip to content

payer_proof: replace recursive DFS with iterative DFS#85

Merged
vincenzopalazzo merged 2 commits intomacros/proof-of-payment-bolt12-specfrom
pr-84-fixup
Apr 9, 2026
Merged

payer_proof: replace recursive DFS with iterative DFS#85
vincenzopalazzo merged 2 commits intomacros/proof-of-payment-bolt12-specfrom
pr-84-fixup

Conversation

@vincenzopalazzo
Copy link
Copy Markdown
Owner

Summary

  • Replaces recursive build_tree_dfs / reconstruct_dfs with iterative post-order DFS using an explicit DfsTask stack
  • Matches the iterative style used by root_hash() and the rest of the merkle code in the offers module
  • Same DFS post-order semantics — missing_hashes ordering is identical

Fixup for #84 (commit 3b77426).

Test plan

  • All 44 merkle + payer_proof tests pass
  • check_against_c_vectors passes against C test vectors

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b001c4025

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lightning/src/offers/payer_proof.rs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df52660453

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lightning/src/offers/payer_proof.rs
Don't require payer proof missing hashes to remain TLV-sorted now that the spec uses DFS traversal order.
Embed the latest payer proof vectors and keep the test harness aligned with the current unsigned builder and signing flow.
@vincenzopalazzo vincenzopalazzo merged commit 9f488d7 into macros/proof-of-payment-bolt12-spec Apr 9, 2026
@vincenzopalazzo vincenzopalazzo deleted the pr-84-fixup branch April 9, 2026 18:54
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