Skip to content

Commit 7e33283

Browse files
committed
pset: blind_last: return blinders and ephemeral secret key
1 parent 7dc5a78 commit 7e33283

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pset/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,10 @@ impl PartiallySignedTransaction {
579579
rng: &mut R,
580580
secp: &secp256k1_zkp::Secp256k1<C>,
581581
inp_txout_sec: &HashMap<usize, TxOutSecrets>,
582-
) -> Result<(), PsetBlindError> {
582+
) -> Result<Vec<(AssetBlindingFactor, ValueBlindingFactor, SecretKey)>, PsetBlindError> {
583583
let (mut inp_secrets, mut outs_to_blind) = self.blind_checks(inp_txout_sec)?;
584584

585+
let mut ret = vec![];
585586
if outs_to_blind.is_empty() {
586587
// Atleast one output must be marked for blinding for pset blind_last
587588
return Err(PsetBlindError::AtleastOneOutputBlind);
@@ -594,7 +595,7 @@ impl PartiallySignedTransaction {
594595
let ind = self.outputs[last_out_index].blinder_index;
595596
self.outputs[last_out_index].blinder_index = None;
596597
// Blind normally without the last index
597-
self.blind_non_last(rng, secp, inp_txout_sec)?;
598+
ret = self.blind_non_last(rng, secp, inp_txout_sec)?;
598599
// Restore who blinded the last output
599600
self.outputs[last_out_index].blinder_index = ind;
600601
// inp_secrets contributed to self.global.scalars, unset it so we don't count them
@@ -657,6 +658,7 @@ impl PartiallySignedTransaction {
657658
);
658659
let (value_commitment, nonce, rangeproof) =
659660
blind_res.map_err(|e| PsetBlindError::ConfidentialTxOutError(last_out_index, e))?;
661+
ret.push((out_abf, final_vbf, ephemeral_sk));
660662

661663
// mutate the pset
662664
{
@@ -690,7 +692,7 @@ impl PartiallySignedTransaction {
690692

691693
self.global.scalars.clear();
692694
}
693-
Ok(())
695+
Ok(ret)
694696
}
695697
}
696698

0 commit comments

Comments
 (0)