<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>bolt5, branch HEAD</title>
<subtitle>On-chain transaction handling for Lightning (docs.ppad.tech/bolt5).
</subtitle>
<entry>
<id>56ce6c5246ce245dae96cd3a1d2af8fb538af01d</id>
<published>2026-04-19T04:58:39Z</published>
<updated>2026-04-19T04:58:39Z</updated>
<title type="text">test: add structural property tests</title>
<link rel="alternate" type="text/html" href="commit/56ce6c5246ce245dae96cd3a1d2af8fb538af01d.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 56ce6c5246ce245dae96cd3a1d2af8fb538af01d
parent 022e022a7106edc07d390c4d1d6a1249e94f2f57
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 19 Apr 2026 12:58:39 +0800

test: add structural property tests

Adds property tests for: output+fee=input conservation,
fee monotonicity in feerate, classify output count preservation,
spending tx version 2 invariant, and revoked nSequence invariant.

</content>
</entry>
<entry>
<id>022e022a7106edc07d390c4d1d6a1249e94f2f57</id>
<published>2026-04-19T04:56:59Z</published>
<updated>2026-04-19T04:56:59Z</updated>
<title type="text">test: add missing unit tests from review</title>
<link rel="alternate" type="text/html" href="commit/022e022a7106edc07d390c4d1d6a1249e94f2f57.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 022e022a7106edc07d390c4d1d6a1249e94f2f57
parent 32f758166843be8f40c47cb10c6697acfa2a6641
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 19 Apr 2026 12:56:59 +0800

test: add missing unit tests from review

Adds 11 new tests covering: extract_preimage_htlc_success wrong
length, anchor output classification, remote non-HTLC classification,
unmatched HTLC fallback to Resolved, spend_remote nSequence
without anchors, spend_remote_htlc_preimage nSequence,
spend_revoked_htlc_output structure, spend_revoked_batch single
element and mixed types, and fee underflow guards for
spend_to_local and spend_revoked_batch.

</content>
</entry>
<entry>
<id>32f758166843be8f40c47cb10c6697acfa2a6641</id>
<published>2026-04-19T04:54:30Z</published>
<updated>2026-04-19T04:54:30Z</updated>
<title type="text">lib: guard against fee underflow in spending functions</title>
<link rel="alternate" type="text/html" href="commit/32f758166843be8f40c47cb10c6697acfa2a6641.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 32f758166843be8f40c47cb10c6697acfa2a6641
parent decf50f48cfa23dc0194f2127b3a7adb78d09b55
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 19 Apr 2026 12:54:30 +0800

lib: guard against fee underflow in spending functions

All fee-deducting spending functions now return Maybe SpendingTx,
returning Nothing when the calculated fee would exceed the output
value. This prevents Word64 subtraction underflow that would
produce ~2^64 output values.

Functions affected: spend_to_local, spend_htlc_output,
spend_remote_htlc_timeout, spend_remote_htlc_preimage,
spend_revoked_to_local, spend_revoked_htlc_output,
spend_revoked_htlc (both branches), spend_revoked_batch.

Also adapts to bolt3 API renames (paymentPreimage, msatToSat,
paymentHash).

</content>
</entry>
<entry>
<id>decf50f48cfa23dc0194f2127b3a7adb78d09b55</id>
<published>2026-04-19T03:51:38Z</published>
<updated>2026-04-19T03:51:38Z</updated>
<title type="text">test: add coverage for HTLC, remote, revoked, and classify paths</title>
<link rel="alternate" type="text/html" href="commit/decf50f48cfa23dc0194f2127b3a7adb78d09b55.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit decf50f48cfa23dc0194f2127b3a7adb78d09b55
parent 511c35774810821a4edade9eda1720f82f25ce08
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 19 Apr 2026 11:51:38 +0800

test: add coverage for HTLC, remote, revoked, and classify paths

- identify_close: local match, remote match, no match
- classify_local_commit_outputs: to_local/to_remote, HTLC outputs,
  empty commitment
- classify_remote_commit_outputs: HTLC direction mapping
- classify_revoked_commit_outputs: revoke and RevokeHTLC variants
- spend_htlc_timeout / spend_htlc_success: basic structure and
  SIGHASH_SINGLE_ANYONECANPAY with anchor channels
- spend_remote_htlc_timeout / spend_remote_htlc_preimage: structure,
  fee deduction, locktime, anchor nSequence
- spend_revoked_htlc: offered, received, and invalid OutputType
  (now returns Nothing)

Test count: 24 -&gt; 43.

