Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ export class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {

/**
* The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching
* `ITransaction.getId()`. Defined once the transparent inputs/outputs and the shielded output are
* in place; unchanged by signing or proving.
* `ITransaction.getId()`. Defined once the transparent inputs/outputs are in place; unchanged by
* signing or proving. Works whether or not a shielded output has been added — a transparent-only
* v6 PSBT has a well-defined ZIP-244 txid too.
*/
getId(): string {
return this.wasm.ironwood_v6_txid();
Expand Down Expand Up @@ -417,7 +418,9 @@ export class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {
* @returns true if a valid signature by the key's public key exists for the input's
* ZIP-244 transparent sighash
* @throws Error if the input index is out of range, the key cannot be parsed, or the v6
* sighash cannot be computed (e.g. the Ironwood PCZT has not been added yet)
* sighash cannot be computed. Works whether or not a shielded output has been added; the one
* case this still throws for is a shielded output that was added and then consumed by
* `combineProof` (its action data is gone, not merely absent).
*
* @example
* ```typescript
Expand Down Expand Up @@ -450,6 +453,25 @@ export class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {
return this.wasm.combine_ironwood_proof(proof);
}

/**
* Transaction Extractor role for a transparent-only v6 transaction: valid only when
* no shielded output was ever added via {@link addShieldedOutput}/{@link addShieldedOutputs} —
* there is no PCZT, and therefore nothing to combine an external proof into. Finalizes the
* transparent inputs (the same 2-of-3 signature check {@link combineProof} performs) and
* returns broadcast-ready v6 transaction bytes with an empty Ironwood bundle slot.
*
* Not terminal (unlike {@link combineProof}): there is no stored PCZT to drop, so calling this
* more than once is safe and simply re-finalizes the same already-signed inputs.
*
* Use {@link combineProof} instead for a PSBT that carries (or carried) a shielded output.
*
* @throws Error if a shielded output was ever added to this PSBT (even one already extracted),
* or if any transparent input is missing a required signature
*/
extractTransparentOnlyTransaction(): Uint8Array {
return this.wasm.extract_transparent_only_v6_tx();
}

/**
* The raw serialized orchard PCZT (Partially Created Zcash Transaction) bundle stored in this
* PSBT, or `undefined` if none is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3555,7 +3555,8 @@ impl BitGoPsbt {
/// - `Ok(true)` if a valid signature exists for the public key
/// - `Ok(false)` if no signature exists for the public key
/// - `Err(VerifyV6SignatureError)` if the PSBT is not Zcash or not v6, the input index is
/// out of bounds, the Ironwood PCZT is absent, or the sighash cannot be computed
/// out of bounds, a shielded output was added and then extracted, or the sighash cannot be
/// computed
pub fn verify_v6_signature_with_pub<C: secp256k1::Verification>(
&self,
secp: &secp256k1::Secp256k1<C>,
Expand Down Expand Up @@ -3584,8 +3585,8 @@ impl BitGoPsbt {
/// - `Ok(false)` if no matching derivation path exists, or no valid signature exists for the
/// derived public key
/// - `Err(VerifyV6SignatureError)` if the PSBT is not Zcash or not v6, the input index is
/// out of bounds, derivation fails, the Ironwood PCZT is absent, or the sighash cannot be
/// computed
/// out of bounds, derivation fails, a shielded output was added and then extracted, or the
/// sighash cannot be computed
pub fn verify_v6_signature_with_xpub<C: secp256k1::Verification>(
&self,
secp: &secp256k1::Secp256k1<C>,
Expand Down
Loading
Loading