16typedef std::vector<unsigned char>
valtype;
98 pubkeys.emplace_back(std::move(data));
102 if (pubkeys.size() !=
static_cast<unsigned long>(*
num_keys))
return false;
104 return (it + 1 ==
script.end());
109 std::vector<std::span<const unsigned char>>
keyspans;
116 while (
script.end() - it >= 34) {
117 if (*it != 32)
return {};
128 std::vector<unsigned char> data;
130 if (it ==
script.end())
return {};
133 if (it !=
script.end())
return {};
135 if (!threshold)
return {};
138 return std::pair{*threshold, std::move(
keyspans)};
189 std::vector<unsigned char> data;
201 std::vector<std::vector<unsigned char>> keys;
205 vSolutionsRet.push_back({
static_cast<unsigned char>(keys.size())});
223 for (
const CPubKey& key : keys)
std::vector< unsigned char > valtype
An encapsulated public key.
static constexpr unsigned int COMPRESSED_SIZE
static constexpr unsigned int SIZE
secp256k1:
static bool ValidSize(const std::vector< unsigned char > &vch)
Serialized script, used inside transaction inputs and outputs.
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
bool IsPayToScriptHash() const
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
bool IsPayToAnchor() const
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
static constexpr size_t WITNESS_V0_KEYHASH_SIZE
static constexpr size_t WITNESS_V0_SCRIPTHASH_SIZE
Signature hash sizes.
static constexpr size_t WITNESS_V1_TAPROOT_SIZE
bool CheckMinimalPush(const std::vector< unsigned char > &data, opcodetype opcode)
opcodetype
Script opcodes.
static constexpr unsigned int MAX_PUBKEYS_PER_MULTI_A
The limit of keys in OP_CHECKSIGADD-based scripts.
static const int MAX_PUBKEYS_PER_MULTISIG
std::vector< unsigned char > ToByteVector(const T &in)
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
static bool MatchPayToPubkeyHash(const CScript &script, valtype &pubkeyhash)
static constexpr bool IsSmallInteger(opcodetype opcode)
Test for "small positive integer" script opcodes - OP_1 through OP_16.
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
std::vector< unsigned char > valtype
std::string GetTxnOutputType(TxoutType t)
Get the name of a TxoutType as a string.
std::optional< std::pair< int, std::vector< std::span< const unsigned char > > > > MatchMultiA(const CScript &script)
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
static std::optional< int > GetScriptNumber(opcodetype opcode, valtype data, int min, int max)
Retrieve a minimally-encoded number in range [min,max] from an (opcode, data) pair,...
static bool MatchMultisig(const CScript &script, int &required_sigs, std::vector< valtype > &pubkeys)
static bool MatchPayToPubkey(const CScript &script, valtype &pubkey)
constexpr bool IsPushdataOp(opcodetype opcode)
@ WITNESS_UNKNOWN
Only for Witness versions not already defined above.
@ ANCHOR
anyone can spend script
@ NULL_DATA
unspendable OP_RETURN script that carries data
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.