19 str += prevout.ToString();
20 if (prevout.IsNull()) {
25 if (nSequence != SEQUENCE_FINAL) {
26 str +=
strprintf(
", nSequence=%u", nSequence);
33 return strprintf(
"CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue /
COIN,
35 HexStr(scriptPubKey).substr(0, 30));
39 : nVersion(
CTransaction::CURRENT_VERSION), nLockTime(0) {}
76 for (
const auto &tx_out :
vout) {
77 nValueOut += tx_out.nValue;
79 throw std::runtime_error(std::string(__func__) +
80 ": value out of range");
92 str +=
strprintf(
"CTransaction(txid=%s, ver=%d, vin.size=%u, vout.size=%u, " 96 for (
const auto &nVin :
vin) {
97 str +=
" " + nVin.ToString() +
"\n";
99 for (
const auto &nVout :
vout) {
100 str +=
" " + nVout.ToString() +
"\n";
static constexpr Amount zero()
TxId GetId() const
Compute the id and hash of this CMutableTransaction.
static uint256 ComputeCMutableTransactionHash(const CMutableTransaction &tx)
Amount GetValueOut() const
static constexpr Amount SATOSHI
std::vector< CTxOut > vout
std::string ToString() const
std::string ToString() const
std::string ToString() const
const uint256 hash
Memory only.
const std::vector< CTxIn > vin
size_t GetSerializeSize(const T &t, int nVersion=0)
bool MoneyRange(const Amount nValue)
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
static constexpr Amount COIN
A TxHash is the double sha256 hash of the full transaction data.
const std::vector< CTxOut > vout
std::string ToString() const
uint256 ComputeHash() const
A TxId is the identifier of a transaction.
static const int PROTOCOL_VERSION
network protocol versioning
CTransaction()
Construct a CTransaction that qualifies as IsNull()
std::string ToString() const
A mutable version of CTransaction.
std::string HexStr(const T itbegin, const T itend)
unsigned int GetTotalSize() const
Get the total transaction size in bytes.
The basic transaction that is broadcasted on the network and contained in blocks. ...