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.
This commit is contained in:
Ryan Ofsky committed 2023-10-20 10:30:16 -04:00
1 parent 4978754c00
commit 156f49d682
3 files changed
+8 -8

No files matched your search

+2 -4
View File
@@ -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))
{