20 TxInputStream(
int nTypeIn,
int nVersionIn,
const unsigned char *txTo,
size_t txToLen) :
22 m_version(nVersionIn),
27 void read(
char* pch,
size_t nSize)
29 if (nSize > m_remaining)
30 throw std::ios_base::failure(std::string(__func__) +
": end of data");
33 throw std::ios_base::failure(std::string(__func__) +
": bad destination buffer");
35 if (m_data ==
nullptr)
36 throw std::ios_base::failure(std::string(__func__) +
": bad source buffer");
38 memcpy(pch, m_data, nSize);
44 TxInputStream& operator>>(T& obj)
50 int GetVersion()
const {
return m_version; }
51 int GetType()
const {
return m_type; }
55 const unsigned char* m_data;
66 struct ECCryptoClosure
71 ECCryptoClosure instance_of_eccryptoclosure;
75 static bool verify_flags(
unsigned int flags)
80 static int verify_script(
const unsigned char *scriptPubKey,
unsigned int scriptPubKeyLen,
CAmount amount,
81 const unsigned char *txTo ,
unsigned int txToLen,
84 if (!verify_flags(flags)) {
88 TxInputStream stream(
SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
90 if (nIn >= tx.vin.size())
100 }
catch (
const std::exception&) {
106 const unsigned char *txTo ,
unsigned int txToLen,
110 return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, nIn, flags, err);
115 const unsigned char *txTo ,
unsigned int txToLen,
123 return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, nIn, flags, err);
int ravenconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, const unsigned char *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, ravenconsensus_error *err)
Returns 1 if the input nIn of the serialized transaction pointed to by txTo correctly spends the scri...
int ravenconsensus_verify_script_with_amount(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount, const unsigned char *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, ravenconsensus_error *err)
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
size_t GetSerializeSize(const T &t, int nType, int nVersion=0)
constexpr deserialize_type deserialize
int64_t CAmount
Amount in corbies (Can be negative)
Users of this module must hold an ECCVerifyHandle.
unsigned int ravenconsensus_version()
enum ravenconsensus_error_t ravenconsensus_error
Serialized script, used inside transaction inputs and outputs.
void * memcpy(void *a, const void *b, size_t c)
void Unserialize(Stream &s, char &a)
The basic transaction that is broadcasted on the network and contained in blocks. ...
#define RAVENCONSENSUS_API_VER