Skip to content

Commit

Permalink
Add real mock hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed May 4, 2021
1 parent 683186d commit 9bdd372
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -24,11 +24,15 @@ import Cardano.Wallet.Primitive.AddressDerivation
import Cardano.Wallet.Primitive.AddressDiscovery.Delegation
import Cardano.Wallet.Primitive.Types.Coin
( Coin (..) )
import Cardano.Wallet.Primitive.Types.Hash
( Hash (..) )
import Cardano.Wallet.Primitive.Types.Tx
( TxIn, TxOut )
import Control.Monad.Trans.Class
( lift )
import Control.Monad.Trans.State.Strict
import Crypto.Hash.Utils
( blake2b224 )
import Data.Either
( isRight )
import Data.Set
Expand Down Expand Up @@ -188,9 +192,9 @@ apply :: [Tx] -> DelegationState StakeKey' -> DelegationState StakeKey'
apply txs s = foldl (flip applyTx') s txs

applyTx' :: Tx -> DelegationState StakeKey' -> DelegationState StakeKey'
applyTx' (Tx cs is os) = applyTx txid is os cs
applyTx' tx@(Tx cs is os) = applyTx txid is os cs
where
txid = error "todo: txid"
txid = Hash . blake2b224 . B8.pack $ show tx

applyLedger
:: [Tx]
Expand All @@ -203,7 +207,6 @@ applyLedger txs = execStateT (mapM_ applyTxLedger txs)
-> StateT Ledger (Either String) ()
applyTxLedger tx = mapM_ applyCert' (certs tx)
-- TODO: mock ledger also needs to check UTxO rules

applyCert' c = do
l <- get
l' <- lift (ledgerApplyCert c l)
Expand Down

0 comments on commit 9bdd372

Please sign in to comment.