mirror of
https://github.com/haskoin/haskoin-core.git
synced 2024-09-11 10:05:34 +03:00
Add compatibility with latest nightly LTS Haskell
This commit is contained in:
parent
e1bfe4e7f4
commit
296a8dcc30
@ -5,6 +5,12 @@ 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).
|
||||
|
||||
## [1.0.1] - 2023-08-03
|
||||
|
||||
### Changed
|
||||
|
||||
- Do not use alternative monad for Either String values.
|
||||
|
||||
## [1.0.0] - 2023-07-28
|
||||
|
||||
### Changed
|
||||
|
@ -5,7 +5,7 @@ cabal-version: 1.12
|
||||
-- see: https://github.com/sol/hpack
|
||||
|
||||
name: haskoin-core
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
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: 1.0.0
|
||||
version: 1.0.1
|
||||
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
|
||||
|
@ -85,4 +85,4 @@ instance FromJSON Fingerprint where
|
||||
|
||||
instance ToJSON Fingerprint where
|
||||
toJSON = toJSON . fingerprintToText
|
||||
toEncoding = text . fingerprintToText
|
||||
toEncoding = text . fingerprintToText
|
||||
|
@ -3,9 +3,9 @@
|
||||
{-# LANGUAGE DerivingStrategies #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE NoFieldSelectors #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
|
||||
-- |
|
||||
-- Module : Haskoin.Network.Common
|
||||
|
@ -329,7 +329,7 @@ instance Marshal (Network, Ctx) TxSignature where
|
||||
instance MarshalJSON (Network, Ctx) TxSignature where
|
||||
marshalValue (net, ctx) = String . encodeHex . encodeTxSig net ctx
|
||||
marshalEncoding s = hexEncoding . runPutL . marshalPut s
|
||||
unmarshalValue (net, ctx) =
|
||||
unmarshalValue (net, ctx) =
|
||||
withText "TxSignature" $ \t ->
|
||||
case decodeHex t of
|
||||
Nothing -> fail "Cannot decode hex signature"
|
||||
|
@ -185,7 +185,9 @@ decodeOutput ctx s = case s.ops of
|
||||
-- Provably unspendable data carrier output
|
||||
[OP_RETURN, OP_PUSHDATA bs _] -> Right $ DataCarrier bs
|
||||
-- Pay to MultiSig Keys
|
||||
_ -> matchPayMulSig ctx s <|> Left "decodeOutput: Non-standard output"
|
||||
_ -> case matchPayMulSig ctx s of
|
||||
Right x -> return x
|
||||
Left _ -> Left "decodeOutput: Non-standard output"
|
||||
|
||||
witnessVersionOp :: Word8 -> Maybe ScriptOp
|
||||
witnessVersionOp 0 = Just OP_0
|
||||
|
@ -61,7 +61,7 @@ import Data.Bytes.Put
|
||||
import Data.Bytes.Serial
|
||||
import Data.Conduit (ConduitT, Void, await, runConduit, (.|))
|
||||
import Data.Conduit.List (sourceList)
|
||||
import Data.Either (fromRight)
|
||||
import Data.Either (fromRight, rights)
|
||||
import Data.List (nub)
|
||||
import Data.Maybe (catMaybes, fromJust, isJust)
|
||||
import Data.String.Conversions (cs)
|
||||
@ -509,9 +509,11 @@ verifyStdInput net ctx tx i so0 val
|
||||
| isSegwit so0 =
|
||||
fromRight False $ (inp == mempty &&) . verifySegwitInput so0 <$> wp so0
|
||||
| otherwise =
|
||||
fromRight False $
|
||||
(verifyLegacyInput so0 <$> unmarshal (net, ctx) inp)
|
||||
<|> (nestedScriptOutput >>= \so -> verifyNestedInput so0 so <$> wp so)
|
||||
or $
|
||||
rights
|
||||
[ verifyLegacyInput so0 <$> unmarshal (net, ctx) inp,
|
||||
nestedScriptOutput >>= \so -> verifyNestedInput so0 so <$> wp so
|
||||
]
|
||||
where
|
||||
inp = (tx.inputs !! i).script
|
||||
theTxSigHash so = Sign.makeSigHash net ctx tx i so val
|
||||
|
@ -55,8 +55,7 @@ where
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.DeepSeq (NFData)
|
||||
import Control.Monad (foldM, guard, replicateM, void)
|
||||
import Control.Monad.Cont (unless)
|
||||
import Control.Monad (foldM, guard, replicateM, unless, void)
|
||||
import Crypto.Secp256k1
|
||||
import Data.Binary (Binary (..))
|
||||
import Data.ByteString (ByteString)
|
||||
|
@ -119,8 +119,8 @@ integerToBS i
|
||||
f x = Just (fromInteger x :: Word8, x `shiftR` 8)
|
||||
|
||||
hexEncoding :: LB.ByteString -> Encoding
|
||||
hexEncoding b =
|
||||
unsafeToEncoding $
|
||||
hexEncoding b =
|
||||
unsafeToEncoding $
|
||||
char7 '"' <> hexBuilder b <> char7 '"'
|
||||
|
||||
hexBuilder :: LB.ByteString -> Builder
|
||||
|
@ -41,4 +41,4 @@ marshalJSON :: (MarshalJSON s a) => s -> a -> Lazy.ByteString
|
||||
marshalJSON s = toLazyByteString . fromEncoding . marshalEncoding s
|
||||
|
||||
unmarshalJSON :: (MarshalJSON s a) => s -> Lazy.ByteString -> Maybe a
|
||||
unmarshalJSON s = parseMaybe (unmarshalValue s) <=< decode
|
||||
unmarshalJSON s = parseMaybe (unmarshalValue s) <=< decode
|
||||
|
@ -1,8 +1,7 @@
|
||||
resolver: lts-21.4
|
||||
resolver: nightly-2023-08-02
|
||||
nix:
|
||||
packages:
|
||||
- secp256k1
|
||||
- pkg-config
|
||||
extra-deps:
|
||||
- base16-1.0@sha256:9b72a280a7af75a5026fa25a1b8ae18ec10200a070947723f1fd61dc8d407862,2472
|
||||
- secp256k1-haskell-1.0.0@sha256:42e1dc0ddba74b752bddf7d55c19aa10b24ff6f51889a53bc07c2ff2107aca16,2082
|
||||
|
@ -4,13 +4,6 @@
|
||||
# https://docs.haskellstack.org/en/stable/lock_files
|
||||
|
||||
packages:
|
||||
- completed:
|
||||
hackage: base16-1.0@sha256:9b72a280a7af75a5026fa25a1b8ae18ec10200a070947723f1fd61dc8d407862,2472
|
||||
pantry-tree:
|
||||
sha256: 3a0f4b633d58e312d6e6fa556c7abbd0f483ebc35d767a77315f98e2d9840fd8
|
||||
size: 1457
|
||||
original:
|
||||
hackage: base16-1.0@sha256:9b72a280a7af75a5026fa25a1b8ae18ec10200a070947723f1fd61dc8d407862,2472
|
||||
- completed:
|
||||
hackage: secp256k1-haskell-1.0.0@sha256:42e1dc0ddba74b752bddf7d55c19aa10b24ff6f51889a53bc07c2ff2107aca16,2082
|
||||
pantry-tree:
|
||||
@ -20,7 +13,7 @@ packages:
|
||||
hackage: secp256k1-haskell-1.0.0@sha256:42e1dc0ddba74b752bddf7d55c19aa10b24ff6f51889a53bc07c2ff2107aca16,2082
|
||||
snapshots:
|
||||
- completed:
|
||||
sha256: caa77fdbc5b9f698262b21ee78030133272ec53116ad6ddbefdc4c321f668e0c
|
||||
size: 640014
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/4.yaml
|
||||
original: lts-21.4
|
||||
sha256: d4a54df12888fc5d1ef2d4ff987225fa7bedb2cff74385b33fbec4a384ebd619
|
||||
size: 644615
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/8/2.yaml
|
||||
original: nightly-2023-08-02
|
||||
|
@ -7,6 +7,7 @@ module Haskoin.BlockSpec
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Monad
|
||||
import Control.Monad.State.Strict
|
||||
import Data.Either (fromRight)
|
||||
import Data.Maybe (fromJust)
|
||||
|
Loading…
Reference in New Issue
Block a user