Skip to content

Commit ef6c936

Browse files
committed
fix: track ShelleyAddress
Signed-off-by: bkioshn <[email protected]>
1 parent 85320da commit ef6c936

File tree

1 file changed

+11
-11
lines changed
  • rust/rbac-registration/src/registration/cardano

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use c509_certificate::c509::C509;
1111
use pallas::{
1212
crypto::hash::Hash,
1313
ledger::{
14-
addresses::{Address, ShelleyPaymentPart},
14+
addresses::{Address, ShelleyAddress, ShelleyPaymentPart},
1515
traverse::MultiEraTx,
1616
},
1717
network::miniprotocols::Point,
@@ -55,8 +55,8 @@ impl RegistrationChain {
5555
///
5656
/// Returns an error if data is invalid
5757
pub fn new(
58-
point: Point, tracking_payment_keys: Vec<ShelleyPaymentPart>, tx_idx: usize,
59-
txn: &MultiEraTx, cip509: Cip509,
58+
point: Point, tracking_payment_keys: Vec<ShelleyAddress>, tx_idx: usize, txn: &MultiEraTx,
59+
cip509: Cip509,
6060
) -> anyhow::Result<Self> {
6161
let inner = RegistrationChainInner::new(cip509, tracking_payment_keys, point, tx_idx, txn)?;
6262

@@ -130,13 +130,13 @@ impl RegistrationChain {
130130

131131
/// Get the list of payment keys to track.
132132
#[must_use]
133-
pub fn tracking_payment_keys(&self) -> &Vec<ShelleyPaymentPart> {
133+
pub fn tracking_payment_keys(&self) -> &Vec<ShelleyAddress> {
134134
&self.inner.tracking_payment_keys
135135
}
136136

137137
/// Get the map of tracked payment keys to its history.
138138
#[must_use]
139-
pub fn payment_history(&self) -> &HashMap<ShelleyPaymentPart, Vec<PaymentHistory>> {
139+
pub fn payment_history(&self) -> &HashMap<ShelleyAddress, Vec<PaymentHistory>> {
140140
&self.inner.payment_history
141141
}
142142
}
@@ -163,9 +163,9 @@ struct RegistrationChainInner {
163163
/// Map of role number to point, transaction index, and role data.
164164
role_data: HashMap<u8, (PointTxIdx, RoleData)>,
165165
/// List of payment keys to track.
166-
tracking_payment_keys: Arc<Vec<ShelleyPaymentPart>>,
166+
tracking_payment_keys: Arc<Vec<ShelleyAddress>>,
167167
/// Map of payment key to its history.
168-
payment_history: HashMap<ShelleyPaymentPart, Vec<PaymentHistory>>,
168+
payment_history: HashMap<ShelleyAddress, Vec<PaymentHistory>>,
169169
}
170170

171171
impl RegistrationChainInner {
@@ -183,8 +183,8 @@ impl RegistrationChainInner {
183183
///
184184
/// Returns an error if data is invalid
185185
fn new(
186-
cip509: Cip509, tracking_payment_keys: Vec<ShelleyPaymentPart>, point: Point,
187-
tx_idx: usize, txn: &MultiEraTx,
186+
cip509: Cip509, tracking_payment_keys: Vec<ShelleyAddress>, point: Point, tx_idx: usize,
187+
txn: &MultiEraTx,
188188
) -> anyhow::Result<Self> {
189189
// Should be chain root, return immediately if not
190190
if cip509.prv_tx_id.is_some() {
@@ -563,7 +563,7 @@ fn get_payment_addr_from_tx(
563563

564564
/// Update the payment history given the tracking payment keys.
565565
fn update_payment_history(
566-
tracking_key: &ShelleyPaymentPart, txn: &MultiEraTx, point_tx_idx: &PointTxIdx,
566+
tracking_key: &ShelleyAddress, txn: &MultiEraTx, point_tx_idx: &PointTxIdx,
567567
) -> anyhow::Result<Vec<PaymentHistory>> {
568568
let mut payment_history = Vec::new();
569569
if let MultiEraTx::Conway(tx) = txn {
@@ -574,7 +574,7 @@ fn update_payment_history(
574574
let address =
575575
Address::from_bytes(&o.address).map_err(|e| anyhow::anyhow!(e))?;
576576
let shelley_payment = if let Address::Shelley(addr) = address {
577-
addr.payment().clone()
577+
addr.clone()
578578
} else {
579579
bail!("Unsupported address type in update payment history");
580580
};

0 commit comments

Comments
 (0)