cd490905be
ce07638 doc: Add comment to use ValueFromAmount/AmountFromValue for JSON, not utilmoneystr (Wladimir J. van der Laan) ec05c50 rpc: Use ValueFromAmount instead of FormatMoney in TxToUniv (Wladimir J. van der Laan) 46347ad rpc: Move ValueFromAmount to core_write (Wladimir J. van der Laan) dac3782 doc: Correct AmountFromValue/ValueFromAmount names (Wladimir J. van der Laan) Pull request description: With this, the amounts returned in `decoderawtransaction` will be padded to 8 digits like anywhere else in the API. This is accomplished by using `ValueFromAmount` in `TxToUniv`, instead of `FormatMoney` which it currently (mistakingly) uses. The `FormatMoney` function is only for debugging/logging use! To avoid dependency issues, `ValueFromAmount` is moved to `core_write.cpp`, where it also fits better. I don't move `AmountFromValue` to `core_read.cpp` at the same time, as this would have more impact due to the RPCError dependency there. (n.b.: large number of changed files is solely due to the util_tests JSONs needing update) Tree-SHA512: 10fc2d27d33a77dbcb57aa7eccd4f53110c05d38eb7df6d40f10f14c08fad4274472e93af75aa59fe68ad0720fdf0930f0108124abef518e0dd162b3d2b2b292
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
// Copyright (c) 2009-2015 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 <string>
|
|
#include <vector>
|
|
|
|
class CBlock;
|
|
class CScript;
|
|
class CTransaction;
|
|
struct CMutableTransaction;
|
|
class uint256;
|
|
class UniValue;
|
|
|
|
struct CSpentIndexTxInfo;
|
|
|
|
// core_read.cpp
|
|
CScript ParseScript(const std::string& s);
|
|
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
|
|
bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx);
|
|
bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
|
uint256 ParseHashUV(const UniValue& v, const std::string& strName);
|
|
uint256 ParseHashStr(const std::string&, const std::string& strName);
|
|
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
|
|
|
|
// core_write.cpp
|
|
UniValue ValueFromAmount(const CAmount& amount);
|
|
std::string FormatScript(const CScript& script);
|
|
std::string EncodeHexTx(const CTransaction& tx);
|
|
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
|
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, const CSpentIndexTxInfo* ptxSpentInfo = nullptr);
|
|
|
|
#endif // BITCOIN_CORE_IO_H
|