/// Appends the opcodes and provided data that push it onto the stack
Appends the opcodes and provided data that push it onto the stack
Appends the opcodes and provided data that push it onto the stack
pub fn append_data(&mut self, data: &[u8]) {
        let len = data.len();
        match len {
            0 => self.0.push(OP_0),
            1..=75 => {
                self.0.push(OP_PUSH + len as u8); //?? working on ABC regtest mode
                self.0.extend_from_slice(data);
            }
            76..=255 => {
                self.0.push(OP_PUSHDATA1);
                self.0.push(len as u8);
                self.0.extend_from_slice(data);
            }
            256..=65535 => {
                self.0.push(OP_PUSHDATA2);
                self.0.push((len >> 0) as u8);
                self.0.push((len >> 8) as u8);
                self.0.extend_from_slice(data);
            }
            _ => {
                self.0.push(OP_PUSHDATA4);
                self.0.push((len >> 0) as u8);
                self.0.push((len >> 8) as u8);
                self.0.push((len >> 16) as u8);
                self.0.push((len >> 24) as u8);
                self.0.extend_from_slice(data);
            }
        }
    }
pub fn append_data ( & mut self , data : & [ u8 ] ) { let len = data . len ( ) ; match len { 0 => self . 0 . push ( OP_0 ) , 1 ..= 75 => { self . 0 . push ( OP_PUSH + len as u8 ) ; //?? working on ABC regtest mode self . 0 . extend_from_slice ( data ) ; } 76 ..= 255 => { self . 0 . push ( OP_PUSHDATA1 ) ; self . 0 . push ( len as u8 ) ; self . 0 . extend_from_slice ( data ) ; } 256 ..= 65535 => { self . 0 . push ( OP_PUSHDATA2 ) ; self . 0 . push ( ( len >> 0 ) as u8 ) ; self . 0 . push ( ( len >> 8 ) as u8 ) ; self . 0 . extend_from_slice ( data ) ; } _ => { self . 0 . push ( OP_PUSHDATA4 ) ; self . 0 . push ( ( len >> 0 ) as u8 ) ; self . 0 . push ( ( len >> 8 ) as u8 ) ; self . 0 . push ( ( len >> 16 ) as u8 ) ; self . 0 . push ( ( len >> 24 ) as u8 ) ; self . 0 . extend_from_slice ( data ) ; } } }
Appends the opcodes and provided data that push it onto the stack
Appends the opcodes and provided data that push it onto the stack
&mut self
data
&[u8]