42 : nVersion(
CTransaction::CURRENT_VERSION), nLockTime(0) {}
44 : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion),
45 nLockTime(tx.nLockTime) {}
68 : vin(), vout(), nVersion(
CTransaction::CURRENT_VERSION), nLockTime(0),
71 : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion),
72 nLockTime(tx.nLockTime), hash(ComputeHash()) {}
74 : vin(std::move(tx.vin)), vout(std::move(tx.vout)), nVersion(tx.nVersion),
75 nLockTime(tx.nLockTime), hash(ComputeHash()) {}
79 for (
const auto &tx_out :
vout) {
82 throw std::runtime_error(std::string(__func__) +
83 ": value out of range");
85 nValueOut += tx_out.nValue;
97 str +=
strprintf(
"CTransaction(txid=%s, ver=%d, vin.size=%u, vout.size=%u, "
101 for (
const auto &nVin :
vin) {
102 str +=
" " + nVin.ToString() +
"\n";
104 for (
const auto &nVout :
vout) {
105 str +=
" " + nVout.ToString() +
"\n";
bool MoneyRange(const Amount nValue)
static constexpr Amount SATOSHI
static constexpr Amount COIN
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.
static uint256 ComputeCMutableTransactionHash(const CMutableTransaction &tx)
size_t GetSerializeSize(const T &t, int nVersion=0)
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
static constexpr Amount zero()
A TxHash is the double sha256 hash of the full transaction data.
A TxId is the identifier of a transaction.
static const int PROTOCOL_VERSION
network protocol versioning