@@ -5,7 +5,7 @@ use std::{collections::HashMap, sync::Arc};
5
5
use anyhow:: bail;
6
6
use c509_certificate:: c509:: C509 ;
7
7
use cardano_blockchain_types:: TransactionId ;
8
- use catalyst_types:: uuid:: UuidV4 ;
8
+ use catalyst_types:: { id_uri :: IdUri , uuid:: UuidV4 } ;
9
9
use ed25519_dalek:: VerifyingKey ;
10
10
use tracing:: { error, warn} ;
11
11
use x509_cert:: certificate:: Certificate as X509Certificate ;
@@ -56,6 +56,12 @@ impl RegistrationChain {
56
56
} )
57
57
}
58
58
59
+ /// Returns a Catalyst ID.
60
+ #[ must_use]
61
+ pub fn catalyst_id ( & self ) -> & IdUri {
62
+ & self . inner . catalyst_id
63
+ }
64
+
59
65
/// Get the current transaction ID hash.
60
66
#[ must_use]
61
67
pub fn current_tx_id_hash ( & self ) -> TransactionId {
@@ -118,6 +124,8 @@ impl RegistrationChain {
118
124
/// Inner structure of registration chain.
119
125
#[ derive( Debug , Clone ) ]
120
126
struct RegistrationChainInner {
127
+ /// A Catalyst ID.
128
+ catalyst_id : IdUri ,
121
129
/// The current transaction ID hash (32 bytes)
122
130
current_tx_id_hash : TransactionId ,
123
131
/// List of purpose for this registration chain
@@ -163,10 +171,9 @@ impl RegistrationChainInner {
163
171
if cip509. previous_transaction ( ) . is_some ( ) {
164
172
bail ! ( "Invalid chain root, previous transaction ID should be None." ) ;
165
173
}
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 {
168
175
bail ! ( "Invalid chain root, catalyst id should be present." ) ;
169
- }
176
+ } ;
170
177
171
178
let point_tx_idx = cip509. origin ( ) . clone ( ) ;
172
179
let current_tx_id_hash = cip509. txn_hash ( ) ;
@@ -199,6 +206,7 @@ impl RegistrationChainInner {
199
206
}
200
207
201
208
Ok ( Self {
209
+ catalyst_id,
202
210
current_tx_id_hash,
203
211
purpose,
204
212
x509_certs,
0 commit comments