packages feed

haskoin-node 0.11.1 → 0.11.2

raw patch · 3 files changed

+25/−21 lines, 3 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.11.2+### Changed+- Include header decoding error text in logs.+ ## 0.11.1 ### Changed - Improve logging.
haskoin-node.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: eab6c845bac88d53afa9cd3e263936a78d0bc0f75e47e7ccbb593b58371626f3+-- hash: 6236cea0348e8901249428fa157e41cb58feaf7b7c8bdeb0fa216deefb620b84  name:           haskoin-node-version:        0.11.1+version:        0.11.2 synopsis:       Haskoin Node P2P library for Bitcoin and Bitcoin Cash description:    Bitcoin and Bitcoin Cash peer-to-peer protocol library featuring headers-first synchronisation. category:       Bitcoin, Finance, Network
src/Haskoin/Node/Peer.hs view
@@ -76,25 +76,25 @@     => Network     -> SockAddr     -> ConduitT ByteString Message m ()-inPeerConduit net a = forever $ do-    x <- takeCE 24 .| foldC-    case decode x of-        Left _ -> do-            $(logErrorS)-                (peerString a)-                "Could not decode incoming message header"-            throwIO DecodeHeaderError-        Right (MessageHeader _ _ len _) -> do-            when (len > 32 * 2 ^ (20 :: Int)) $ do-                $(logErrorS) (peerString a) "Payload too large"-                throwIO $ PayloadTooLarge len-            y <- takeCE (fromIntegral len) .| foldC-            case runGet (getMessage net) $ x `B.append` y of-                Left e -> do-                    $(logErrorS) (peerString a) $-                        "Cannot decode payload: " <> cs (show e)-                    throwIO CannotDecodePayload-                Right msg -> yield msg+inPeerConduit net a =+    forever $ do+        x <- takeCE 24 .| foldC+        case decode x of+            Left e -> do+                $(logErrorS) (peerString a) $+                    "Could not decode incoming message header: " <> cs e+                throwIO DecodeHeaderError+            Right (MessageHeader _ _ len _) -> do+                when (len > 32 * 2 ^ (20 :: Int)) $ do+                    $(logErrorS) (peerString a) "Payload too large"+                    throwIO $ PayloadTooLarge len+                y <- takeCE (fromIntegral len) .| foldC+                case runGet (getMessage net) $ x `B.append` y of+                    Left e -> do+                        $(logErrorS) (peerString a) $+                            "Cannot decode payload: " <> cs (show e)+                        throwIO CannotDecodePayload+                    Right msg -> yield msg  -- | Outgoing peer conduit to serialize and send messages. outPeerConduit :: Monad m => Network -> ConduitT Message ByteString m ()