Repository navigation
diverted funding vout bypass: test hook + fix - #50
Merged
Merged
Conversation
Add SKIP_COMMITMENT_COLORING_FOR_DIR (gated on _rln_test_hooks): a node whose ldk_data_dir matches leaves its commitments uncolored instead of coloring them. It models a malicious funder that does not honestly color its commitment transactions, so it does not panic on a funding output it deliberately left without the channel's assets. No-op unless the flag is set, so other tests are unaffected.
_accept_transfer hardcoded funding_vout = 1, so the acceptor validated the funding consignment against vout 1 whatever output the channel was actually built on. An honest funding does put the funding output at vout 1, after rgb-lib's OP_RETURN, but the funder builds the funding transaction and so chooses: it could seal the channel's assets to its own output at vout 1 and leave the real 2-of-2 elsewhere. The acceptor then credited the channel with assets its funding output did not hold, and panicked coloring its first commitment, which spends that output. The panic needed nothing but a funding_created, so it landed before the funding transaction was broadcast, and the credited amount was persisted first, making it reachable again on restart. Pass msg.funding_output_index through handle_funding instead, so the assets are validated on the same outpoint the commitments spend. LDK already checks, once the funding transaction confirms, that the output at that index is the expected 2-of-2 for the expected value, and a channel cannot become usable before then.
zoedberg
force-pushed
the
test/diverted-funding-vout-bypass
branch
from
November 9, 2026 16:15
ee033d1 to
63864f8
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.
No description provided.