crate::ix!();
pub const MAX_SCRIPT_ELEMENT_SIZE: usize = 520;
pub const MAX_OPS_PER_SCRIPT: usize = 201;
pub const MAX_PUBKEYS_PER_MULTISIG: usize = 20;
pub const MAX_SCRIPT_SIZE: usize = 10000;
pub const MAX_STACK_SIZE: usize = 1000;
pub const LOCKTIME_THRESHOLD: u32 = 500000000;
pub const LOCKTIME_MAX: u32 = 0xFFFFFFFF;
pub const ANNEX_TAG: u32 = 0x50;
pub const VALIDATION_WEIGHT_PER_SIGOP_PASSED: u64 = 50;
pub const VALIDATION_WEIGHT_OFFSET: u64 = 50;
pub fn to_byte_vector<T>(in_: &T) -> Vec<u8> {
todo!();
}
pub type OpcodeType = u8;
pub mod opcode_type
{
pub const OP_0: u8 = 0x00;
pub const OP_FALSE: u8 = OP_0;
pub const OP_PUSHDATA1: u8 = 0x4c;
pub const OP_PUSHDATA2: u8 = 0x4d;
pub const OP_PUSHDATA4: u8 = 0x4e;
pub const OP_1NEGATE: u8 = 0x4f;
pub const OP_RESERVED: u8 = 0x50;
pub const OP_1: u8 = 0x51;
pub const OP_TRUE: u8 = OP_1;
pub const OP_2: u8 = 0x52;
pub const OP_3: u8 = 0x53;
pub const OP_4: u8 = 0x54;
pub const OP_5: u8 = 0x55;
pub const OP_6: u8 = 0x56;
pub const OP_7: u8 = 0x57;
pub const OP_8: u8 = 0x58;
pub const OP_9: u8 = 0x59;
pub const OP_10: u8 = 0x5a;
pub const OP_11: u8 = 0x5b;
pub const OP_12: u8 = 0x5c;
pub const OP_13: u8 = 0x5d;
pub const OP_14: u8 = 0x5e;
pub const OP_15: u8 = 0x5f;
pub const OP_16: u8 = 0x60;
pub const OP_NOP: u8 = 0x61;
pub const OP_VER: u8 = 0x62;
pub const OP_IF: u8 = 0x63;
pub const OP_NOTIF: u8 = 0x64;
pub const OP_VERIF: u8 = 0x65;
pub const OP_VERNOTIF: u8 = 0x66;
pub const OP_ELSE: u8 = 0x67;
pub const OP_ENDIF: u8 = 0x68;
pub const OP_VERIFY: u8 = 0x69;
pub const OP_RETURN: u8 = 0x6a;
pub const OP_TOALTSTACK: u8 = 0x6b;
pub const OP_FROMALTSTACK: u8 = 0x6c;
pub const OP_2DROP: u8 = 0x6d;
pub const OP_2DUP: u8 = 0x6e;
pub const OP_3DUP: u8 = 0x6f;
pub const OP_2OVER: u8 = 0x70;
pub const OP_2ROT: u8 = 0x71;
pub const OP_2SWAP: u8 = 0x72;
pub const OP_IFDUP: u8 = 0x73;
pub const OP_DEPTH: u8 = 0x74;
pub const OP_DROP: u8 = 0x75;
pub const OP_DUP: u8 = 0x76;
pub const OP_NIP: u8 = 0x77;
pub const OP_OVER: u8 = 0x78;
pub const OP_PICK: u8 = 0x79;
pub const OP_ROLL: u8 = 0x7a;
pub const OP_ROT: u8 = 0x7b;
pub const OP_SWAP: u8 = 0x7c;
pub const OP_TUCK: u8 = 0x7d;
pub const OP_CAT: u8 = 0x7e;
pub const OP_SUBSTR: u8 = 0x7f;
pub const OP_LEFT: u8 = 0x80;
pub const OP_RIGHT: u8 = 0x81;
pub const OP_SIZE: u8 = 0x82;
pub const OP_INVERT: u8 = 0x83;
pub const OP_AND: u8 = 0x84;
pub const OP_OR: u8 = 0x85;
pub const OP_XOR: u8 = 0x86;
pub const OP_EQUAL: u8 = 0x87;
pub const OP_EQUALVERIFY: u8 = 0x88;
pub const OP_RESERVED1: u8 = 0x89;
pub const OP_RESERVED2: u8 = 0x8a;
pub const OP_1ADD: u8 = 0x8b;
pub const OP_1SUB: u8 = 0x8c;
pub const OP_2MUL: u8 = 0x8d;
pub const OP_2DIV: u8 = 0x8e;
pub const OP_NEGATE: u8 = 0x8f;
pub const OP_ABS: u8 = 0x90;
pub const OP_NOT: u8 = 0x91;
pub const OP_0NOTEQUAL: u8 = 0x92;
pub const OP_ADD: u8 = 0x93;
pub const OP_SUB: u8 = 0x94;
pub const OP_MUL: u8 = 0x95;
pub const OP_DIV: u8 = 0x96;
pub const OP_MOD: u8 = 0x97;
pub const OP_LSHIFT: u8 = 0x98;
pub const OP_RSHIFT: u8 = 0x99;
pub const OP_BOOLAND: u8 = 0x9a;
pub const OP_BOOLOR: u8 = 0x9b;
pub const OP_NUMEQUAL: u8 = 0x9c;
pub const OP_NUMEQUALVERIFY: u8 = 0x9d;
pub const OP_NUMNOTEQUAL: u8 = 0x9e;
pub const OP_LESSTHAN: u8 = 0x9f;
pub const OP_GREATERTHAN: u8 = 0xa0;
pub const OP_LESSTHANOREQUAL: u8 = 0xa1;
pub const OP_GREATERTHANOREQUAL: u8 = 0xa2;
pub const OP_MIN: u8 = 0xa3;
pub const OP_MAX: u8 = 0xa4;
pub const OP_WITHIN: u8 = 0xa5;
pub const OP_RIPEMD160: u8 = 0xa6;
pub const OP_SHA1: u8 = 0xa7;
pub const OP_SHA256: u8 = 0xa8;
pub const OP_HASH160: u8 = 0xa9;
pub const OP_HASH256: u8 = 0xaa;
pub const OP_CODESEPARATOR: u8 = 0xab;
pub const OP_CHECKSIG: u8 = 0xac;
pub const OP_CHECKSIGVERIFY: u8 = 0xad;
pub const OP_CHECKMULTISIG: u8 = 0xae;
pub const OP_CHECKMULTISIGVERIFY: u8 = 0xaf;
pub const OP_NOP1: u8 = 0xb0;
pub const OP_CHECKLOCKTIMEVERIFY: u8 = 0xb1;
pub const OP_NOP2: u8 = OP_CHECKLOCKTIMEVERIFY;
pub const OP_CHECKSEQUENCEVERIFY: u8 = 0xb2;
pub const OP_NOP3: u8 = OP_CHECKSEQUENCEVERIFY;
pub const OP_NOP4: u8 = 0xb3;
pub const OP_NOP5: u8 = 0xb4;
pub const OP_NOP6: u8 = 0xb5;
pub const OP_NOP7: u8 = 0xb6;
pub const OP_NOP8: u8 = 0xb7;
pub const OP_NOP9: u8 = 0xb8;
pub const OP_NOP10: u8 = 0xb9;
pub const OP_CHECKSIGADD: u8 = 0xba;
pub const OP_INVALIDOPCODE: u8 = 0xff;
}
pub const MAX_OPCODE: u32 = opcode_type::OP_NOP10 as u32;
pub struct ScriptNumError { }
impl RuntimeErrorInterface for ScriptNumError {}
impl From<&String> for ScriptNumError {
fn from(str_: &String) -> Self {
todo!();
}
}
pub struct ScriptNum {
value: i64,
}
pub mod script_num {
pub const N_DEFAULT_MAX_NUM_SIZE: usize = 4;
}
impl PartialEq<i64> for ScriptNum {
fn eq(&self, other: &i64) -> bool {
todo!();
}
}
impl PartialOrd<i64> for ScriptNum {
fn partial_cmp(&self, other: &i64) -> Option<Ordering> {
Some(self.value.cmp(other))
}
}
impl PartialEq<ScriptNum> for ScriptNum {
fn eq(&self, other: &ScriptNum) -> bool {
todo!();
}
}
impl Eq for ScriptNum {}
impl Ord for ScriptNum {
fn cmp(&self, other: &ScriptNum) -> Ordering {
todo!();
}
}
impl PartialOrd<ScriptNum> for ScriptNum {
fn partial_cmp(&self, other: &ScriptNum) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Add<i64> for ScriptNum {
type Output = ScriptNum;
fn add(self, other: i64) -> Self::Output {
todo!();
}
}
impl Sub<i64> for ScriptNum {
type Output = ScriptNum;
fn sub(self, other: i64) -> Self::Output {
todo!();
}
}
impl Add<&ScriptNum> for ScriptNum {
type Output = ScriptNum;
fn add(self, other: &ScriptNum) -> Self::Output {
todo!();
}
}
impl Sub<&ScriptNum> for ScriptNum {
type Output = ScriptNum;
fn sub(self, other: &ScriptNum) -> Self::Output {
todo!();
}
}
impl AddAssign<&ScriptNum> for ScriptNum {
fn add_assign(&mut self, other: &ScriptNum) {
todo!();
}
}
impl SubAssign<&ScriptNum> for ScriptNum {
fn sub_assign(&mut self, other: &ScriptNum) {
todo!();
}
}
impl BitAnd<i64> for ScriptNum {
type Output = ScriptNum;
fn bitand(self, other: i64) -> Self::Output {
todo!();
}
}
impl BitAnd<&ScriptNum> for ScriptNum {
type Output = ScriptNum;
fn bitand(self, other: &ScriptNum) -> Self::Output {
todo!();
}
}
impl BitAndAssign<&ScriptNum> for ScriptNum {
fn bitand_assign(&mut self, rhs: &ScriptNum) {
todo!();
}
}
impl Neg for ScriptNum {
type Output = Self;
fn neg(self) -> Self::Output {
todo!();
}
}
impl ScriptNum {
#[inline] pub fn assign_from(&mut self, rhs: &i64) -> &mut ScriptNum {
todo!();
}
}
impl AddAssign<i64> for ScriptNum {
fn add_assign(&mut self, other: i64) {
todo!();
}
}
impl SubAssign<i64> for ScriptNum {
fn sub_assign(&mut self, other: i64) {
todo!();
}
}
impl BitAndAssign<i64> for ScriptNum {
fn bitand_assign(&mut self, rhs: i64) {
todo!();
}
}
impl From<i64> for ScriptNum {
fn from(n: i64) -> Self {
todo!();
}
}
impl ScriptNum {
pub fn new(
vch: &Vec<u8>,
require_minimal: bool,
n_max_num_size: Option<usize>) -> Self {
let n_max_num_size: usize =
n_max_num_size.unwrap_or(script_num::N_DEFAULT_MAX_NUM_SIZE);
todo!();
}
pub fn getint(&self) -> i32 {
todo!();
}
pub fn getvch(&self) -> Vec<u8> {
todo!();
}
pub fn serialize(value: &i64) -> Vec<u8> {
todo!();
}
pub fn set_vch(vch: &Vec<u8>) -> i64 {
todo!();
}
}
pub type ScriptBase = PreVector<u8,28>;
pub type ScriptIterator = dyn Iterator<Item = u8>;
#[derive(Default,Clone,Serialize,Deserialize)]
pub struct Script {
pub base: ScriptBase,
}
impl RecursiveDynamicUsage for Script {
fn recursive_dynamic_usage(&self) -> usize {
todo!();
}
}
impl Deref for Script {
type Target = ScriptBase;
fn deref(&self) -> &Self::Target {
&self.base
}
}
impl DerefMut for Script {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.base
}
}
impl Script {
pub const fn new() -> Self {
Self {
base: TinyVec::Inline(ArrayVec::from_array_empty([0; 28])),
}
}
pub fn empty(&self) -> bool {
self.base.is_empty()
}
}
lazy_static!{
}
impl Write for Script {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
todo!();
}
fn flush(&mut self) -> Result<(), std::io::Error> {
todo!();
}
}
impl Read for Script {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
todo!();
}
}
impl Shl<i64> for Script {
type Output = Script;
#[inline] fn shl(self, rhs: i64) -> Self::Output {
todo!();
}
}
impl Shl<OpcodeType> for Script {
type Output = Script;
#[inline] fn shl(self, rhs: OpcodeType) -> Self::Output {
todo!();
}
}
impl Shl<&ScriptNum> for Script {
type Output = Script;
#[inline] fn shl(self, rhs: &ScriptNum) -> Self::Output {
todo!();
}
}
impl Shl<&Vec<u8>> for Script {
type Output = Script;
#[inline] fn shl(self, rhs: &Vec<u8>) -> Self::Output {
todo!();
}
}
impl From<i64> for Script {
fn from(b: i64) -> Self {
todo!();
}
}
impl From<OpcodeType> for Script {
fn from(b: OpcodeType) -> Self {
todo!();
}
}
impl From<&ScriptNum> for Script {
fn from(b: &ScriptNum) -> Self {
todo!();
}
}
impl Script {
pub fn push_int64(&mut self, n: i64) -> &mut Script {
todo!();
}
pub fn new_from_iterator_range(
pbegin: Box<dyn Iterator<Item = u8>>,
pend: Box<dyn Iterator<Item = u8>>) -> Self {
todo!();
}
pub fn new_from_pointer_range(
pbegin: *const u8,
pend: *const u8) -> Self {
todo!();
}
pub fn get_op<'a>(&self,
pc: &mut Peekable<std::slice::Iter<'a, u8>>,
opcode_ret: &mut OpcodeType,
vch_ret: Option<&mut Vec<u8>>) -> bool {
todo!();
}
pub fn decodeop_n(opcode: OpcodeType) -> i32 {
todo!();
}
pub fn encodeop_n(n: i32) -> OpcodeType {
todo!();
}
pub fn is_unspendable(&self) -> bool {
todo!();
}
pub fn clear(&mut self) {
todo!();
}
pub fn get_sig_op_count(&self, accurate: bool) -> u32 {
todo!();
}
pub fn get_sig_op_count_with_script_sig(&self, script_sig: &Script) -> u32 {
todo!();
}
pub fn is_pay_to_script_hash(&self) -> bool {
todo!();
}
pub fn is_pay_to_witness_script_hash(&self) -> bool {
todo!();
}
pub fn is_witness_program(&self,
version: &mut i32,
program: &mut Vec<u8>) -> bool {
todo!();
}
pub fn is_push_only(&self, pc: Box<ScriptIterator>) -> bool {
todo!();
}
pub fn is_push_only_from_begin(&self) -> bool {
todo!();
}
pub fn has_valid_ops(&self) -> bool {
todo!();
}
}
#[derive(Default,Clone,Serialize,Deserialize)]
pub struct ScriptWitness {
pub stack: Vec<Vec<u8>>,
}
impl ScriptWitness {
pub fn is_null(&self) -> bool {
self.stack.is_empty()
}
pub fn set_null(&mut self) {
self.stack.clear();
self.stack.shrink_to_fit();
}
pub fn to_string(&self) -> String {
let mut ret: String = "CScriptWitness(".to_string();
for i in 0..self.stack.len() {
if i != 0 {
ret.push_str(", ");
}
ret.push_str(&hex_str(&self.stack[i]));
}
ret.push_str(")");
ret
}
}
pub fn get_op_name(opcode: usize) -> String {
todo!();
}
pub fn get_script_op(
pc: &mut Box<ScriptIterator>,
end: Box<ScriptIterator>,
opcode_ret: &mut OpcodeType,
pvch_ret: *mut Vec<u8>) -> bool {
todo!();
}
pub fn is_op_success(opcode: &OpcodeType) -> bool {
todo!();
}