packages feed

haskoin-node 0.17.10 → 0.17.11

raw patch · 3 files changed

+31/−22 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Haskoin.Node: CannotDecodePayload :: PeerException
+ Haskoin.Node: CannotDecodePayload :: !MessageCommand -> PeerException

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.17.11+### Added+- Display message command that disconnects a peer.+ ## 0.17.10 ### Fixed - Correct disconnect timeout algorithm bug.
haskoin-node.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 935fb430e1b0574ed6f6901e3580c83804f13fc7aa1f0e353ce26dc82eaf7af4+-- hash: 935bd495e75d0e687287d577b6fb7a4a196a1736124ee8bf09569d216a8735bc  name:           haskoin-node-version:        0.17.10+version:        0.17.11 synopsis:       P2P library for Bitcoin and Bitcoin Cash description:    Please see the README on GitHub at <https://github.com/haskoin/haskoin-node#readme> category:       Bitcoin, Finance, Network
src/Haskoin/Node/Peer.hs view
@@ -46,10 +46,12 @@ import           Haskoin                   (Block (..), BlockHash (..),                                             GetData (..), InvType (..),                                             InvVector (..), Message (..),+                                            MessageCommand (..),                                             MessageHeader (..), Network (..),                                             NotFound (..), Ping (..), Pong (..),-                                            Tx, TxHash (..), getMessage,-                                            headerHash, putMessage, txHash)+                                            Tx, TxHash (..), commandToString,+                                            getMessage, headerHash, putMessage,+                                            txHash) import           NQE                       (Inbox, Mailbox, Publisher,                                             inboxToMailbox, publish, receive,                                             receiveMatchS, send,@@ -80,7 +82,7 @@     = PeerMisbehaving !String     | DuplicateVersion     | DecodeHeaderError-    | CannotDecodePayload+    | CannotDecodePayload !MessageCommand     | PeerIsMyself     | PayloadTooLarge !Word32     | PeerAddressInvalid@@ -93,19 +95,20 @@     deriving Eq  instance Show PeerException where-    show (PeerMisbehaving s) = "Peer misbehaving: " <> s-    show DuplicateVersion    = "Duplicate version"-    show DecodeHeaderError   = "Error decoding header"-    show CannotDecodePayload = "Cannot decode payload"-    show PeerIsMyself        = "Peer is myself"-    show (PayloadTooLarge s) = "Payload too large: " <> show s-    show PeerAddressInvalid  = "Peer address invalid"-    show PeerSentBadHeaders  = "Peer sent bad headers"-    show NotNetworkPeer      = "Not network peer"-    show PeerNoSegWit        = "Segwit not supported by peer"-    show PeerTimeout         = "Peer timed out"-    show UnknownPeer         = "Unknown peer"-    show PeerTooOld          = "Peer too old"+    show (PeerMisbehaving s)     = "Peer misbehaving: " <> s+    show DuplicateVersion        = "Duplicate version"+    show DecodeHeaderError       = "Error decoding header"+    show (CannotDecodePayload c) = "Cannot decode payload: " <>+                                   cs (commandToString c)+    show PeerIsMyself            = "Peer is myself"+    show (PayloadTooLarge s)     = "Payload too large: " <> show s+    show PeerAddressInvalid      = "Peer address invalid"+    show PeerSentBadHeaders      = "Peer sent bad headers"+    show NotNetworkPeer          = "Not network peer"+    show PeerNoSegWit            = "Segwit not supported by peer"+    show PeerTimeout             = "Peer timed out"+    show UnknownPeer             = "Unknown peer"+    show PeerTooOld              = "Peer too old"  instance Exception PeerException @@ -187,7 +190,7 @@                     (peerLog a)                     "Could not decode incoming message header"                 throwIO DecodeHeaderError-            Right (MessageHeader _ _ len _) -> do+            Right (MessageHeader _ cmd len _) -> do                 when (len > 32 * 2 ^ (20 :: Int)) $ do                     $(logErrorS) (peerLog a) "Payload too large"                     throwIO $ PayloadTooLarge len@@ -195,8 +198,10 @@                 case runGet (getMessage net) $ x `B.append` y of                     Left e -> do                         $(logErrorS) (peerLog a) $-                            "Cannot decode payload: " <> cs (show e)-                        throwIO CannotDecodePayload+                            "Cannot decode payload (" <>+                            cs (commandToString cmd) <>+                            "): " <> cs (show e)+                        throwIO (CannotDecodePayload cmd)                     Right msg -> yield msg  -- | Outgoing peer conduit to serialize and send messages.@@ -327,4 +332,4 @@ filterReceive p inb =     receive inb >>= \case         (p', msg) | p == p' -> return msg-        _ -> filterReceive p inb+        _                   -> filterReceive p inb