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; }
54 const unsigned char* m_data;
65 struct ECCryptoClosure
70 ECCryptoClosure instance_of_eccryptoclosure;
74 static bool verify_flags(
unsigned int flags)
79 static int verify_script(
const unsigned char *scriptPubKey,
unsigned int scriptPubKeyLen,
CAmount amount,
80 const unsigned char *txTo ,
unsigned int txToLen,
83 if (!verify_flags(flags)) {
87 TxInputStream stream(
SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
89 if (nIn >= tx.vin.size())
99 }
catch (
const std::exception&) {
105 const unsigned char *txTo ,
unsigned int txToLen,
109 return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, nIn, flags, err);
114 const unsigned char *txTo ,
unsigned int txToLen,
122 return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, nIn, flags, err);
unsigned int fabcoinconsensus_version()
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
bool read(const std::string &s, Value &value)
enum fabcoinconsensus_error_t fabcoinconsensus_error
int64_t CAmount
Amount in lius (Can be negative)
Users of this module must hold an ECCVerifyHandle.
int fabcoinconsensus_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, fabcoinconsensus_error *err)
int fabcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, const unsigned char *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, fabcoinconsensus_error *err)
Returns 1 if the input nIn of the serialized transaction pointed to by txTo correctly spends the scri...
#define FABCOINCONSENSUS_API_VER
Serialized script, used inside transaction inputs and outputs.
void * memcpy(void *a, const void *b, size_t c)
std::istream & operator>>(std::istream &in, Integer &a)
void Unserialize(Stream &s, char &a)
The basic transaction that is broadcasted on the network and contained in blocks. ...