37 return strprintf(
"CTxOut(nValue=%d.%02d, scriptPubKey=%s)",
nValue / xec,
43 : nVersion(
CTransaction::CURRENT_VERSION), nLockTime(0) {}
45 : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion),
46 nLockTime(tx.nLockTime) {}
69 : vin(), vout(), nVersion(
CTransaction::CURRENT_VERSION), nLockTime(0),
72 : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion),
73 nLockTime(tx.nLockTime), hash(ComputeHash()) {}
75 : vin(
std::move(tx.vin)), vout(
std::move(tx.vout)), nVersion(tx.nVersion),
76 nLockTime(tx.nLockTime), hash(ComputeHash()) {}
80 for (
const auto &tx_out :
vout) {
83 throw std::runtime_error(std::string(__func__) +
84 ": value out of range");
86 nValueOut += tx_out.nValue;
98 str +=
strprintf(
"CTransaction(txid=%s, ver=%d, vin.size=%u, vout.size=%u, "
102 for (
const auto &nVin :
vin) {
103 str +=
" " + nVin.ToString() +
"\n";
105 for (
const auto &nVout :
vout) {
106 str +=
" " + nVout.ToString() +
"\n";
bool MoneyRange(const Amount nValue)
static constexpr Amount SATOSHI
A mutable version of CTransaction.
TxId GetId() const
Compute the id and hash of this CMutableTransaction.
std::string ToString() const
The basic transaction that is broadcasted on the network and contained in blocks.
CTransaction()
Construct a CTransaction that qualifies as IsNull()
const std::vector< CTxOut > vout
uint256 ComputeHash() const
std::string ToString() const
unsigned int GetTotalSize() const
Get the total transaction size in bytes.
Amount GetValueOut() const
const std::vector< CTxIn > vin
static const uint32_t SEQUENCE_FINAL
Setting nSequence to this value for every input in a transaction disables nLockTime.
std::string ToString() const
std::string ToString() const
std::string ToString() const
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
Implement std::hash so RCUPtr can be used as a key for maps or sets.
static uint256 ComputeCMutableTransactionHash(const CMutableTransaction &tx)
size_t GetSerializeSize(const T &t, int nVersion=0)
static constexpr Amount zero() noexcept
A TxHash is the double sha256 hash of the full transaction data.
A TxId is the identifier of a transaction.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
static const int PROTOCOL_VERSION
network protocol versioning