create credentials using blake2b_224

datum hash should be 256 bits(32 bytes)
This commit is contained in:
Hongrui Fang 2022-06-23 21:51:26 +08:00
parent 54cad6b915
commit 435050f204
5 changed files with 37 additions and 28 deletions

View file

@ -88,7 +88,7 @@ instance PTryFrom PData (PAsData PDatumHash) where
ptryFrom' opq = runTermCont $ do
(wrapped :: Term _ (PAsData PByteString), unwrapped :: Term _ PByteString) <-
tcont $ ptryFrom @(PAsData PByteString) opq
tcont $ \f -> pif (plengthBS # unwrapped #== 64) (f ()) (ptraceError "a DatumHash should be 64 bytes long")
tcont $ \f -> pif (plengthBS # unwrapped #== 32) (f ()) (ptraceError "a DatumHash should be 32 bytes long")
pure (punsafeCoerce wrapped, punsafeCoerce unwrapped)
-- | @since 0.1.0