Skip to content

Commit e013fbe

Browse files
authored
fix(rust/rbac-registration): RBAC reg chain with historical data (#236)
* fix(rbac-registration): rbac reg chain store history * fix(rbac-registration): typo
1 parent 9e5a80f commit e013fbe

File tree

4 files changed

+217
-120
lines changed

4 files changed

+217
-120
lines changed

rust/rbac-registration/src/cardano/cip509/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ pub use cip509::Cip509;
66
#[allow(clippy::module_name_repetitions)]
77
pub use rbac::{C509Cert, Cip509RbacMetadata, SimplePublicKeyType, X509DerCert};
88
pub use types::{
9-
CertKeyHash, KeyLocalRef, LocalRefInt, Payment, PaymentHistory, PointTxnIdx, RoleData,
10-
RoleNumber, TxInputHash, ValidationSignature,
9+
CertKeyHash, KeyLocalRef, LocalRefInt, Payment, PaymentHistory, PointData, PointTxnIdx,
10+
RoleData, RoleNumber, TxInputHash, ValidationSignature,
1111
};
1212
pub use utils::Cip0134UriSet;
1313

rust/rbac-registration/src/cardano/cip509/types/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
pub use cert_key_hash::CertKeyHash;
44
pub use key_local_ref::{KeyLocalRef, LocalRefInt};
55
pub use payment_history::{Payment, PaymentHistory};
6+
pub use point_data::PointData;
67
pub use point_tx_idx::PointTxnIdx;
78
pub use role_data::RoleData;
89
pub use role_number::RoleNumber;
@@ -12,6 +13,7 @@ pub use validation_signature::ValidationSignature;
1213
mod cert_key_hash;
1314
mod key_local_ref;
1415
mod payment_history;
16+
mod point_data;
1517
mod point_tx_idx;
1618
mod role_data;
1719
mod role_number;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//! Point and transaction index with its associated data.
2+
3+
use cardano_blockchain_types::{Point, TxnIndex};
4+
5+
use super::PointTxnIdx;
6+
7+
/// Point + transaction index with data.
8+
#[derive(Debug, Clone, PartialEq)]
9+
pub struct PointData<T> {
10+
/// Point and transaction index.
11+
point_txn_index: PointTxnIdx,
12+
/// Data associated to the point and transaction index.
13+
data: T,
14+
}
15+
16+
impl<T> PointData<T> {
17+
/// Creates an instance of point and transaction index with data.
18+
#[must_use]
19+
pub fn new(point_txn_index: PointTxnIdx, data: T) -> Self {
20+
Self {
21+
point_txn_index,
22+
data,
23+
}
24+
}
25+
26+
/// Get a reference to the data.
27+
pub fn data(&self) -> &T {
28+
&self.data
29+
}
30+
31+
/// Get the point.
32+
pub fn point(&self) -> &Point {
33+
self.point_txn_index.point()
34+
}
35+
36+
/// Get the transaction index.
37+
pub fn txn_index(&self) -> TxnIndex {
38+
self.point_txn_index.txn_index()
39+
}
40+
}

0 commit comments

Comments
 (0)