packages feed

haskoin-core 0.8.1 → 0.8.2

raw patch · 10 files changed

+59/−35 lines, 10 files

Files

CHANGELOG.md view
@@ -4,6 +4,10 @@ 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.8.2+### Added+- Recognize `OP_CHECKDATASIG` and `OP_CHECKDATASIGVERIFY` opcodes.+ ## 0.8.1 ### Added - Add instances of `Hashable` and `Generic` where possible.
haskoin-core.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: d7e0b231b457cf236bd574573b0f30a57243822185cba58241e94d2b2c790137+-- hash: fb07b24827c8cd485087089da804cd759c477e30d0ea540ed2c8f3152853d517  name:           haskoin-core-version:        0.8.1+version:        0.8.2 synopsis:       Bitcoin & Bitcoin Cash library for Haskell description:    Haskoin Core is a complete Bitcoin and Bitcoin Cash library of functions and data types for Haskell developers. category:       Bitcoin, Finance, Network
src/Network/Haskoin/Block/Common.hs view
@@ -73,7 +73,7 @@         return $ Block header txs     put (Block h txs) = do         put h-        put $ VarInt $ fromIntegral $ length txs+        putVarInt $ length txs         forM_ txs put  -- | Block header hash. To be serialized reversed for display purposes.@@ -200,7 +200,7 @@ putGetBlockMsg :: Word32 -> BlockLocator -> BlockHash -> Put putGetBlockMsg v xs h = do     putWord32le v-    put $ VarInt $ fromIntegral $ length xs+    putVarInt $ length xs     forM_ xs put     put h @@ -248,7 +248,7 @@         action = liftM2 (,) get get      put (Headers xs) = do-        put $ VarInt $ fromIntegral $ length xs+        putVarInt $ length xs         forM_ xs $ \(a,b) -> put a >> put b  -- | Decode the compact number used in the difficulty target of a block.
src/Network/Haskoin/Block/Merkle.hs view
@@ -88,10 +88,10 @@     put (MerkleBlock h ntx hashes flags) = do         put h         putWord32le ntx-        put $ VarInt $ fromIntegral $ length hashes+        putVarInt $ length hashes         forM_ hashes put         let ws = encodeMerkleFlags flags-        put $ VarInt $ fromIntegral $ length ws+        putVarInt $ length ws         forM_ ws putWord8  -- | Unpack Merkle flags into 'FlagBits' structure.
src/Network/Haskoin/Keys/Extended.hs view
@@ -14,10 +14,12 @@ -} module Network.Haskoin.Keys.Extended     (+      -- * Extended Keys       XPubKey(..)     , XPrvKey(..)     , ChainCode     , KeyIndex+    , Fingerprint     , DerivationException(..)     , makeXPrvKey     , deriveXPubKey@@ -47,7 +49,7 @@     , getXPrvKey     , getXPubKey -      -- ** Helpers+      -- ** Helper Functions     , prvSubKeys     , pubSubKeys     , hardSubKeys@@ -76,7 +78,7 @@     , listToPath     , pathToList -      -- ** Derivation Path Parser+      -- *** Derivation Path Parser     , XKey(..)     , ParsedPath(..)     , parsePath@@ -141,15 +143,18 @@ -- | Index of key as specified in BIP-32. type KeyIndex = Word32 +-- | Fingerprint of parent+type Fingerprint = Word32+ -- | Data type representing an extended BIP32 private key. An extended key -- is a node in a tree of key derivations. It has a depth in the tree, a -- parent node and an index to differentiate it from other siblings. data XPrvKey = XPrvKey-    { xPrvDepth  :: !Word8     -- ^ depth in the tree-    , xPrvParent :: !Word32    -- ^ fingerprint of parent-    , xPrvIndex  :: !KeyIndex  -- ^ derivation index-    , xPrvChain  :: !ChainCode -- ^ chain code-    , xPrvKey    :: !SecKey    -- ^ private key of this node+    { xPrvDepth  :: !Word8       -- ^ depth in the tree+    , xPrvParent :: !Fingerprint -- ^ fingerprint of parent+    , xPrvIndex  :: !KeyIndex    -- ^ derivation index+    , xPrvChain  :: !ChainCode   -- ^ chain code+    , xPrvKey    :: !SecKey      -- ^ private key of this node     } deriving (Generic, Eq, Show, Read)  xPrvToJSON :: Network -> XPrvKey -> Value@@ -158,11 +163,11 @@ -- | Data type representing an extended BIP32 public key. data XPubKey = XPubKey     { xPubDepth  :: !Word8     -- ^ depth in the tree-    , xPubParent :: !Word32    -- ^ fingerprint of parent+    , xPubParent :: !Fingerprint    -- ^ fingerprint of parent     , xPubIndex  :: !KeyIndex  -- ^ derivation index     , xPubChain  :: !ChainCode -- ^ chain code     , xPubKey    :: !PubKey    -- ^ public key of this node-    } deriving (Eq, Show, Read)+    } deriving (Generic, Eq, Show, Read)   -- | Decode an extended public key from a JSON string@@ -288,14 +293,14 @@ xPubID = ripemd160 . encode . sha256 . exportPubKey True . xPubKey  -- | Computes the key fingerprint of an extended private key.-xPrvFP :: XPrvKey -> Word32+xPrvFP :: XPrvKey -> Fingerprint xPrvFP =     fromRight err . decode . B.take 4 . encode . xPrvID   where     err = error "Could not decode xPrvFP"  -- | Computes the key fingerprint of an extended public key.-xPubFP :: XPubKey -> Word32+xPubFP :: XPubKey -> Fingerprint xPubFP =     fromRight err . decode . B.take 4 . encode . xPubID   where
src/Network/Haskoin/Network/Bloom.hs view
@@ -106,7 +106,7 @@         readDat (VarInt len) = replicateM (fromIntegral len) getWord8      put (BloomFilter dat hashFuncs tweak flags) = do-        put $ VarInt $ fromIntegral $ S.length dat+        putVarInt $ S.length dat         forM_ (F.toList dat) putWord8         putWord32le hashFuncs         putWord32le tweak@@ -132,7 +132,7 @@         return $ FilterAdd dat      put (FilterAdd bs) = do-        put $ VarInt $ fromIntegral $ BS.length bs+        putVarInt $ BS.length bs         putByteString bs  
src/Network/Haskoin/Network/Common.hs view
@@ -38,6 +38,7 @@     , nodeXThin     , commandToString     , stringToCommand+    , putVarInt     ) where  import           Control.Monad               (forM_, liftM2, replicateM, unless)@@ -74,7 +75,7 @@         action             = liftM2 (,) getWord32le S.get      put (Addr xs) = do-        put $ VarInt $ fromIntegral $ length xs+        putVarInt $ length xs         forM_ xs $ \(a,b) -> putWord32le a >> put b  -- | Data type describing signed messages that can be sent between bitcoin@@ -111,7 +112,7 @@         repList (VarInt c) = replicateM (fromIntegral c) S.get      put (GetData xs) = do-        put $ VarInt $ fromIntegral $ length xs+        putVarInt $ length xs         forM_ xs put  -- | 'Inv' messages are used by nodes to advertise their knowledge of new@@ -130,7 +131,7 @@         repList (VarInt c) = replicateM (fromIntegral c) S.get      put (Inv xs) = do-        put $ VarInt $ fromIntegral $ length xs+        putVarInt $ length xs         forM_ xs put  -- | Data type identifying the type of an inventory vector. SegWit types are@@ -248,7 +249,7 @@         repList (VarInt c) = replicateM (fromIntegral c) S.get      put (NotFound xs) = do-        put $ VarInt $ fromIntegral $ length xs+        putVarInt $ length xs         forM_ xs put  -- | A 'Ping' message is sent to bitcoin peers to check if a connection is still@@ -373,6 +374,9 @@             putWord8 0xff             putWord64le x +putVarInt :: Integral a => a -> Put+putVarInt = put . VarInt . fromIntegral+ -- | Data type for serialization of variable-length strings. newtype VarString = VarString { getVarString :: ByteString }     deriving (Eq, Show, Read)@@ -384,7 +388,7 @@         readBS (VarInt len) = getByteString (fromIntegral len)      put (VarString bs) = do-        put $ VarInt $ fromIntegral $ B.length bs+        putVarInt $ B.length bs         putByteString bs  -- | When a bitcoin node creates an outgoing connection to another node,
src/Network/Haskoin/Script/Common.hs view
@@ -210,6 +210,9 @@     | OP_NOP8     | OP_NOP9     | OP_NOP10+      -- Bitcoin Cash Nov 2018 hard fork+    | OP_CHECKDATASIG+    | OP_CHECKDATASIGVERIFY       -- Other     | OP_PUBKEYHASH     | OP_PUBKEY@@ -359,6 +362,10 @@             | op == 0xb8 = return OP_NOP9             | op == 0xb9 = return OP_NOP10 +            -- Bitcoin Cash Nov 2018 hard fork+            | op == 0xba = return OP_CHECKDATASIG+            | op == 0xbb = return OP_CHECKDATASIGVERIFY+             -- Constants             | op == 0xfd = return OP_PUBKEYHASH             | op == 0xfe = return OP_PUBKEY@@ -521,6 +528,10 @@         OP_NOP8              -> putWord8 0xb7         OP_NOP9              -> putWord8 0xb8         OP_NOP10             -> putWord8 0xb9++        -- Bitcoin Cash Nov 2018 hard fork+        OP_CHECKDATASIG      -> putWord8 0xba+        OP_CHECKDATASIGVERIFY -> putWord8 0xbb   -- | Check whether opcode is only data.
src/Network/Haskoin/Script/SigHash.hs view
@@ -277,7 +277,7 @@         | otherwise = zeros     putScript s = do         let encodedScript = encode s-        put $ VarInt $ fromIntegral $ BS.length encodedScript+        putVarInt $ BS.length encodedScript         putByteString encodedScript     zeros :: Hash256     zeros = "0000000000000000000000000000000000000000000000000000000000000000"
src/Network/Haskoin/Transaction/Common.hs view
@@ -1,6 +1,6 @@-{-# LANGUAGE DeriveAnyClass             #-}-{-# LANGUAGE DeriveGeneric              #-}-{-# LANGUAGE OverloadedStrings          #-}+{-# LANGUAGE DeriveAnyClass    #-}+{-# LANGUAGE DeriveGeneric     #-}+{-# LANGUAGE OverloadedStrings #-} {-| Module      : Network.Haskoin.Transaction.Common Copyright   : No rights reserved@@ -129,9 +129,9 @@  putInOut :: Tx -> Put putInOut tx = do-    put $ VarInt $ fromIntegral $ length (txIn tx)+    putVarInt $ length (txIn tx)     forM_ (txIn tx) put-    put $ VarInt $ fromIntegral $ length (txOut tx)+    putVarInt $ length (txOut tx)     forM_ (txOut tx) put  -- | Non-SegWit transaction serializer.@@ -197,10 +197,10 @@ putWitnessData = mapM_ putWitnessStack   where     putWitnessStack ws = do-        put $ VarInt $ fromIntegral $ length ws+        putVarInt $ length ws         mapM_ putWitnessStackItem ws     putWitnessStackItem bs = do-        put $ VarInt $ fromIntegral $ B.length bs+        putVarInt $ B.length bs         putByteString bs  instance FromJSON Tx where@@ -229,7 +229,7 @@      put (TxIn o s q) = do         put o-        put $ VarInt $ fromIntegral $ B.length s+        putVarInt $ B.length s         putByteString s         putWord32le q @@ -250,7 +250,7 @@      put (TxOut o s) = do         putWord64le o-        put $ VarInt $ fromIntegral $ B.length s+        putVarInt $ B.length s         putByteString s  -- | The 'OutPoint' refers to a transaction output being spent.