Skip to content

Commit

Permalink
Use correct multihash algorithm code for WebRTC addresses (#1036)
Browse files Browse the repository at this point in the history
* Use correct multihash algorithm code for WebRTC addresses

* CHANGELOG

---------

Co-authored-by: Pierre Krieger <[email protected]>
  • Loading branch information
altonen and tomaka authored Aug 15, 2023
1 parent b190aea commit e9872e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions light-base/src/platform/address_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn multiaddr_to_address(multiaddr: &Multiaddr) -> Result<AddressOrMultiStrea
) => {
// TODO: unwrapping is hacky because Multiaddr is supposed to guarantee that this is a valid multihash but doesn't due to typing issues
let multihash = multihash::MultihashRef::from_bytes(&hash).unwrap();
if multihash.hash_algorithm_code() != 12 {
if multihash.hash_algorithm_code() != 0x12 {
return Err(Error::NonSha256Certhash);
}
let Ok(&remote_certificate_sha256) = <&[u8; 32]>::try_from(multihash.data())
Expand All @@ -129,7 +129,7 @@ pub fn multiaddr_to_address(multiaddr: &Multiaddr) -> Result<AddressOrMultiStrea
) => {
// TODO: unwrapping is hacky because Multiaddr is supposed to guarantee that this is a valid multihash but doesn't due to typing issues
let multihash = multihash::MultihashRef::from_bytes(&hash).unwrap();
if multihash.hash_algorithm_code() != 12 {
if multihash.hash_algorithm_code() != 0x12 {
return Err(Error::NonSha256Certhash);
}
let Ok(&remote_certificate_sha256) = <&[u8; 32]>::try_from(multihash.data())
Expand Down
4 changes: 4 additions & 0 deletions wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- It is now possible for parachain chain specifications to include just a `genesis.stateRootHash` field (and no `genesis.raw` field). A warning in the logs is now printed for all chain specifications that include a `genesis.raw` field. ([#1034](https://github.com/smol-dot/smoldot/pull/1034))

### Fixed

- Fix WebRTC addresses failing to be be parsed. ([#1036](https://github.com/smol-dot/smoldot/pull/1036))

## 1.0.16 - 2023-08-14

### Changed
Expand Down

0 comments on commit e9872e1

Please sign in to comment.