Classify onchain transactions#791
Conversation
|
👋 Hi! This PR is now in draft status. |
| /// The confirmation status of this payment. | ||
| status: ConfirmationStatus, | ||
| /// The type of the on-chain transaction, if known. | ||
| tx_type: Option<TransactionType>, |
There was a problem hiding this comment.
Hmm, we should probably just default to Onchain if we don't know what it is.
| { | ||
| queue_sender: mpsc::Sender<Vec<Transaction>>, | ||
| queue_receiver: Mutex<mpsc::Receiver<Vec<Transaction>>>, | ||
| tx_types: std::sync::Mutex<HashMap<Txid, TransactionType>>, |
There was a problem hiding this comment.
If we broadcast the transaction but restart before the wallet syncs, won't we lose this data?
There was a problem hiding this comment.
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?
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>
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>
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>
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
d0dfd93 to
e487cdd
Compare
Record close, claim, anchor-bump, and sweep broadcasts. Wallet sync can then retain the LDK transaction type. Co-Authored-By: HAL 9000
e487cdd to
811ddeb
Compare
| self.broadcaster.broadcast_unclassified_transactions(vec![fee_bumped_tx]); | ||
|
|
||
| let pending_payment_store = | ||
| self.create_pending_payment_from_tx(new_payment.clone(), Vec::new()); | ||
|
|
||
| self.runtime | ||
| .block_on(self.pending_payment_store.insert_or_update(pending_payment_store))?; | ||
| self.runtime.block_on(self.payment_store.insert_or_update(new_payment))?; |
There was a problem hiding this comment.
Should we persist before broadcasting like we do for splices?
Fixes #447.
In #888 we started exposing
TransactionTypefor funding-related transactions. Here, we continue that work and also classify the remaining transaction types so they are shown in the payment store.