Skip to content

Commit

Permalink
Fix get block rpc for verbosity level 3
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Aug 30, 2023
1 parent 11f8b41 commit 7dc943c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, 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 have_undo = txundo != nullptr && !tx.IsCoinStake();
const bool have_undo = txundo != nullptr;
CAmount amt_total_in = 0;
CAmount amt_total_out = 0;

Expand Down Expand Up @@ -219,7 +219,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
ScriptToUniv(prev_txout.scriptPubKey, /*out=*/o_script_pub_key, /*include_hex=*/true, /*include_address=*/true);

UniValue p(UniValue::VOBJ);
p.pushKV("generated", bool(prev_coin.fCoinBase));
p.pushKV("generated", bool(prev_coin.fCoinBase || prev_coin.fCoinStake));
p.pushKV("height", uint64_t(prev_coin.nHeight));
p.pushKV("value", ValueFromAmount(prev_txout.nValue));
p.pushKV("scriptPubKey", o_script_pub_key);
Expand Down Expand Up @@ -251,7 +251,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
}
entry.pushKV("vout", vout);

if (have_undo) {
if (have_undo && !tx.IsCoinStake()) {
const CAmount fee = amt_total_in - amt_total_out;
CHECK_NONFATAL(MoneyRange(fee));
entry.pushKV("fee", ValueFromAmount(fee));
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ const RPCResult getblock_vin{
{RPCResult::Type::ELISION, "", "The same output as verbosity = 2"},
{RPCResult::Type::OBJ, "prevout", "(Only if undo information is available)",
{
{RPCResult::Type::BOOL, "generated", "Coinbase or not"},
{RPCResult::Type::BOOL, "generated", "Coinbase or not, coinstake or not"},
{RPCResult::Type::NUM, "height", "The height of the prevout"},
{RPCResult::Type::STR_AMOUNT, "value", "The value in " + CURRENCY_UNIT},
{RPCResult::Type::OBJ, "scriptPubKey", "",
Expand Down

0 comments on commit 7dc943c

Please sign in to comment.