whisky_csl/tx_parser/
collaterals.rs
1use whisky_common::{PubKeyTxIn, WError};
2
3use super::{utxo_converter::utxo_to_pub_key_tx_in, CSLParser};
4
5impl CSLParser {
6
7 pub fn get_collaterals(&self) -> &Vec<PubKeyTxIn> {
8 &self.tx_body.collaterals
9 }
10
11 pub(super) fn extract_collaterals(&mut self) -> Result<(), WError> {
12 let collateral_inputs = self.csl_tx_body.collateral();
13 if let Some(collateral_inputs) = collateral_inputs {
14 for input in &collateral_inputs {
15 let tx_in = utxo_to_pub_key_tx_in(&input, &self.context)?;
16 self.tx_body.collaterals.push(tx_in);
17 }
18 }
19 Ok(())
20 }
21}