mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-08-01 12:51:30 +00:00
transparent inputs should use serialize_der()
This commit is contained in:
committed by
Jack Grigg
parent
5a177eea27
commit
fab9160b26
@@ -457,7 +457,6 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
|||||||
//
|
//
|
||||||
|
|
||||||
let mut ctx = prover.new_sapling_proving_context();
|
let mut ctx = prover.new_sapling_proving_context();
|
||||||
let anchor = self.anchor.expect("anchor was set if spends were added");
|
|
||||||
|
|
||||||
// Pad Sapling outputs
|
// Pad Sapling outputs
|
||||||
let orig_outputs_len = outputs.len();
|
let orig_outputs_len = outputs.len();
|
||||||
@@ -474,6 +473,9 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
|||||||
tx_metadata.output_indices.resize(orig_outputs_len, 0);
|
tx_metadata.output_indices.resize(orig_outputs_len, 0);
|
||||||
|
|
||||||
// Create Sapling SpendDescriptions
|
// Create Sapling SpendDescriptions
|
||||||
|
if !spends.is_empty() {
|
||||||
|
let anchor = self.anchor.expect("anchor was set if spends were added");
|
||||||
|
|
||||||
for (i, (pos, spend)) in spends.iter().enumerate() {
|
for (i, (pos, spend)) in spends.iter().enumerate() {
|
||||||
let proof_generation_key = spend.extsk.expsk.proof_generation_key(&JUBJUB);
|
let proof_generation_key = spend.extsk.expsk.proof_generation_key(&JUBJUB);
|
||||||
|
|
||||||
@@ -509,6 +511,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
|||||||
// Record the post-randomized spend location
|
// Record the post-randomized spend location
|
||||||
tx_metadata.spend_indices[*pos] = i;
|
tx_metadata.spend_indices[*pos] = i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create Sapling OutputDescriptions
|
// Create Sapling OutputDescriptions
|
||||||
for (i, output) in outputs.into_iter().enumerate() {
|
for (i, output) in outputs.into_iter().enumerate() {
|
||||||
@@ -622,9 +625,13 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
|||||||
let msg = secp256k1::Message::from_slice(&sighash).expect("32 bytes");
|
let msg = secp256k1::Message::from_slice(&sighash).expect("32 bytes");
|
||||||
let sig = self.legacy.secp.sign(&msg, &info.sk);
|
let sig = self.legacy.secp.sign(&msg, &info.sk);
|
||||||
|
|
||||||
|
// Signature has to have "SIGHASH_ALL" appended to it
|
||||||
|
let mut sig_bytes: Vec<u8> = sig.serialize_der()[..].to_vec();
|
||||||
|
sig_bytes.extend(&[SIGHASH_ALL as u8]);
|
||||||
|
|
||||||
// P2PKH scriptSig
|
// P2PKH scriptSig
|
||||||
self.mtx.vin[i].script_sig =
|
self.mtx.vin[i].script_sig =
|
||||||
Script::default() << &sig.serialize_compact()[..] << &info.pubkey[..];
|
Script::default() << &sig_bytes[..] << &info.pubkey[..];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user