#ifndef BITCOIN_SCRIPT_SOLVER_H
#define BITCOIN_SCRIPT_SOLVER_H
#include <attributes.h>
#include <script/script.h>
#include <span.h>
#include <string>
#include <optional>
#include <utility>
#include <vector>
class CPubKey;
enum class TxoutType {
NONSTANDARD,
ANCHOR, PUBKEY,
PUBKEYHASH,
SCRIPTHASH,
MULTISIG,
NULL_DATA, WITNESS_V0_SCRIPTHASH,
WITNESS_V0_KEYHASH,
WITNESS_V1_TAPROOT,
TX_BARE_DEFAULT_CHECKTEMPLATEVERIFY,
WITNESS_UNKNOWN, };
std::string GetTxnOutputType(TxoutType t);
constexpr bool IsPushdataOp(opcodetype opcode)
{
return opcode > OP_FALSE && opcode <= OP_PUSHDATA4;
}
TxoutType Solver(const CScript& scriptPubKey, std::vector<std::vector<unsigned char>>& vSolutionsRet);
CScript GetScriptForRawPubKey(const CPubKey& pubkey);
std::optional<std::pair<int, std::vector<std::span<const unsigned char>>>> MatchMultiA(const CScript& script LIFETIMEBOUND);
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
#endif