Skip to content

Commit

Permalink
Add workaround for compiler error
Browse files Browse the repository at this point in the history
  • Loading branch information
maltekliemann committed Apr 20, 2022
1 parent 016c208 commit cde754a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions zrml/prediction-markets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ mod pallet {
Self::ensure_market_start_is_in_time(&period)?;
}

// Require sha3-384 as multihash.
let MultiHash::Sha3_384(multihash) = metadata;
// Require sha3-384 as multihash. TODO The irrefutable `if let` is a workaround for a
// compiler error. Link an issue for this!
let multihash =
if let MultiHash::Sha3_384(multihash) = metadata { multihash } else { [0u8; 50] };
ensure!(multihash[0] == 0x15 && multihash[1] == 0x30, <Error<T>>::InvalidMultihash);

let status: MarketStatus = match creation {
Expand Down Expand Up @@ -583,8 +585,10 @@ mod pallet {
Self::ensure_market_start_is_in_time(&period)?;
}

// Require sha3-384 as multihash.
let MultiHash::Sha3_384(multihash) = metadata;
// Require sha3-384 as multihash. TODO The irrefutable `if let` is a workaround for a
// compiler error. Link an issue for this!
let multihash =
if let MultiHash::Sha3_384(multihash) = metadata { multihash } else { [0u8; 50] };
ensure!(multihash[0] == 0x15 && multihash[1] == 0x30, <Error<T>>::InvalidMultihash);

let status: MarketStatus = match creation {
Expand Down

0 comments on commit cde754a

Please sign in to comment.