mirror of
https://github.com/haskoin/haskoin-core.git
synced 2024-09-11 10:05:34 +03:00
Fix witness decoder
This commit is contained in:
parent
73fcd3c401
commit
147152343c
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 0.20.4
|
||||
### Fixed
|
||||
- Add missing case for witness version.
|
||||
|
||||
## 0.20.3
|
||||
### Fixed
|
||||
- Allow unknown inv types.
|
||||
|
@ -4,10 +4,10 @@ cabal-version: 1.12
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 51a1645e2f8c2dc54a6cc91c03a262683a314702f2ffbc182667967b50e88f6f
|
||||
-- hash: d57876572e143601ab9185c42f47f703460c4e8396b846f805068a5cff8fec3e
|
||||
|
||||
name: haskoin-core
|
||||
version: 0.20.3
|
||||
version: 0.20.4
|
||||
synopsis: Bitcoin & Bitcoin Cash library for Haskell
|
||||
description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-core#readme>
|
||||
category: Bitcoin, Finance, Network
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: haskoin-core
|
||||
version: 0.20.3
|
||||
version: 0.20.4
|
||||
synopsis: Bitcoin & Bitcoin Cash library for Haskell
|
||||
description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-core#readme>
|
||||
category: Bitcoin, Finance, Network
|
||||
|
@ -19,6 +19,7 @@ module Haskoin.Address
|
||||
Address(..)
|
||||
, isPubKeyAddress
|
||||
, isScriptAddress
|
||||
, isWitnessAddress
|
||||
, isWitnessPubKeyAddress
|
||||
, isWitnessScriptAddress
|
||||
, addrToText
|
||||
|
@ -34,7 +34,6 @@ module Haskoin.Keys.Common
|
||||
, toWif
|
||||
) where
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.DeepSeq
|
||||
import Control.Monad (guard, mzero, (<=<))
|
||||
import Crypto.Secp256k1
|
||||
@ -80,7 +79,7 @@ instance ToJSON PubKeyI where
|
||||
|
||||
instance FromJSON PubKeyI where
|
||||
parseJSON = withText "PubKeyI" $
|
||||
maybe mzero return . (eitherToMaybe . runGetS deserialize =<<) . decodeHex
|
||||
maybe mzero return . ((eitherToMaybe . runGetS deserialize) <=< decodeHex)
|
||||
|
||||
instance Serial PubKeyI where
|
||||
deserialize = s >>= \case
|
||||
|
@ -493,7 +493,7 @@ instance Serial VarInt where
|
||||
go 0xff = getWord64le
|
||||
go 0xfe = fromIntegral <$> getWord32le
|
||||
go 0xfd = fromIntegral <$> getWord16le
|
||||
go x = fromIntegral <$> return x
|
||||
go x = return $ fromIntegral x
|
||||
|
||||
serialize (VarInt x)
|
||||
| x < 0xfd =
|
||||
|
@ -20,6 +20,7 @@ module Haskoin.Script.Standard
|
||||
, isPayPKHash
|
||||
, isPayMulSig
|
||||
, isPayScriptHash
|
||||
, isPayWitness
|
||||
, isPayWitnessPKHash
|
||||
, isPayWitnessScriptHash
|
||||
, isDataCarrier
|
||||
@ -56,7 +57,7 @@ import Data.Bytes.Serial
|
||||
import Data.Function (on)
|
||||
import Data.Hashable
|
||||
import Data.List (sortBy)
|
||||
import Data.Maybe (fromJust, isJust, isNothing)
|
||||
import Data.Maybe (fromJust, isJust)
|
||||
import Data.Word (Word8)
|
||||
import GHC.Generics (Generic)
|
||||
import Haskoin.Constants
|
||||
@ -189,6 +190,7 @@ witnessVersionOp 13 = Just OP_13
|
||||
witnessVersionOp 14 = Just OP_14
|
||||
witnessVersionOp 15 = Just OP_15
|
||||
witnessVersionOp 16 = Just OP_16
|
||||
witnessVersionOp _ = Nothing
|
||||
|
||||
opWitnessVersion :: ScriptOp -> Maybe Word8
|
||||
opWitnessVersion OP_0 = Just 0
|
||||
|
Loading…
Reference in New Issue
Block a user