@@ -9,7 +9,7 @@ use std::{
9
9
10
10
use anyhow:: { bail, Context } ;
11
11
use c509_certificate:: c509:: C509 ;
12
- use cardano_blockchain_types:: { StakeAddress , TransactionId } ;
12
+ use cardano_blockchain_types:: { Point , StakeAddress , TransactionId } ;
13
13
use catalyst_types:: {
14
14
catalyst_id:: { key_rotation:: KeyRotation , role_index:: RoleId , CatalystId } ,
15
15
conversion:: zero_out_last_n_bytes,
@@ -86,7 +86,14 @@ impl RegistrationChain {
86
86
/// Get the current transaction ID hash.
87
87
#[ must_use]
88
88
pub fn current_tx_id_hash ( & self ) -> TransactionId {
89
- self . inner . current_tx_id_hash
89
+ * self . inner . current_tx_id_hash . data ( )
90
+ }
91
+
92
+ /// Returns a point (slot and transaction index) of the latest transaction in the
93
+ /// registration chain.
94
+ #[ must_use]
95
+ pub fn current_point ( & self ) -> & Point {
96
+ self . inner . current_tx_id_hash . point ( )
90
97
}
91
98
92
99
/// Get a list of purpose for this registration chain.
@@ -234,7 +241,7 @@ struct RegistrationChainInner {
234
241
/// A Catalyst ID.
235
242
catalyst_id : CatalystId ,
236
243
/// The current transaction ID hash (32 bytes)
237
- current_tx_id_hash : TransactionId ,
244
+ current_tx_id_hash : PointData < TransactionId > ,
238
245
/// List of purpose for this registration chain
239
246
purpose : Vec < UuidV4 > ,
240
247
@@ -289,7 +296,7 @@ impl RegistrationChainInner {
289
296
} ;
290
297
291
298
let point_tx_idx = cip509. origin ( ) . clone ( ) ;
292
- let current_tx_id_hash = cip509. txn_hash ( ) ;
299
+ let current_tx_id_hash = PointData :: new ( point_tx_idx . clone ( ) , cip509. txn_hash ( ) ) ;
293
300
let validation_signature = cip509. validation_signature ( ) . cloned ( ) ;
294
301
let raw_aux_data = cip509. raw_aux_data ( ) . to_vec ( ) ;
295
302
@@ -397,7 +404,7 @@ impl RegistrationChainInner {
397
404
} ;
398
405
399
406
// Previous transaction ID in the CIP509 should equal to the current transaction ID
400
- if prv_tx_id == self . current_tx_id_hash {
407
+ if & prv_tx_id == self . current_tx_id_hash . data ( ) {
401
408
// Perform signature validation
402
409
// This should be done before updating the signing key
403
410
check_validation_signature (
@@ -409,7 +416,8 @@ impl RegistrationChainInner {
409
416
) ?;
410
417
411
418
// If successful, update the chain current transaction ID hash
412
- new_inner. current_tx_id_hash = cip509. txn_hash ( ) ;
419
+ new_inner. current_tx_id_hash =
420
+ PointData :: new ( cip509. origin ( ) . clone ( ) , cip509. txn_hash ( ) ) ;
413
421
} else {
414
422
cip509. report ( ) . invalid_value (
415
423
"previous transaction ID" ,
0 commit comments