24 if (
dst.size() > m_remaining) {
25 throw std::ios_base::failure(std::string(
__func__) +
29 if (
dst.data() ==
nullptr) {
30 throw std::ios_base::failure(std::string(
__func__) +
31 ": bad destination buffer");
34 if (m_data ==
nullptr) {
35 throw std::ios_base::failure(std::string(
__func__) +
36 ": bad source buffer");
40 m_remaining -=
dst.size();
44 template <
typename T> TxInputStream &operator>>(T &&
obj) {
49 int GetVersion()
const {
return m_version; }
50 int GetType()
const {
return m_type; }
68struct ECCryptoClosure {
83 unsigned int nIn,
unsigned int flags,
91 if (nIn >= tx.
vin.size()) {
104 tx.
vin[nIn].scriptSig,
107 }
catch (
const std::exception &) {
125 unsigned int nIn,
unsigned int flags,
static constexpr Amount SATOSHI
static bool verify_flags(unsigned int flags)
Check that all specified flags are part of the libconsensus interface.
unsigned int bitcoinconsensus_version()
int bitcoinconsensus_verify_script(const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen, const uint8_t *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error *err)
Returns 1 if the input nIn of the serialized transaction pointed to by txTo correctly spends the scri...
int bitcoinconsensus_verify_script_with_amount(const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount, const uint8_t *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error *err)
static int verify_script(const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen, Amount amount, const uint8_t *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error *err)
enum bitcoinconsensus_error_t bitcoinconsensus_error
@ bitcoinconsensus_SCRIPT_ENABLE_SIGHASH_FORKID
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS_DEPRECATED
@ bitcoinconsensus_ERR_OK
@ bitcoinconsensus_ERR_TX_DESERIALIZE
@ bitcoinconsensus_ERR_AMOUNT_REQUIRED
@ bitcoinconsensus_ERR_TX_INDEX
@ bitcoinconsensus_ERR_INVALID_FLAGS
@ bitcoinconsensus_ERR_TX_SIZE_MISMATCH
#define BITCOINCONSENSUS_API_VER
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxIn > vin
Users of this module must hold an ECCVerifyHandle.
A Span is an object that can refer to a contiguous sequence of objects.
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metricsOut, ScriptError *serror)
Execute an unlocking and locking script together.
GenericTransactionSignatureChecker< CTransaction > TransactionSignatureChecker
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
constexpr deserialize_type deserialize
void Unserialize(Stream &, char)=delete
size_t GetSerializeSize(const T &t, int nVersion=0)
static constexpr Amount zero() noexcept
Precompute sighash midstate to avoid quadratic hashing.
static const int PROTOCOL_VERSION
network protocol versioning