Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucsanszky committed Oct 7, 2024
1 parent 852bd96 commit aa30e39
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ data CertKey c
txCertKey :: ConwayTxCert era -> CertKey (EraCrypto era)
txCertKey (ConwayTxCertDeleg (ConwayRegCert x _)) = StakeKey x
txCertKey (ConwayTxCertDeleg (ConwayUnRegCert x _)) = StakeKey x
txCertKey (ConwayTxCertDeleg (ConwayDelegCert x y)) = txCertDelegateeKey x y
txCertKey (ConwayTxCertDeleg (ConwayRegDelegCert x y _)) = txCertDelegateeKey x y
txCertKey (ConwayTxCertDeleg (ConwayDelegCert x _)) = StakeKey x
txCertKey (ConwayTxCertDeleg (ConwayRegDelegCert x _ _)) = StakeKey x
txCertKey (ConwayTxCertPool (RegPool x)) = PoolKey (ppId x)
txCertKey (ConwayTxCertPool (RetirePool x _)) = PoolKey x
txCertKey (ConwayTxCertGov (ConwayRegDRep x _ _)) = DRepKey x
Expand All @@ -167,6 +167,13 @@ txCertDelegateeKey _ (DelegVote (DRepCredential y)) = DRepKey y
txCertDelegateeKey _ (DelegStake y) = PoolKey y
txCertDelegateeKey x _ = StakeKey x

check :: ConwayTxCert era -> ConwayTxCert era -> Bool
check x y@(ConwayTxCertDeleg (ConwayDelegCert a b)) =
txCertKey x /= txCertKey y && txCertKey x /= txCertDelegateeKey a b
check x y@(ConwayTxCertDeleg (ConwayRegDelegCert a b _)) =
txCertKey x /= txCertKey y && txCertKey x /= txCertDelegateeKey a b
check x y = txCertKey x /= txCertKey y

noSameKeys :: [ConwayTxCert era] -> [ConwayTxCert era]
noSameKeys [] = []
noSameKeys (x : xs) = x : noSameKeys (filter (\y -> txCertKey x /= txCertKey y) xs)
noSameKeys (x : xs) = x : noSameKeys (filter (check x) xs)

0 comments on commit aa30e39

Please sign in to comment.