Repository navigation
fix(rgb): settle RGB on justice sweeps and color both commitment views - #56
Open
ABallarini wants to merge 1 commit into
Open
ABallarini wants to merge 1 commit into
ABallarini wants to merge 1 commit into
Conversation
ABallarini
force-pushed
the
fix/penalty-tx
branch
from
October 19, 2026 09:40
9047b9d to
4c4de07
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Justice (penalty) sweeps now carry the channel's RGB state transition, so the RGB assigned to a revoked commitment settles for the honest peer instead of being burned, and every node colors both commitment views of each state, so whichever commitment is broadcast, both nodes hold its allocation.
color_claim(new): colors the justice transaction with the RGB of the revoked vouts it actually spends, reading the{txid}_transfer_infoof every transaction it spends (inputs grouped by spent txid); a zero-value RGB OP_RETURN is appended before signing and accounted for inpackage_weight. Inputs without transfer info are logged and excluded; the transaction is left uncolored only when nothing is loadable or the total is zero. The claim's transfer info is published to the KVStore (RGB_TRANSFER_INFO_NS) in addition to the file, so the daemon's sweeper, which detects RGB outputs from the KVStore, picks the justice output up and settles the RGB.ldk_data_dirandrgb_kv_storeare threaded through the monitor intoOnchainTxHandler(viaReadableArgs, never serialized, monitor bytes unchanged) so the justice path can reach the transfer info and build the RGB wallet at claim time.color_commitment/color_closing: rgb-lib errors map toChannelError::closeinstead of panicking; allchannel.rscall sites handle the result (?, logged abort, or logged skip, fail-closed via the signature check).{colored_txid}_transfer_infomarks the identical transition as already consumed (state rebuild); the duplicateconsume_fasciais skipped.Verified end-to-end by the companion rgb-lightning-node PR (penalty E2E, two stages: the honest party holding 0 or 100 RGB at the revoked state): the justice tx is colored through the new plumbing and the RGB settles via the daemon's prepared-sweep flow.
Documentation: https://hackmd.io/@6IaNVzsDRAeobScrx7A32A/ByoCXc12fe