19 TxInputStream(
int nTypeIn,
int nVersionIn,
const unsigned char *txTo,
size_t txToLen) :
21 m_version(nVersionIn),
26 void read(
char* pch,
size_t nSize)
28 if (nSize > m_remaining)
29 throw std::ios_base::failure(std::string(__func__) +
": end of data");
32 throw std::ios_base::failure(std::string(__func__) +
": bad destination buffer");
34 if (m_data ==
nullptr)
35 throw std::ios_base::failure(std::string(__func__) +
": bad source buffer");
37 memcpy(pch, m_data, nSize);
49 int GetVersion()
const {
return m_version; }
50 int GetType()
const {
return m_type; }
55 const unsigned char* m_data;
66 struct ECCryptoClosure
71 ECCryptoClosure instance_of_eccryptoclosure;
76 const unsigned char *txTo ,
unsigned int txToLen,
80 TxInputStream stream(
SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
82 if (nIn >= tx.
vin.size())
92 }
catch (
const std::exception&) {
const CBigNum operator>>(const CBigNum &a, unsigned int shift)
unsigned int bitcoinconsensus_version()
int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, const unsigned char *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...
enum bitcoinconsensus_error_t bitcoinconsensus_error
@ bitcoinconsensus_ERR_OK
@ bitcoinconsensus_ERR_TX_DESERIALIZE
@ bitcoinconsensus_ERR_TX_INDEX
@ 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.
SigVersion GetRequiredSigVersion() const
Users of this module must hold an ECCVerifyHandle.
void * memcpy(void *a, const void *b, size_t c)
#define T(expected, seed, data)
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptError *serror)
unsigned int GetSerializeSize(const std::array< T, N > &item)
array
constexpr deserialize_type deserialize
void Unserialize(Stream &s, char &a)