Skip to content

Commit

Permalink
fix multiera_drep_delegation not using drep credential
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Apr 8, 2024
1 parent bd2f3a6 commit b97c546
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion indexer/tasks/src/multiera/multiera_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ fn queue_address_credential(

// AlwaysAbstain and AlwaysNoConfidence are ignored here because we only can add
// relations to actual credentials
fn drep_to_credential(d_rep: &cml_chain::certs::DRep) -> Option<Credential> {
pub fn drep_to_credential(d_rep: &cml_chain::certs::DRep) -> Option<Credential> {
match d_rep {
cml_chain::certs::DRep::Key { pool, .. } => Some(StakeCredential::new_pub_key(*pool)),
cml_chain::certs::DRep::Script { script_hash, .. } => {
Expand Down
10 changes: 6 additions & 4 deletions indexer/tasks/src/multiera/multiera_drep_delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::collections::{BTreeMap, BTreeSet};
use std::ops::Deref;

use super::{
multiera_address::drep_to_credential,
multiera_address_credential_relations::QueuedAddressCredentialRelation,
multiera_txs::MultieraTransactionTask, relation_map::RelationMap,
};
Expand Down Expand Up @@ -61,19 +62,19 @@ async fn handle(
let (credential, drep) = match cert {
MultiEraCertificate::VoteDelegCert(delegation) => (
delegation.stake_credential.clone(),
Some(delegation.d_rep.to_cbor_bytes()),
drep_to_credential(&delegation.d_rep),
),
MultiEraCertificate::StakeVoteDelegCert(delegation) => (
delegation.stake_credential.clone(),
Some(delegation.d_rep.to_cbor_bytes()),
drep_to_credential(&delegation.d_rep),
),
MultiEraCertificate::VoteRegDelegCert(delegation) => (
delegation.stake_credential.clone(),
Some(delegation.d_rep.to_cbor_bytes()),
drep_to_credential(&delegation.d_rep),
),
MultiEraCertificate::StakeVoteRegDelegCert(delegation) => (
delegation.stake_credential.clone(),
Some(delegation.d_rep.to_cbor_bytes()),
drep_to_credential(&delegation.d_rep),
),
MultiEraCertificate::StakeDeregistration(deregistration) => {
(deregistration.stake_credential.clone(), None)
Expand All @@ -83,6 +84,7 @@ async fn handle(
};

let credential = credential.to_cbor_bytes();
let drep = drep.map(|cred| cred.to_cbor_bytes());

let stake_credential_id = multiera_stake_credential
.get(&credential.to_vec())
Expand Down

0 comments on commit b97c546

Please sign in to comment.