Skip to content

Commit 95af33a

Browse files
committed
feat: export modified chains
1 parent 9a9b4ad commit 95af33a

File tree

1 file changed

+9
-8
lines changed
  • rust/rbac-registration/src/registration/cardano

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl RegistrationChain {
8989
/// Creates or updates an RBAC registration chain from a CIP-509 registration.
9090
///
9191
/// If the given registration references a previous transaction, it attempts
92-
/// to update the existing chain using that previous transaction.
92+
/// to update the existing chain using that previous transaction.
9393
/// Otherwise, it starts a new chain from the provided registration.
9494
///
9595
/// # Returns
@@ -100,16 +100,19 @@ impl RegistrationChain {
100100
/// inferred.
101101
/// - [`RbacValidationError::InvalidRegistration`] if any validation, address, or key
102102
/// duplication inconsistencies are detected.
103-
#[must_use]
104103
pub async fn update_from_previous_txn<Provider>(
105104
reg: Cip509,
106105
provider: &Provider,
107-
) -> Result<Self, RbacValidationError>
106+
) -> Result<(Self, Vec<(CatalystId, HashSet<StakeAddress>)>), RbacValidationError>
108107
where
109108
Provider: RbacRegistrationProvider,
110109
{
111110
if let Some(previous_txn) = reg.previous_transaction() {
112-
RegistrationChainInner::update_from_previous_txn(reg, previous_txn, provider).await
111+
let result =
112+
RegistrationChainInner::update_from_previous_txn(reg, previous_txn, provider)
113+
.await?;
114+
115+
Ok((result, Vec::new()))
113116
} else {
114117
RegistrationChainInner::start_from_provider(reg, provider).await
115118
}
@@ -606,7 +609,6 @@ impl RegistrationChainInner {
606609
/// for `previous_txn`.
607610
/// - Returns [`RbacValidationError::InvalidRegistration`] if address/key duplication
608611
/// or validation inconsistencies are detected.
609-
#[must_use]
610612
pub async fn update_from_previous_txn<Provider>(
611613
reg: Cip509,
612614
previous_txn: TransactionId,
@@ -681,11 +683,10 @@ impl RegistrationChainInner {
681683
/// - [`RbacValidationError::UnknownCatalystId`]: if `reg` lacks a valid Catalyst ID.
682684
/// - [`RbacValidationError::InvalidRegistration`]: if any functional validation,
683685
/// stake address conflict, or public key duplication occurs.
684-
#[must_use]
685686
pub async fn start_from_provider<Provider>(
686687
reg: Cip509,
687688
provider: &Provider,
688-
) -> Result<RegistrationChain, RbacValidationError>
689+
) -> Result<(RegistrationChain, Vec<(CatalystId, HashSet<StakeAddress>)>), RbacValidationError>
689690
where
690691
Provider: RbacRegistrationProvider,
691692
{
@@ -763,7 +764,7 @@ impl RegistrationChainInner {
763764
});
764765
}
765766

766-
Ok(new_chain)
767+
Ok((new_chain, updated_chains.into_iter().collect()))
767768
}
768769
}
769770

0 commit comments

Comments
 (0)