Skip to content

Commit c32f483

Browse files
committed
fix(rbac-registration): add more test to registration chain
Signed-off-by: bkioshn <[email protected]>
1 parent 8999010 commit c32f483

File tree

1 file changed

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

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ impl RegistrationChainInner {
202202
// Previous transaction ID in the CIP509 should equal to the current transaction ID
203203
// or else it is not a part of the chain
204204
if prv_tx_id == self.current_tx_id_hash {
205-
new_inner.current_tx_id_hash = prv_tx_id;
205+
// Update the current transaction ID hash
206+
new_inner.current_tx_id_hash = cip509.txn_hash();
206207
} else {
207208
bail!("Invalid previous transaction ID, not a part of this registration chain");
208209
}
@@ -458,6 +459,12 @@ mod test {
458459
"{:#?}",
459460
registration.report()
460461
);
461-
chain.update(registration).unwrap();
462+
let update = chain.update(registration).unwrap();
463+
464+
// Current tx hash should updated to RBAC data in block 4
465+
assert_eq!(update.current_tx_id_hash().to_string(), data.tx_hash);
466+
assert!(update
467+
.role_data()
468+
.contains_key(&RoleNumber::from(data.role)));
462469
}
463470
}

0 commit comments

Comments
 (0)