Merge branch 'str4d-transaction-builder-transparent-inputs' into lightclient-work

This commit is contained in:
Aditya Kulkarni
2019-09-05 13:37:27 -07:00
8 changed files with 197 additions and 31 deletions

15
Cargo.lock generated
View File

@@ -159,7 +159,11 @@ dependencies = [
[[package]]
name = "cc"
<<<<<<< HEAD
version = "1.0.41"
=======
version = "1.0.40"
>>>>>>> 388a5855159c3c3502691deac19bc51ecbfe68d6
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -709,6 +713,8 @@ dependencies = [
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"secp256k1 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -747,7 +753,11 @@ dependencies = [
"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
<<<<<<< HEAD
"checksum cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff"
=======
"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7"
>>>>>>> 388a5855159c3c3502691deac19bc51ecbfe68d6
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19"
@@ -793,9 +803,14 @@ dependencies = [
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
"checksum rand_os 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb525a78d3a0b0e05b6fe0f7df14d7a4dc957944c7b403911ba5a0f1c694967"
"checksum rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
<<<<<<< HEAD
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
"checksum rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a194373ef527035645a1bc21b10dc2125f73497e6e155771233eb187aedd051"
=======
"checksum ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad5112e0dbbb87577bfbc56c42450235e3012ce336e29c5befd7807bd626da4a"
"checksum secp256k1 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e0344a794ff109f85547039536028e12f313178ac1545e49fdf16a530d900a7b"
>>>>>>> 388a5855159c3c3502691deac19bc51ecbfe68d6
"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082"
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"

View File

@@ -19,8 +19,13 @@ pairing = { path = "../pairing" }
rand = "0.7"
rand_core = "0.5"
rand_os = "0.2"
ripemd160 = { version = "0.8", optional = true }
secp256k1 = { version = "=0.15.0", optional = true }
sha2 = "0.8"
[dev-dependencies]
hex-literal = "0.1"
rand_xorshift = "0.2"
[features]
transparent-inputs = ["ripemd160", "secp256k1"]

View File

@@ -38,6 +38,31 @@ impl Script {
pub fn write<W: Write>(&self, mut writer: W) -> io::Result<()> {
Vector::write(&mut writer, &self.0, |w, e| w.write_u8(*e))
}
/// Returns the address that this Script contains, if any.
pub fn address(&self) -> Option<TransparentAddress> {
if self.0.len() == 25
&& self.0[0] == OpCode::Dup as u8
&& self.0[1] == OpCode::Hash160 as u8
&& self.0[2] == 0x14
&& self.0[23] == OpCode::EqualVerify as u8
&& self.0[24] == OpCode::CheckSig as u8
{
let mut hash = [0; 20];
hash.copy_from_slice(&self.0[3..23]);
Some(TransparentAddress::PublicKey(hash))
} else if self.0.len() == 23
&& self.0[0] == OpCode::Hash160 as u8
&& self.0[1] == 0x14
&& self.0[22] == OpCode::Equal as u8
{
let mut hash = [0; 20];
hash.copy_from_slice(&self.0[2..22]);
Some(TransparentAddress::Script(hash))
} else {
None
}
}
}
impl Shl<OpCode> for Script {
@@ -151,7 +176,8 @@ mod tests {
0x76, 0xa9, 0x14, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x88, 0xac,
]
)
);
assert_eq!(addr.script().address(), Some(addr));
}
#[test]
@@ -163,6 +189,7 @@ mod tests {
0xa9, 0x14, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x87,
]
)
);
assert_eq!(addr.script().address(), Some(addr));
}
}

View File

@@ -15,6 +15,12 @@ extern crate rand_core;
extern crate rand_os;
extern crate sha2;
#[cfg(feature = "transparent-inputs")]
extern crate ripemd160;
#[cfg(feature = "transparent-inputs")]
extern crate secp256k1;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;

View File

@@ -26,6 +26,12 @@ use crate::{
JUBJUB,
};
#[cfg(feature = "transparent-inputs")]
use crate::{
legacy::Script,
transaction::components::{OutPoint, TxIn},
};
const DEFAULT_TX_EXPIRY_DELTA: u32 = 20;
/// If there are any shielded inputs, always have at least two shielded outputs, padding
@@ -153,6 +159,50 @@ impl SaplingOutput {
}
}
#[cfg(feature = "transparent-inputs")]
struct TransparentInputInfo {
sk: secp256k1::SecretKey,
pubkey: [u8; secp256k1::constants::PUBLIC_KEY_SIZE],
coin: TxOut,
}
#[cfg(feature = "transparent-inputs")]
struct TransparentInputs {
secp: secp256k1::Secp256k1<secp256k1::SignOnly>,
inputs: Vec<TransparentInputInfo>,
}
#[cfg(feature = "transparent-inputs")]
impl Default for TransparentInputs {
fn default() -> Self {
TransparentInputs {
secp: secp256k1::Secp256k1::gen_new(),
inputs: Default::default(),
}
}
}
#[cfg(not(feature = "transparent-inputs"))]
#[derive(Default)]
struct TransparentInputs;
impl TransparentInputs {
fn input_sum(&self) -> Amount {
#[cfg(feature = "transparent-inputs")]
{
self.inputs
.iter()
.map(|input| input.coin.value)
.sum::<Amount>()
}
#[cfg(not(feature = "transparent-inputs"))]
{
Amount::zero()
}
}
}
/// Metadata about a transaction created by a [`Builder`].
#[derive(Debug, PartialEq)]
pub struct TransactionMetadata {
@@ -199,6 +249,7 @@ pub struct Builder<R: RngCore + CryptoRng> {
anchor: Option<Fr>,
spends: Vec<SpendDescriptionInfo>,
outputs: Vec<SaplingOutput>,
legacy: TransparentInputs,
change_address: Option<(OutgoingViewingKey, PaymentAddress<Bls12>)>,
}
@@ -238,6 +289,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
anchor: None,
spends: vec![],
outputs: vec![],
legacy: TransparentInputs::default(),
change_address: None,
}
}
@@ -296,6 +348,39 @@ impl<R: RngCore + CryptoRng> Builder<R> {
Ok(())
}
/// Adds a transparent coin to be spent in this transaction.
#[cfg(feature = "transparent-inputs")]
pub fn add_transparent_input(
&mut self,
sk: secp256k1::SecretKey,
utxo: OutPoint,
coin: TxOut,
) -> Result<(), Error> {
if coin.value.is_negative() {
return Err(Error::InvalidAmount);
}
let pubkey = secp256k1::PublicKey::from_secret_key(&self.legacy.secp, &sk).serialize();
match coin.script_pubkey.address() {
Some(TransparentAddress::PublicKey(hash)) => {
use ripemd160::Ripemd160;
use sha2::{Digest, Sha256};
if &hash[..] != &Ripemd160::digest(&Sha256::digest(&pubkey))[..] {
return Err(Error::InvalidAddress);
}
}
_ => return Err(Error::InvalidAddress),
}
self.mtx.vin.push(TxIn::new(utxo));
self.legacy
.inputs
.push(TransparentInputInfo { sk, pubkey, coin });
Ok(())
}
/// Adds a transparent address to send funds to.
pub fn add_transparent_output(
&mut self,
@@ -343,8 +428,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
//
// Valid change
let change = self.mtx.value_balance
- self.fee
let change = self.mtx.value_balance - self.fee + self.legacy.input_sum()
- self
.mtx
.vout
@@ -546,6 +630,26 @@ impl<R: RngCore + CryptoRng> Builder<R> {
.map_err(|()| Error::BindingSig)?,
);
// Transparent signatures
#[cfg(feature = "transparent-inputs")]
{
for (i, info) in self.legacy.inputs.iter().enumerate() {
sighash.copy_from_slice(&signature_hash_data(
&self.mtx,
consensus_branch_id,
SIGHASH_ALL,
Some((i, &info.coin.script_pubkey, info.coin.value)),
));
let msg = secp256k1::Message::from_slice(&sighash).expect("32 bytes");
let sig = self.legacy.secp.sign(&msg, &info.sk);
// P2PKH scriptSig
self.mtx.vin[i].script_sig =
Script::default() << &sig.serialize_compact()[..] << &info.pubkey[..];
}
}
Ok((
self.mtx.freeze().expect("Transaction should be complete"),
tx_metadata,

View File

@@ -42,11 +42,20 @@ impl OutPoint {
#[derive(Debug)]
pub struct TxIn {
pub prevout: OutPoint,
script_sig: Script,
pub script_sig: Script,
pub sequence: u32,
}
impl TxIn {
#[cfg(feature = "transparent-inputs")]
pub fn new(prevout: OutPoint) -> Self {
TxIn {
prevout,
script_sig: Script::default(),
sequence: std::u32::MAX,
}
}
pub fn read<R: Read>(mut reader: &mut R) -> io::Result<Self> {
let prevout = OutPoint::read(&mut reader)?;
let script_sig = Script::read(&mut reader)?;

View File

@@ -154,7 +154,7 @@ pub fn signature_hash_data(
tx: &TransactionData,
consensus_branch_id: u32,
hash_type: u32,
transparent_input: Option<(usize, Script, Amount)>,
transparent_input: Option<(usize, &Script, Amount)>,
) -> Vec<u8> {
let sigversion = SigHashVersion::from_tx(tx);
match sigversion {
@@ -232,7 +232,7 @@ pub fn signature_hash(
tx: &Transaction,
consensus_branch_id: u32,
hash_type: u32,
transparent_input: Option<(usize, Script, Amount)>,
transparent_input: Option<(usize, &Script, Amount)>,
) -> Vec<u8> {
signature_hash_data(tx, consensus_branch_id, hash_type, transparent_input)
}

View File

@@ -212,7 +212,7 @@ fn tx_write_rejects_unexpected_binding_sig() {
fn zip_0143() {
struct TestVector {
tx: Vec<u8>,
script_code: Vec<u8>,
script_code: Script,
transparent_input: Option<u32>,
hash_type: u32,
amount: i64,
@@ -229,7 +229,7 @@ fn zip_0143() {
0xb2, 0x83, 0x5a, 0x08, 0x05, 0x75, 0x02, 0x00, 0x02, 0x51, 0x51, 0x48, 0x1c, 0xdd,
0x86, 0xb3, 0xcc, 0x43, 0x18, 0x00,
],
script_code: vec![0x6a, 0x00, 0x00, 0x00, 0x63, 0xac, 0x53],
script_code: Script(vec![0x6a, 0x00, 0x00, 0x00, 0x63, 0xac, 0x53]),
transparent_input: None,
hash_type: 1,
amount: 1672704339313879,
@@ -518,7 +518,7 @@ fn zip_0143() {
0xb1, 0xfa, 0x45, 0xad, 0x61, 0xce, 0x9a, 0x1c, 0x47, 0x27, 0xb7, 0xaa, 0xa5, 0x35,
0x62, 0xf5, 0x23, 0xe7, 0x39, 0x52,
],
script_code: vec![0x53],
script_code: Script(vec![0x53]),
transparent_input: Some(1),
hash_type: 3,
amount: 365293780364847,
@@ -678,7 +678,7 @@ fn zip_0143() {
0x62, 0x91, 0x85, 0x00, 0x2c, 0x72, 0xc0, 0x12, 0xc4, 0x14, 0xd2, 0x38, 0x2a, 0x6d,
0x47, 0xc7, 0xb3, 0xde, 0xab, 0xa7,
],
script_code: vec![0xac, 0x00],
script_code: Script(vec![0xac, 0x00]),
transparent_input: Some(0),
hash_type: 3,
amount: 711752082734717,
@@ -960,7 +960,7 @@ fn zip_0143() {
0xce, 0x1f, 0xca, 0x2c, 0x63, 0xfe, 0x06, 0xb7, 0x98, 0x9d, 0x58, 0x4f, 0xa7, 0xd7,
0x82, 0xa8, 0x8c, 0x1e, 0x7d, 0x64, 0xb6, 0xfb, 0xf5, 0x5e, 0x35,
],
script_code: vec![0x6a, 0x53, 0x53, 0x63],
script_code: Script(vec![0x6a, 0x53, 0x53, 0x63]),
transparent_input: None,
hash_type: 1,
amount: 379068098637835,
@@ -1119,7 +1119,7 @@ fn zip_0143() {
0xc1, 0xc4, 0xf2, 0xca, 0xcd, 0xa3, 0x0b, 0xdb, 0x69, 0x30, 0x65, 0x3c, 0x0c, 0xc4,
0x48, 0x6e, 0x60, 0xe8, 0x9f, 0xa8, 0x49, 0xb3,
],
script_code: vec![0x53, 0x52],
script_code: Script(vec![0x53, 0x52]),
transparent_input: Some(0),
hash_type: 3,
amount: 1437866676382615,
@@ -1139,7 +1139,7 @@ fn zip_0143() {
0x08, 0xf0, 0x83, 0x05, 0x00, 0x09, 0x63, 0x6a, 0x52, 0x63, 0x51, 0x63, 0x00, 0x6a,
0xac, 0x9a, 0xbc, 0xef, 0x2a, 0x99, 0x08, 0x73, 0x19, 0x00,
],
script_code: vec![0x63],
script_code: Script(vec![0x63]),
transparent_input: None,
hash_type: 1,
amount: 1993227025071196,
@@ -1162,7 +1162,7 @@ fn zip_0143() {
0x87, 0x01, 0xff, 0x01, 0x86, 0xd2, 0x6f, 0xee, 0x28, 0xca, 0x06, 0x00, 0x01, 0xac,
0x5a, 0xa7, 0x27, 0xab, 0x79, 0x85, 0xda, 0x0e, 0x00,
],
script_code: vec![0x65, 0x53, 0x51],
script_code: Script(vec![0x65, 0x53, 0x51]),
transparent_input: Some(1),
hash_type: 130,
amount: 449567650863240,
@@ -1444,7 +1444,7 @@ fn zip_0143() {
0xba, 0xfe, 0xc8, 0x84, 0x0c, 0x2d, 0x25, 0x5b, 0xf5, 0xad, 0x61, 0xc4, 0x60, 0xf9,
0x8f, 0xeb, 0x82, 0xa1, 0x0f, 0xa1, 0xc0,
],
script_code: vec![0x65, 0x6a, 0x65, 0x51, 0x52, 0x65, 0x63],
script_code: Script(vec![0x65, 0x6a, 0x65, 0x51, 0x52, 0x65, 0x63]),
transparent_input: None,
hash_type: 1,
amount: 1712463999734827,
@@ -1602,7 +1602,7 @@ fn zip_0143() {
0xd9, 0xa9, 0xd9, 0xf5, 0x4f, 0xb2, 0xfe, 0x8f, 0x9f, 0x05, 0xcd, 0x11, 0x1e, 0xe4,
0x6c, 0x47, 0x10, 0xf6, 0xf6, 0x3a, 0x62, 0x69, 0x45, 0x57,
],
script_code: vec![0x53, 0x52, 0x00],
script_code: Script(vec![0x53, 0x52, 0x00]),
transparent_input: Some(1),
hash_type: 1,
amount: 1564816348934332,
@@ -1885,7 +1885,7 @@ fn zip_0143() {
0x54, 0xa7, 0x89, 0x73, 0x5b, 0x03, 0x49, 0xc4, 0xd5, 0x1c, 0x88, 0x9d, 0x08, 0x95,
0x2d, 0xdd, 0x54, 0x88, 0xbe, 0x95, 0x56, 0x05, 0x94, 0xe6,
],
script_code: vec![0x52, 0x63, 0x53, 0x51, 0x65],
script_code: Script(vec![0x52, 0x63, 0x53, 0x51, 0x65]),
transparent_input: Some(0),
hash_type: 2,
amount: 483959951916902,
@@ -1903,7 +1903,7 @@ fn zip_0143() {
let transparent_input = if let Some(n) = tv.transparent_input {
Some((
n as usize,
Script(tv.script_code),
&tv.script_code,
Amount::from_nonnegative_i64(tv.amount).unwrap(),
))
} else {
@@ -1921,7 +1921,7 @@ fn zip_0143() {
fn zip_0243() {
struct TestVector {
tx: Vec<u8>,
script_code: Vec<u8>,
script_code: Script,
transparent_input: Option<u32>,
hash_type: u32,
amount: i64,
@@ -2229,7 +2229,7 @@ fn zip_0243() {
0xe4, 0x62, 0xef, 0xf9, 0xba, 0x8b, 0x3f, 0x4b, 0xfa, 0xa1, 0x30, 0x0c, 0x26, 0x92,
0x5a, 0x87,
],
script_code: vec![0x63],
script_code: Script(vec![0x63]),
transparent_input: None,
hash_type: 1,
amount: 1969273897303781,
@@ -2462,7 +2462,7 @@ fn zip_0243() {
0xed, 0x6a, 0x9f, 0x08, 0x46, 0x4d, 0x56, 0x55, 0x93, 0xe1, 0xa6, 0x3b, 0x93, 0x85,
0x36, 0xb4, 0x92, 0x44, 0xe9, 0x7d,
],
script_code: vec![],
script_code: Script(vec![]),
transparent_input: Some(1),
hash_type: 2,
amount: 652655344020909,
@@ -3048,7 +3048,7 @@ fn zip_0243() {
0x76, 0xc5, 0x3b, 0x4d, 0xf7, 0x95, 0x39, 0x81, 0xd5, 0x5a, 0x96, 0xa6, 0xdc, 0xff,
0x99, 0x04, 0xa9, 0x08, 0x42, 0xe5, 0xba, 0xfe, 0xc8, 0x84, 0x0c, 0x2d,
],
script_code: vec![0x53, 0x63, 0x63, 0x51, 0xac, 0x00, 0x51],
script_code: Script(vec![0x53, 0x63, 0x63, 0x51, 0xac, 0x00, 0x51]),
transparent_input: None,
hash_type: 1,
amount: 1345602751504862,
@@ -3369,7 +3369,7 @@ fn zip_0243() {
0xde, 0x7f, 0x8e, 0x6a, 0x5c, 0x62, 0xa7, 0x77, 0xd1, 0x75, 0x00, 0x2a, 0x13, 0x7d,
0xe8, 0x5b, 0x88,
],
script_code: vec![],
script_code: Script(vec![]),
transparent_input: None,
hash_type: 1,
amount: 1039204199089370,
@@ -3519,7 +3519,7 @@ fn zip_0243() {
0xb5, 0x58, 0x02, 0x9a, 0x36, 0x02, 0x4d, 0x2e, 0x79, 0x0f, 0xc6, 0xfd, 0x66, 0x7f,
0x17, 0x6e, 0x0a, 0xa9, 0x9d, 0xd1, 0xd7, 0x2b, 0x57,
],
script_code: vec![0x6a, 0x51, 0x65, 0xac],
script_code: Script(vec![0x6a, 0x51, 0x65, 0xac]),
transparent_input: None,
hash_type: 1,
amount: 691732482992802,
@@ -3919,7 +3919,7 @@ fn zip_0243() {
0x30, 0x3a, 0x3a, 0xb9, 0xbb, 0x2e, 0xe3, 0x79, 0xb9, 0xaf, 0xcd, 0x1f, 0x6a, 0x3c,
0xb9, 0x00, 0x0b, 0xb1, 0x4e,
],
script_code: vec![0x53, 0x63, 0x63, 0xac, 0x63, 0x52],
script_code: Script(vec![0x53, 0x63, 0x63, 0xac, 0x63, 0x52]),
transparent_input: None,
hash_type: 1,
amount: 1152393991505765,
@@ -4083,7 +4083,7 @@ fn zip_0243() {
0x53, 0xf1, 0xd0, 0xc8, 0x65, 0xa9, 0x4a, 0xa4, 0x56, 0xdc, 0xd1, 0x8a, 0x39, 0xe2,
0xf5, 0x85, 0xd9, 0xbe, 0xa8,
],
script_code: vec![0x63, 0x00, 0x6a, 0x53, 0x63, 0x6a, 0xac, 0x00],
script_code: Script(vec![0x63, 0x00, 0x6a, 0x53, 0x63, 0x6a, 0xac, 0x00]),
transparent_input: None,
hash_type: 1,
amount: 1788797765223798,
@@ -4681,7 +4681,7 @@ fn zip_0243() {
0x31, 0xbd, 0x7c, 0x52, 0x22, 0xb6, 0x70, 0x61, 0x6e, 0x4b, 0x6c, 0xa8, 0xa2, 0x35,
0x50, 0xca, 0xd8, 0xac, 0x0d, 0xdb, 0x76, 0x45, 0xe2, 0xb9, 0x71, 0x3b, 0xe7,
],
script_code: vec![0x6a, 0x00, 0x00, 0x65, 0x53, 0xac, 0x63, 0x53, 0x63],
script_code: Script(vec![0x6a, 0x00, 0x00, 0x65, 0x53, 0xac, 0x63, 0x53, 0x63]),
transparent_input: None,
hash_type: 1,
amount: 1871432121379810,
@@ -5190,7 +5190,7 @@ fn zip_0243() {
0x1b, 0x48, 0x09, 0x8e, 0xba, 0x2c, 0x2e, 0xc2, 0x0a, 0x0a, 0xc0, 0x44, 0x3b, 0xa8,
0xe9, 0x48, 0x7b, 0xcf, 0x7d,
],
script_code: vec![0xac, 0x53, 0x63, 0x52, 0x6a, 0x51, 0xac],
script_code: Script(vec![0xac, 0x53, 0x63, 0x52, 0x6a, 0x51, 0xac]),
transparent_input: None,
hash_type: 1,
amount: 1501997449504444,
@@ -5380,7 +5380,7 @@ fn zip_0243() {
0xfb, 0x34, 0x1e, 0xf5, 0xff, 0xb4, 0x2b, 0xc2, 0xab, 0xc5, 0x08, 0xff, 0x23, 0x12,
0x48, 0xf2, 0xc2, 0xdc, 0x15, 0x77, 0x0d, 0x33, 0x72, 0x2b, 0x9c, 0x9d, 0xae,
],
script_code: vec![0xac, 0x65],
script_code: Script(vec![0xac, 0x65]),
transparent_input: Some(0),
hash_type: 3,
amount: 391892287957268,
@@ -5398,7 +5398,7 @@ fn zip_0243() {
let transparent_input = if let Some(n) = tv.transparent_input {
Some((
n as usize,
Script(tv.script_code),
&tv.script_code,
Amount::from_nonnegative_i64(tv.amount).unwrap(),
))
} else {