mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Merge dce6f3b29b into merged_master (Bitcoin PR #18383)
This commit is contained in:
commit
ae4cac0cf4
2 changed files with 10 additions and 4 deletions
|
|
@ -9,6 +9,8 @@
|
|||
#include <tinyformat.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace Sidechain {
|
||||
namespace Bitcoin {
|
||||
|
||||
|
|
@ -87,10 +89,11 @@ CAmount CTransaction::GetValueOut() const
|
|||
{
|
||||
CAmount nValueOut = 0;
|
||||
for (const auto& tx_out : vout) {
|
||||
nValueOut += tx_out.nValue;
|
||||
if (!MoneyRange(tx_out.nValue) || !MoneyRange(nValueOut))
|
||||
if (!MoneyRange(tx_out.nValue) || !MoneyRange(nValueOut + tx_out.nValue))
|
||||
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||
nValueOut += tx_out.nValue;
|
||||
}
|
||||
assert(MoneyRange(nValueOut));
|
||||
return nValueOut;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
#include <tinyformat.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
bool g_con_elementsmode = false;
|
||||
|
||||
std::string COutPoint::ToString() const
|
||||
|
|
@ -128,11 +130,12 @@ CAmountMap CTransaction::GetValueOutMap() const {
|
|||
if (tx_out.nValue.IsExplicit() && tx_out.nAsset.IsExplicit()) {
|
||||
CAmountMap m;
|
||||
m[tx_out.nAsset.GetAsset()] = tx_out.nValue.GetAmount();
|
||||
values += m;
|
||||
if (!MoneyRange(tx_out.nValue.GetAmount()) || !MoneyRange(values[tx_out.nAsset.GetAsset()]))
|
||||
if (!MoneyRange(tx_out.nValue.GetAmount()) || !MoneyRange(values[tx_out.nAsset.GetAsset()] + tx_out.nValue.GetAmount()))
|
||||
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||
values += m;
|
||||
}
|
||||
}
|
||||
assert(MoneyRange(values));
|
||||
return values;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue