Skip to content

Commit

Permalink
Merge pull request #57 from obsidiansystems/ipfs-cleanups
Browse files Browse the repository at this point in the history
Cleanups
  • Loading branch information
Ericson2314 committed Jul 9, 2020
2 parents 2928587 + f14fbe5 commit 1e722ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/libstore/content-address.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ void from_json(const nlohmann::json& j, LegacyContentAddress & ca) {
}

// f01781114 is the cid prefix for a base16 cbor sha1. This hash
// stores the ContentAddress information. The hash (without the cid
// prefix) will be put directly in the store path hash.
// stores the ContentAddress information.

void to_json(nlohmann::json& j, const ContentAddress & ca)
{
Expand Down Expand Up @@ -316,10 +315,9 @@ void from_json(const nlohmann::json& j, PathReferences<IPFSRef> & references)
{
std::set<IPFSRef> refs;
for (auto & ref : j.at("references")) {
auto name = ref.at("name").get<std::string>();
auto cid = ref.at("cid").at("/").get<std::string>();
refs.insert(IPFSRef {
.name = name,
.name = ref.at("name").get<std::string>(),
.hash = Hash::parseAny(std::string(cid, 9), htSHA256)
});
}
Expand Down
5 changes: 5 additions & 0 deletions tests/ipfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ numRefs=$(nix-store -q --references $rewrite | wc -l)

nix copy $rewrite --to ipfs://

# verify ipfs has it
cid=f01711220$(nix to-base16 $(echo $ca | sed s,^ipfs:,,))
[ $(ipfs dag get $cid | jq -r .qtype) = ipfs ]
[ $(ipfs dag get $cid | jq -r .name) = dependencies-top ]

nix-store --delete $rewrite

path5=$(nix --experimental-features 'nix-command ca-references' ensure-ca full:dependencies-top:$ca --substituters ipfs:// --option substitute true)
Expand Down

0 comments on commit 1e722ed

Please sign in to comment.