fix: decode unified addresses with no transparent receivers
ensures that a unified address that does not contain a transparent receiver is properly represented in the type
This commit is contained in:
parent
0b2fae2b5d
commit
85a4741dcb
4 changed files with 10 additions and 4 deletions
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.6.2.3]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Decoding of unified addresses with no transparent receivers
|
||||||
|
|
||||||
## [0.6.2.2]
|
## [0.6.2.2]
|
||||||
|
|
||||||
- Added JSON instances for `ZcashNet`
|
- Added JSON instances for `ZcashNet`
|
||||||
|
|
|
@ -103,9 +103,9 @@ isValidUnifiedAddress str =
|
||||||
(if BS.length (raw_s x) == 43
|
(if BS.length (raw_s x) == 43
|
||||||
then Just $ SaplingReceiver (raw_s x)
|
then Just $ SaplingReceiver (raw_s x)
|
||||||
else Nothing)
|
else Nothing)
|
||||||
(if not (BS.null (raw_t x))
|
(if BS.length (raw_t x) > 1
|
||||||
then Just $ TransparentReceiver P2PKH (fromRawBytes $ raw_t x)
|
then Just $ TransparentReceiver P2PKH (fromRawBytes $ raw_t x)
|
||||||
else if not (BS.null (raw_to x))
|
else if BS.length (raw_to x) > 1
|
||||||
then Just $ TransparentReceiver P2SH (fromRawBytes $ raw_to x)
|
then Just $ TransparentReceiver P2SH (fromRawBytes $ raw_to x)
|
||||||
else Nothing)
|
else Nothing)
|
||||||
|
|
||||||
|
|
|
@ -1143,7 +1143,7 @@ main = do
|
||||||
case exch of
|
case exch of
|
||||||
Nothing -> assertFailure "Failed to encode Exchange address"
|
Nothing -> assertFailure "Failed to encode Exchange address"
|
||||||
Just addr -> do
|
Just addr -> do
|
||||||
let eadr = decodeExchangeAddress addr
|
let eadr = decodeExchangeAddress (E.encodeUtf8 addr)
|
||||||
eadr `shouldNotBe` Nothing
|
eadr `shouldNotBe` Nothing
|
||||||
describe "Witness updates" $ do
|
describe "Witness updates" $ do
|
||||||
it "Sapling" $ do
|
it "Sapling" $ do
|
||||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 3.0
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
version: 0.6.2.2
|
version: 0.6.2.3
|
||||||
synopsis: Utilities to interact with the Zcash blockchain
|
synopsis: Utilities to interact with the Zcash blockchain
|
||||||
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
||||||
category: Blockchain
|
category: Blockchain
|
||||||
|
|
Loading…
Reference in a new issue