Skip to content

Classify onchain transactions#791

Open
tnull wants to merge 4 commits into
lightningdevkit:mainfrom
tnull:2026-02-track-onchain-tx-types
Open

Classify onchain transactions#791
tnull wants to merge 4 commits into
lightningdevkit:mainfrom
tnull:2026-02-track-onchain-tx-types

Conversation

@tnull

@tnull tnull commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes #447.

In #888 we started exposing TransactionType for funding-related transactions. Here, we continue that work and also classify the remaining transaction types so they are shown in the payment store.

@tnull tnull added this to the 0.8 milestone Feb 11, 2026
@tnull tnull self-assigned this Feb 11, 2026
@ldk-reviews-bot

ldk-reviews-bot commented Feb 11, 2026

Copy link
Copy Markdown

👋 Hi! This PR is now in draft status.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@tnull tnull marked this pull request as draft February 11, 2026 14:40
@tnull tnull moved this to Goal: Merge in Weekly Goals Feb 11, 2026
@tnull tnull changed the title 2026 02 track onchain tx types Classify onchain transactions Feb 11, 2026
Comment thread src/payment/store.rs
/// The confirmation status of this payment.
status: ConfirmationStatus,
/// The type of the on-chain transaction, if known.
tx_type: Option<TransactionType>,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, we should probably just default to Onchain if we don't know what it is.

Comment thread src/tx_broadcaster.rs Outdated
{
queue_sender: mpsc::Sender<Vec<Transaction>>,
queue_receiver: Mutex<mpsc::Receiver<Vec<Transaction>>>,
tx_types: std::sync::Mutex<HashMap<Txid, TransactionType>>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we broadcast the transaction but restart before the wallet syncs, won't we lose this data?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, we need to double-check whether we need to persist this. I think most channel-related transactions will be regenerated/rebroadcast after restart, but not sure if that would be the case for splice-related data?

jkczyz added a commit to jkczyz/ldk-node that referenced this pull request Jun 25, 2026
On-chain payment records don't capture what a transaction was for -- a
channel open, splice, close, sweep, or a plain send. Record that
classification on each on-chain payment, derived from the type LDK
reports when broadcasting the transaction, so it survives restarts
alongside the payment.

The tag keeps only which channels a transaction relates to; amounts and
fees stay on the payment. Existing records keep decoding unchanged.

Compatible with the on-chain transaction classification proposed in lightningdevkit#791.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jkczyz added a commit to jkczyz/ldk-node that referenced this pull request Jun 26, 2026
On-chain payment records don't capture what a transaction was for -- a
channel open, splice, close, sweep, or a plain send. Record that
classification on each on-chain payment, derived from the type LDK
reports when broadcasting the transaction, so it survives restarts
alongside the payment.

The tag keeps only which channels a transaction relates to; amounts and
fees stay on the payment. Existing records keep decoding unchanged.

Compatible with the on-chain transaction classification proposed in lightningdevkit#791.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jkczyz added a commit to jkczyz/ldk-node that referenced this pull request Jun 26, 2026
On-chain payment records don't capture what a transaction was for -- a
channel open, splice, close, sweep, or a plain send. Record that
classification on each on-chain payment, derived from the type LDK
reports when broadcasting the transaction, so it survives restarts
alongside the payment.

The tag keeps only which channels a transaction relates to; amounts and
fees stay on the payment. Existing records keep decoding unchanged.

Compatible with the on-chain transaction classification proposed in lightningdevkit#791.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tnull added 3 commits June 29, 2026 15:43
Use the receiver node for receive-side on-chain checks.

Co-Authored-By: HAL 9000
Avoid tagging ordinary wallet sends and rebroadcasts as LDK sweeps.

They should remain on-chain payments with no transaction type.

Co-Authored-By: HAL 9000
Keep known on-chain transaction types across wallet sync updates.

Co-Authored-By: HAL 9000
@tnull tnull force-pushed the 2026-02-track-onchain-tx-types branch from d0dfd93 to e487cdd Compare June 29, 2026 14:04
@tnull tnull requested a review from jkczyz June 29, 2026 14:06
@tnull tnull marked this pull request as ready for review June 29, 2026 14:06
Record close, claim, anchor-bump, and sweep broadcasts.

Wallet sync can then retain the LDK transaction type.

Co-Authored-By: HAL 9000
@tnull tnull force-pushed the 2026-02-track-onchain-tx-types branch from e487cdd to 811ddeb Compare June 29, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Goal: Merge

Development

Successfully merging this pull request may close these issues.

Create new PaymentKind variants for channel funding/closing on-chain transactions

3 participants