@@ -5,7 +5,7 @@ use std::{collections::HashMap, sync::Arc};
55use anyhow:: bail;
66use c509_certificate:: c509:: C509 ;
77use cardano_blockchain_types:: TransactionId ;
8- use catalyst_types:: uuid:: UuidV4 ;
8+ use catalyst_types:: { id_uri :: IdUri , uuid:: UuidV4 } ;
99use ed25519_dalek:: VerifyingKey ;
1010use tracing:: { error, warn} ;
1111use x509_cert:: certificate:: Certificate as X509Certificate ;
@@ -56,6 +56,12 @@ impl RegistrationChain {
5656 } )
5757 }
5858
59+ /// Returns a Catalyst ID.
60+ #[ must_use]
61+ pub fn catalyst_id ( & self ) -> & IdUri {
62+ & self . inner . catalyst_id
63+ }
64+
5965 /// Get the current transaction ID hash.
6066 #[ must_use]
6167 pub fn current_tx_id_hash ( & self ) -> TransactionId {
@@ -118,6 +124,8 @@ impl RegistrationChain {
118124/// Inner structure of registration chain.
119125#[ derive( Debug , Clone ) ]
120126struct RegistrationChainInner {
127+ /// A Catalyst ID.
128+ catalyst_id : IdUri ,
121129 /// The current transaction ID hash (32 bytes)
122130 current_tx_id_hash : TransactionId ,
123131 /// List of purpose for this registration chain
@@ -163,10 +171,9 @@ impl RegistrationChainInner {
163171 if cip509. previous_transaction ( ) . is_some ( ) {
164172 bail ! ( "Invalid chain root, previous transaction ID should be None." ) ;
165173 }
166- // Should be chain root, return immediately if not
167- if cip509. catalyst_id ( ) . is_none ( ) {
174+ let Some ( catalyst_id) = cip509. catalyst_id ( ) . cloned ( ) else {
168175 bail ! ( "Invalid chain root, catalyst id should be present." ) ;
169- }
176+ } ;
170177
171178 let point_tx_idx = cip509. origin ( ) . clone ( ) ;
172179 let current_tx_id_hash = cip509. txn_hash ( ) ;
@@ -199,6 +206,7 @@ impl RegistrationChainInner {
199206 }
200207
201208 Ok ( Self {
209+ catalyst_id,
202210 current_tx_id_hash,
203211 purpose,
204212 x509_certs,
0 commit comments