Unverified Commit 368a7389 authored by Victor Shyba's avatar Victor Shyba Committed by kay kurokawa
Browse files

refactor getValueForClaim, fix off by one error in the conditional statement...

refactor getValueForClaim, fix off by one error in the conditional statement that could cause segfault
parent 7c3ef9b6
......@@ -77,7 +77,7 @@ UniValue getclaimsintrie(const UniValue& params, bool fHelp)
__func__, itClaims->outPoint.hash.GetHex());
claim.push_back(Pair("error", "No value found for claim"));
}
else if (coin->vout.size() < itClaims->outPoint.n || coin->vout[itClaims->outPoint.n].IsNull())
else if (!coin->IsAvailable(itClaims->outPoint.n))
{
LogPrintf("%s: the specified txout of %s appears to have been spent\n", __func__, itClaims->outPoint.hash.GetHex());
claim.push_back(Pair("error", "Txout spent"));
......@@ -153,7 +153,7 @@ bool getValueForClaim(const COutPoint& out, std::string& sValue)
__func__, out.hash.GetHex());
return true;
}
if (coin->vout.size() < out.n || coin->vout[out.n].IsNull())
if(!coin->IsAvailable(out.n))
{
LogPrintf("%s: the specified txout of %s appears to have been spent\n", __func__, out.hash.GetHex());
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment