Rename script fields to lock/unlock scripts. (#866)
This is slightly clearer and more correct than the previous pk_script.
This commit is contained in:
parent
4ec011f32d
commit
f8a24f9c11
|
@ -157,11 +157,11 @@ impl ZcashSerialize for TransparentInput {
|
||||||
match self {
|
match self {
|
||||||
TransparentInput::PrevOut {
|
TransparentInput::PrevOut {
|
||||||
outpoint,
|
outpoint,
|
||||||
script,
|
unlock_script,
|
||||||
sequence,
|
sequence,
|
||||||
} => {
|
} => {
|
||||||
outpoint.zcash_serialize(&mut writer)?;
|
outpoint.zcash_serialize(&mut writer)?;
|
||||||
script.zcash_serialize(&mut writer)?;
|
unlock_script.zcash_serialize(&mut writer)?;
|
||||||
writer.write_u32::<LittleEndian>(*sequence)?;
|
writer.write_u32::<LittleEndian>(*sequence)?;
|
||||||
}
|
}
|
||||||
TransparentInput::Coinbase {
|
TransparentInput::Coinbase {
|
||||||
|
@ -211,7 +211,7 @@ impl ZcashDeserialize for TransparentInput {
|
||||||
hash: TransactionHash(bytes),
|
hash: TransactionHash(bytes),
|
||||||
index: reader.read_u32::<LittleEndian>()?,
|
index: reader.read_u32::<LittleEndian>()?,
|
||||||
},
|
},
|
||||||
script: Script::zcash_deserialize(&mut reader)?,
|
unlock_script: Script::zcash_deserialize(&mut reader)?,
|
||||||
sequence: reader.read_u32::<LittleEndian>()?,
|
sequence: reader.read_u32::<LittleEndian>()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ impl ZcashDeserialize for TransparentInput {
|
||||||
impl ZcashSerialize for TransparentOutput {
|
impl ZcashSerialize for TransparentOutput {
|
||||||
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
|
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
|
||||||
writer.write_u64::<LittleEndian>(self.value.into())?;
|
writer.write_u64::<LittleEndian>(self.value.into())?;
|
||||||
self.pk_script.zcash_serialize(&mut writer)?;
|
self.lock_script.zcash_serialize(&mut writer)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ impl ZcashDeserialize for TransparentOutput {
|
||||||
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
|
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
|
||||||
Ok(TransparentOutput {
|
Ok(TransparentOutput {
|
||||||
value: reader.read_u64::<LittleEndian>()?.try_into()?,
|
value: reader.read_u64::<LittleEndian>()?.try_into()?,
|
||||||
pk_script: Script::zcash_deserialize(&mut reader)?,
|
lock_script: Script::zcash_deserialize(&mut reader)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,10 +202,10 @@ impl Arbitrary for TransparentInput {
|
||||||
fn arbitrary_with(_args: ()) -> Self::Strategy {
|
fn arbitrary_with(_args: ()) -> Self::Strategy {
|
||||||
prop_oneof![
|
prop_oneof![
|
||||||
(any::<OutPoint>(), any::<Script>(), any::<u32>())
|
(any::<OutPoint>(), any::<Script>(), any::<u32>())
|
||||||
.prop_map(|(outpoint, script, sequence)| {
|
.prop_map(|(outpoint, unlock_script, sequence)| {
|
||||||
TransparentInput::PrevOut {
|
TransparentInput::PrevOut {
|
||||||
outpoint,
|
outpoint,
|
||||||
script,
|
unlock_script,
|
||||||
sequence,
|
sequence,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -51,7 +51,7 @@ pub enum TransparentInput {
|
||||||
/// The previous output transaction reference.
|
/// The previous output transaction reference.
|
||||||
outpoint: OutPoint,
|
outpoint: OutPoint,
|
||||||
/// The script that authorizes spending `outpoint`.
|
/// The script that authorizes spending `outpoint`.
|
||||||
script: Script,
|
unlock_script: Script,
|
||||||
/// The sequence number for the output.
|
/// The sequence number for the output.
|
||||||
sequence: u32,
|
sequence: u32,
|
||||||
},
|
},
|
||||||
|
@ -85,7 +85,6 @@ pub struct TransparentOutput {
|
||||||
// At https://en.bitcoin.it/wiki/Protocol_documentation#tx, this is an i64.
|
// At https://en.bitcoin.it/wiki/Protocol_documentation#tx, this is an i64.
|
||||||
pub value: Amount<NonNegative>,
|
pub value: Amount<NonNegative>,
|
||||||
|
|
||||||
/// Usually contains the public key as a Bitcoin script setting up
|
/// The lock script defines the conditions under which this output can be spent.
|
||||||
/// conditions to claim this output.
|
pub lock_script: Script,
|
||||||
pub pk_script: Script,
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue