Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.h
Show First 20 Lines • Show All 342 Lines • ▼ Show 20 Lines | |||||
template <typename Tx> | template <typename Tx> | ||||
static inline CTransactionRef MakeTransactionRef(Tx &&txIn) { | static inline CTransactionRef MakeTransactionRef(Tx &&txIn) { | ||||
return std::make_shared<const CTransaction>(std::forward<Tx>(txIn)); | return std::make_shared<const CTransaction>(std::forward<Tx>(txIn)); | ||||
} | } | ||||
/** Compute the size of a transaction */ | /** Compute the size of a transaction */ | ||||
int64_t GetTransactionSize(const CTransaction &tx); | int64_t GetTransactionSize(const CTransaction &tx); | ||||
/** Precompute sighash midstate to avoid quadratic hashing */ | |||||
struct PrecomputedTransactionData { | |||||
uint256 hashPrevouts, hashSequence, hashOutputs; | |||||
PrecomputedTransactionData() | |||||
: hashPrevouts(), hashSequence(), hashOutputs() {} | |||||
PrecomputedTransactionData(const PrecomputedTransactionData &txdata) | |||||
: hashPrevouts(txdata.hashPrevouts), hashSequence(txdata.hashSequence), | |||||
hashOutputs(txdata.hashOutputs) {} | |||||
PrecomputedTransactionData(const CTransaction &tx); | |||||
}; | |||||
#endif // BITCOIN_PRIMITIVES_TRANSACTION_H | #endif // BITCOIN_PRIMITIVES_TRANSACTION_H |