mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
66d012ad7ftest: RPC: getblock fee calculations (Elliott Jin)bf7d6e31b1RPC: getblock: tx fee calculation for verbosity 2 via Undo data (Elliott Jin) Pull request description: This change is progress towards #18771 . It adapts the fee calculation part of #16083 and addresses some feedback. The additional "verbosity level 3" features are planned for a future PR. **Original PR description:** > Using block undo data (like in #14802) we can now show fee information for each transaction in a block without the need for additional -txindex and/or a ton of costly lookups. For a start we'll add transaction fee information to getblock verbosity level 2. This comes at a negligible speed penalty (<1%). ACKs for top commit: luke-jr: tACK66d012ad7ffjahr: tACK66d012ad7fMarcoFalke: review ACK66d012ad7f🗜 Tree-SHA512: be1fe4b866946a8dc36427f7dc72a20e10860e320a28fa49bc85bd2a93a0d699768179be29fa52e18b2ed8505d3ec272e586753ef2239b4230e0aefd233acaa2
52 lines
1.9 KiB
C++
52 lines
1.9 KiB
C++
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_CORE_IO_H
|
|
#define BITCOIN_CORE_IO_H
|
|
|
|
#include <amount.h>
|
|
#include <attributes.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class CBlock;
|
|
class CBlockHeader;
|
|
class CScript;
|
|
class CTransaction;
|
|
struct CMutableTransaction;
|
|
class uint256;
|
|
class UniValue;
|
|
class CTxUndo;
|
|
|
|
// core_read.cpp
|
|
CScript ParseScript(const std::string& s);
|
|
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
|
|
[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);
|
|
[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
|
bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
|
|
|
|
/**
|
|
* Parse a hex string into 256 bits
|
|
* @param[in] strHex a hex-formatted, 64-character string
|
|
* @param[out] result the result of the parasing
|
|
* @returns true if successful, false if not
|
|
*
|
|
* @see ParseHashV for an RPC-oriented version of this
|
|
*/
|
|
bool ParseHashStr(const std::string& strHex, uint256& result);
|
|
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
|
|
int ParseSighashString(const UniValue& sighash);
|
|
|
|
// core_write.cpp
|
|
UniValue ValueFromAmount(const CAmount& amount);
|
|
std::string FormatScript(const CScript& script);
|
|
std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
|
|
std::string SighashToStr(unsigned char sighash_type);
|
|
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
|
void ScriptToUniv(const CScript& script, UniValue& out, bool include_address);
|
|
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr);
|
|
|
|
#endif // BITCOIN_CORE_IO_H
|