Skip to content

make RGB PSBT construction linear in the number of inputs - #18

Merged
zoedberg merged 2 commits into
masterfrom
next
Nov 3, 2026
Merged

zoedberg merged 2 commits into
masterfrom
next

Conversation

@zoedberg

@zoedberg zoedberg commented Nov 3, 2026

Copy link
Copy Markdown
Member

No description provided.

@zoedberg
zoedberg requested a review from St333p November 3, 2026 10:59
@zoedberg zoedberg self-assigned this Nov 3, 2026
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread psbt/src/lib.rs Resolved
Comment thread psbt/src/lib.rs Resolved
push_rgb_transition set each input's consumer separately, deserializing
and re-serializing the contract's whole consumer map every time, which is
quadratic in the number of inputs: with u16 inputs it takes hours.
Pushing transitions one by one is quadratic in their number too:
spending a UTXO with u16 allocations, each moved by its own one-input
transition, takes well over 15 minutes.

Add push_rgb_transitions, which checks a whole batch in memory and then
reads and writes each contract's consumers once, decoding each
transition already present once; on any error, a double spend included,
the PSBT is left unchanged. It returns the number of new transitions.
push_rgb_transition and rgb_embed now go through it.
rgb_bundles decoded a transition from the PSBT once per input it spends,
which is quadratic in the number of inputs: committing a transition with
u16 inputs took hours.
@zoedberg
zoedberg merged commit 4922e50 into master Nov 3, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants