From 7532fab0424d4e6b45915fc58eec8530f46d25e8 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Tue, 30 Jun 2020 00:36:30 +1000 Subject: [PATCH] More comments about watchNodeTip in byron and jormungandr --- lib/byron/src/Cardano/Wallet/Byron/Network.hs | 4 +--- lib/jormungandr/src/Cardano/Wallet/Jormungandr/Network.hs | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/byron/src/Cardano/Wallet/Byron/Network.hs b/lib/byron/src/Cardano/Wallet/Byron/Network.hs index 49b98cf51d8..f95f25106b1 100644 --- a/lib/byron/src/Cardano/Wallet/Byron/Network.hs +++ b/lib/byron/src/Cardano/Wallet/Byron/Network.hs @@ -300,10 +300,8 @@ withNetworkLayer tr np addrInfo versionData action = do _stakeDistribution = notImplemented "stakeDistribution" - -- At the moment it's not necessasy to implement this method unless - -- monitoring a reward account. _watchNodeTip = - notImplemented "stakeDistribution" + notImplemented "watchNodeTip" -- | Type representing a network client running two mini-protocols to sync -- from the chain and, submit transactions. diff --git a/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Network.hs b/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Network.hs index 585466cc939..50e58995f9d 100644 --- a/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Network.hs +++ b/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Network.hs @@ -473,6 +473,10 @@ mkRawNetworkLayer np batchSize st tipNotify j = NetworkLayer _ -> RollBackward $ Cursor emptyBlockHeaders + -- NOTE: Because the jormungandr REST API is a polling API, this relies on + -- another thread (e.g. the chain 'follow' operation) to be periodically + -- calling 'getNodeTip' to drive updates. This only works because the sole + -- user of 'watchNodeTip' is 'manageRewardBalance'. _watchNodeTip cb = do watcher <- liftIO . atomically $ dupTChan tipNotify prevVar <- liftIO $ newIORef Nothing