From bf7d6e31b1062ab5f90e14e83c56309f499fa2e9 Mon Sep 17 00:00:00 2001 From: Elliott Jin Date: Fri, 9 Oct 2020 08:50:44 -0700 Subject: [PATCH 1/2] RPC: getblock: tx fee calculation for verbosity 2 via Undo data Co-authored-by: Felix Weis --- src/core_io.h | 3 ++- src/core_write.cpp | 31 +++++++++++++++++++++++++++---- src/rpc/blockchain.cpp | 18 ++++++++++++------ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/core_io.h b/src/core_io.h index 80ec80cd50..e98fea3c0a 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -18,6 +18,7 @@ class CTransaction; struct CMutableTransaction; class uint256; class UniValue; +class CTxUndo; // core_read.cpp CScript ParseScript(const std::string& s); @@ -45,6 +46,6 @@ 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); +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 diff --git a/src/core_write.cpp b/src/core_write.cpp index 3980d8cb2e..675864200b 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -11,7 +11,9 @@ #include