diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-09-12 11:09:06 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-10-20 10:30:16 -0400 |
commit | 156f49d682ef025fb942c997a6c5475e18eef9cf (patch) | |
tree | d22691fc17ac7009e554237a41bbe738a569b457 /src/qt | |
parent | 4978754c0058bbdfbcd492f25fa49ef211e11d6e (diff) | |
download | bitcoin-156f49d682ef025fb942c997a6c5475e18eef9cf.tar.xz |
interfaces: Change getUnspentOutput return type to avoid multiprocess segfault
Coin serialize method segfaults if IsSpent condition is true. This caused
multiprocess code to segfault when serializing the Coin& output argument to of
the Node::getUnspentOutput method if the coin was not found. Segfault could be
triggered by double clicking and viewing transaction details in the GUI
transaction list.
Fix this by replacing Coin& output argument with optional<Coin> return value to
avoid trying to serializing spent coins.
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/transactiondesc.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index dae6a2dea9..34daa8493a 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -360,12 +360,10 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall { COutPoint prevout = txin.prevout; - Coin prev; - if(node.getUnspentOutput(prevout, prev)) - { + if (auto prev{node.getUnspentOutput(prevout)}) { { strHTML += "<li>"; - const CTxOut &vout = prev.out; + const CTxOut& vout = prev->out; CTxDestination address; if (ExtractDestination(vout.scriptPubKey, address)) { |