Skip to content
Snippets Groups Projects
Commit 773c2462 authored by Jorropo's avatar Jorropo Committed by Antonio Navarro Perez
Browse files

fix: ensure hasher is registered when using a hashing function

Fixes #9297
parent baccaef1
Branches
Tags
No related merge requests found
......@@ -210,6 +210,9 @@ See 'dag export' and 'dag import' for more information.
if !ok {
return fmt.Errorf("unrecognized hash function: %q", strings.ToLower(hashFunStr))
}
if _, err := mh.GetHasher(hashFunCode); err != nil {
return err
}
enc, err := cmdenv.GetCidEncoder(req)
if err != nil {
......
......@@ -93,6 +93,10 @@ EOF
test_cmp expected actual
'
test_expect_failure "'ipfs add' with an unregistered hash and wrapped leaves fails without crashing" '
ipfs add --hash poseidon-bls12_381-a2-fc1 --raw-leaves=false -r mountdir/planets
'
}
# should work offline
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment