aboutsummaryrefslogtreecommitdiff
path: root/src/core_write.cpp
diff options
context:
space:
mode:
authorfyquah <fyquah@protonmail.com>2021-08-03 23:00:31 +0100
committerKiminuo <kiminuo@protonmail.com>2021-10-05 10:42:34 +0200
commit5c34507ecbbdc29c086276d1c62835b461823507 (patch)
tree905f27345cff2d61f7a3d433b82cddf3a08adf3c /src/core_write.cpp
parent8edf6204a87057a451160d1e61e79d8be112e81f (diff)
downloadbitcoin-5c34507ecbbdc29c086276d1c62835b461823507.tar.xz
core_write: Rename calculate_fee to have_undo for clarity
Diffstat (limited to 'src/core_write.cpp')
-rw-r--r--src/core_write.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core_write.cpp b/src/core_write.cpp
index d14a3f306b..468694b011 100644
--- a/src/core_write.cpp
+++ b/src/core_write.cpp
@@ -179,7 +179,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
// If available, use Undo data to calculate the fee. Note that txundo == nullptr
// for coinbase transactions and for transactions where undo data is unavailable.
- const bool calculate_fee = txundo != nullptr;
+ const bool have_undo = txundo != nullptr;
CAmount amt_total_in = 0;
CAmount amt_total_out = 0;
@@ -203,7 +203,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
}
in.pushKV("txinwitness", txinwitness);
}
- if (calculate_fee) {
+ if (have_undo) {
const Coin& prev_coin = txundo->vprevout[i];
const CTxOut& prev_txout = prev_coin.out;
@@ -245,13 +245,13 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
out.pushKV("scriptPubKey", o);
vout.push_back(out);
- if (calculate_fee) {
+ if (have_undo) {
amt_total_out += txout.nValue;
}
}
entry.pushKV("vout", vout);
- if (calculate_fee) {
+ if (have_undo) {
const CAmount fee = amt_total_in - amt_total_out;
CHECK_NONFATAL(MoneyRange(fee));
entry.pushKV("fee", ValueFromAmount(fee));