</content>
</entry>
<entry>
<id>511c35774810821a4edade9eda1720f82f25ce08</id>
<published>2026-04-19T03:45:56Z</published>
<updated>2026-04-19T03:45:56Z</updated>
<title type="text">test, bench: adapt to NonEmpty PenaltyContext change</title>
<link rel="alternate" type="text/html" href="commit/511c35774810821a4edade9eda1720f82f25ce08.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 511c35774810821a4edade9eda1720f82f25ce08
parent bed23d8069d89e15e2497fd52905f24a11029c50
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 19 Apr 2026 11:45:56 +0800

test, bench: adapt to NonEmpty PenaltyContext change

</content>
</entry>
<entry>
<id>bed23d8069d89e15e2497fd52905f24a11029c50</id>
<published>2026-04-19T03:45:51Z</published>
<updated>2026-04-19T03:45:51Z</updated>
<title type="text">lib: address review findings</title>
<link rel="alternate" type="text/html" href="commit/bed23d8069d89e15e2497fd52905f24a11029c50.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit bed23d8069d89e15e2497fd52905f24a11029c50
parent ead7cd3dff620c87d31f68bd7eed91929cda213a
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 19 Apr 2026 11:45:51 +0800

lib: address review findings

- PenaltyContext.pc_outputs now uses NonEmpty, eliminating the
  error partial in spend_revoked_batch
- spend_revoked_htlc returns Maybe SpendingTx instead of silently
  producing a malformed tx for non-HTLC output types
- identify_close: remove 5 unused parameters and update haddock
  to reflect actual behavior (byte comparison only)
- Remove unused SpendSecondStage constructor from OutputResolution
- Clean up redundant import in Spend.hs

</content>
</entry>
<entry>
<id>ead7cd3dff620c87d31f68bd7eed91929cda213a</id>
<published>2026-04-18T14:32:17Z</published>
<updated>2026-04-18T14:32:35Z</updated>
<title type="text">readme: add examples</title>
<link rel="alternate" type="text/html" href="commit/ead7cd3dff620c87d31f68bd7eed91929cda213a.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit ead7cd3dff620c87d31f68bd7eed91929cda213a
parent 3aab0abbd9add2eb3df508f3f3a142cae268318c
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 22:32:17 +0800

readme: add examples

</content>
</entry>
<entry>
<id>3aab0abbd9add2eb3df508f3f3a142cae268318c</id>
<published>2026-04-18T13:58:37Z</published>
<updated>2026-04-18T13:58:37Z</updated>
<title type="text">lib: adapt to bolt3 API changes (encode_tx_for_signing -&gt; Maybe)</title>
<link rel="alternate" type="text/html" href="commit/3aab0abbd9add2eb3df508f3f3a142cae268318c.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 3aab0abbd9add2eb3df508f3f3a142cae268318c
parent 5e2409b2cd44b7a62ff47ba9a4fd76e7d43537fe
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 21:58:37 +0800

lib: adapt to bolt3 API changes (encode_tx_for_signing -&gt; Maybe)

Use BT.txid via commitment_to_tx for commitment_txid, eliminating
manual SHA256 double-hashing and the &#39;error&#39; partial. Update
identify_close and classify_* functions for Maybe returns.

</content>
</entry>
<entry>
<id>5e2409b2cd44b7a62ff47ba9a4fd76e7d43537fe</id>
<published>2026-04-18T13:16:11Z</published>
<updated>2026-04-18T13:16:11Z</updated>
<title type="text">meta: additional docs</title>
<link rel="alternate" type="text/html" href="commit/5e2409b2cd44b7a62ff47ba9a4fd76e7d43537fe.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 5e2409b2cd44b7a62ff47ba9a4fd76e7d43537fe
parent 897e5397e0818a9014ba6f4ba2e29df8788a0295
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 21:16:11 +0800

meta: additional docs

</content>
</entry>
<entry>
<id>897e5397e0818a9014ba6f4ba2e29df8788a0295</id>
<published>2026-04-18T13:15:27Z</published>
<updated>2026-04-18T13:15:27Z</updated>
<title type="text">Add criterion and weigh benchmarks</title>
<link rel="alternate" type="text/html" href="commit/897e5397e0818a9014ba6f4ba2e29df8788a0295.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 897e5397e0818a9014ba6f4ba2e29df8788a0295
parent e1594651e67c02a83079506762b019fb4fe42218
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 21:15:27 +0800

Add criterion and weigh benchmarks

Criterion benchmarks for spend_to_local, spend_revoked_to_local,
spend_anchor_owner, spend_revoked_batch (10/100/483 outputs),
spending_fee, and htlc_timed_out.

Weigh allocation benchmarks for spend_to_local,
spend_anchor_owner, and spend_revoked_batch (10/100/483 outputs).

Both suites include orphan NFData instances for bolt3 and bolt5
types needed by criterion&#39;s nf and weigh&#39;s func.

</content>
</entry>
<entry>
<id>e1594651e67c02a83079506762b019fb4fe42218</id>
<published>2026-04-18T13:15:05Z</published>
<updated>2026-04-18T13:15:05Z</updated>
<title type="text">Add test suite for BOLT5</title>
<link rel="alternate" type="text/html" href="commit/e1594651e67c02a83079506762b019fb4fe42218.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit e1594651e67c02a83079506762b019fb4fe42218
parent 4c3db40f6b442b2c3d49354cc3d54e91c5e33f68
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 21:15:05 +0800

Add test suite for BOLT5

24 tests covering types, detection, spending, weights, and
properties. Unit tests for spending_fee calculation, weight
constants, preimage extraction, HTLC timeout detection, and
all spending tx constructors (structure, fee deduction,
nSequence, sighash type, batch inputs). Property tests for
spending_fee non-negativity, spend_to_local fee correctness,
and htlc_timed_out monotonicity.

</content>
</entry>
<entry>
<id>4c3db40f6b442b2c3d49354cc3d54e91c5e33f68</id>
<published>2026-04-18T13:14:53Z</published>
<updated>2026-04-18T13:14:53Z</updated>
<title type="text">Implement BOLT5 library: types, detection, and spending</title>
<link rel="alternate" type="text/html" href="commit/4c3db40f6b442b2c3d49354cc3d54e91c5e33f68.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 4c3db40f6b442b2c3d49354cc3d54e91c5e33f68
parent 8f31b418d0ca16e20b59bb393c700bf309453ea0
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 21:14:53 +0800

Implement BOLT5 library: types, detection, and spending

Types.hs: CloseType, UnresolvedOutput, OutputResolution,
SpendingTx, PenaltyContext. Weight constants from Appendix A
(penalty witness/input weights, base tx weight, max standard
weight). Fee calculation via spending_fee.

Detect.hs: identify_close for classifying on-chain closes.
classify_local_commit_outputs, classify_remote_commit_outputs,
classify_revoked_commit_outputs for output resolution.
extract_preimage_offered and extract_preimage_htlc_success for
preimage extraction from witnesses. htlc_timed_out for CLTV
checks.

Spend.hs: Spending transaction constructors for all close
scenarios. Local commitment: spend_to_local (CSV-delayed),
spend_htlc_timeout, spend_htlc_success, spend_htlc_output.
Remote commitment: spend_remote_htlc_timeout,
spend_remote_htlc_preimage. Revoked commitment:
spend_revoked_to_local, spend_revoked_htlc,
spend_revoked_htlc_output, spend_revoked_batch. Anchor:
spend_anchor_owner, spend_anchor_anyone.

BOLT5.hs: Re-export module for the full public API.

Stateless, pure-function design. Produces unsigned SpendingTx
values; caller signs and assembles witnesses via bolt3.

</content>
</entry>
<entry>
<id>8f31b418d0ca16e20b59bb393c700bf309453ea0</id>
<published>2026-04-18T13:14:35Z</published>
<updated>2026-04-18T13:14:35Z</updated>
<title type="text">Add bolt3, tx, and transitive deps to flake and cabal</title>
<link rel="alternate" type="text/html" href="commit/8f31b418d0ca16e20b59bb393c700bf309453ea0.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 8f31b418d0ca16e20b59bb393c700bf309453ea0
parent 73ab65c86cae1a9a8cebaec9045ef291cc91f50e
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 21:14:35 +0800

Add bolt3, tx, and transitive deps to flake and cabal

Add ppad-bolt3, ppad-tx, ppad-sha256, ppad-secp256k1, and
ppad-ripemd160 as flake inputs with proper follows references.
Update cabal build-depends for the library (ppad-bolt3,
ppad-sha256, ppad-tx), test suite (ppad-bolt3, ppad-tx,
tasty-quickcheck, QuickCheck), and benchmarks (ppad-bolt3,
ppad-tx).

Add BOLT5.Detect, BOLT5.Spend, BOLT5.Types to exposed-modules.

</content>
</entry>
<entry>
<id>73ab65c86cae1a9a8cebaec9045ef291cc91f50e</id>
<published>2026-01-25T06:45:15Z</published>
<updated>2026-01-25T06:45:15Z</updated>
<title type="text">Initial project skeleton for ppad-bolt5</title>
<link rel="alternate" type="text/html" href="commit/73ab65c86cae1a9a8cebaec9045ef291cc91f50e.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 73ab65c86cae1a9a8cebaec9045ef291cc91f50e
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 10:45:15 +0400

Initial project skeleton for ppad-bolt5

Set up BOLT #5 (on-chain transaction handling) implementation structure:
- lib/Lightning/Protocol/BOLT5.hs with placeholder module
- test/Main.hs with tasty test suite skeleton
- bench/Main.hs and bench/Weight.hs for benchmarks
- flake.nix with minimal dependencies
- etc/05-onchain.md with BOLT5 specification

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
</feed>
