Fix/bech32 address handling#1059
Merged
seanPhill merged 4 commits intoJun 20, 2026
Merged
Conversation
…ent crash on bv1q addresses
…bounds crash on mixed RingCT/basecoin transactions
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.
Fix bech32 (bv1q) address handling crashes in GUI and RPC
Summary
Fixes a Qt GUI crash triggered when viewing transactions involving
bv1qbech32 basecoin addresses in mixed-output transactions. Confirmed on current master. Also fixes incorrect bech32 address detection and defensive handling forboost::getinlistunspent.How it was found
While testing the
feature/auto-ct-to-ringctbranch, receiving basecoin to abv1qaddress via mixed-output transactions (RingCT input → basecoin + RingCT outputs) caused the Qt GUI to crash on launch. The crash was reproduced on unfixed master (v1.4.2.99) opening the wallet with the offending transaction present triggers an immediate crash.Crash log (unfixed master)
Assertion failed: (false), function forced_return, file boost/variant/detail/forced_return.hpp, line 45. abort ./veil-qtRoot cause
Several functions incorrectly assume basecoin addresses will always be legacy or P2SH format, but
getnewbasecoinaddressdefaults to bech32 (DEFAULT_ADDRESS_TYPE = OutputType::BECH32). Whenbv1qaddresses appear in mixed-output transactions, three things break:decomposeTransactionchecked forCScriptID(P2SH) instead ofWitnessV0KeyHash/WitnessV0ScriptHashboost::get<CScriptID>(address)inlistunspentuses the value form which throws an exception on non-P2SH addresses instead of the safe pointer formtxout_addressandtxout_is_minevectors go out of sync on non-RTX transactions with mixed output types, causing out-of-bounds accessTrigger conditions
bv1qbech32 addressWhy it wasn't reported sooner
Unclear.
DEFAULT_ADDRESS_TYPEisBECH32, so all wallets generatebv1qaddresses by default. However, the crash only triggers on mixed-output transactions, not plain basecoin receives. Cross-type transactions like zerocoin spends to basecoin or faucet payouts are less common, which likely limited exposure.Fixes
3f954a5transactionrecord.cppWitnessV0KeyHash/WitnessV0ScriptHashinstead ofCScriptID523d097transactionrecord.cppnOutindex32732a1rpcwallet.cppboost::get<CScriptID>to prevent exception on non-P2SH addresses inlistunspentc475419wallet.cpptxout_addressin sync withtxout_is_mineto prevent out-of-bounds crash on mixed-output transactionsTesting
listunspentvia daemongetbalancesRelated Issues
Likely fixes #1046 (stuck basecoin UTXO from RingCT→basecoin faucet payout). The symptoms described; wrong address displayed in GUI, UTXO missing from
listunspentand Coin Control despite showing ingetbalancesmatch thetxout_address/txout_is_minevector desync fixed in this PR. The original issue documents a faucet payout from RingCT to abv1qbasecoin address, the exact same trigger condition confirmed here.