Skip to content

Commit 4bdf6c3

Browse files
authored
sync node height before getStateCert (#214)
1 parent 99efc33 commit 4bdf6c3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/IC/Test/Agent.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ is2xx = \case
512512
Right res -> pure res
513513

514514
getStateCert' :: (HasCallStack, HasAgentConfig) => Blob -> Blob -> [[Blob]] -> IO (HTTPErrOr Certificate)
515-
getStateCert' = getStateCert'' endPoint
515+
getStateCert' sender ecid paths = do
516+
void $ sync_height ecid
517+
getStateCert'' endPoint sender ecid paths
516518

517519
decodeCert' :: HasCallStack => Blob -> IO Certificate
518520
decodeCert' b = either (assertFailure . T.unpack) return $ decodeCert b
@@ -540,7 +542,7 @@ getStateCert'' ep sender ecid paths = do
540542
return $ Right cert
541543

542544
getStateCert :: (HasCallStack, HasAgentConfig) => Blob -> Blob -> [[Blob]] -> IO Certificate
543-
getStateCert sender ecid paths = getStateCert'' endPoint sender ecid paths >>= is2xx
545+
getStateCert sender ecid paths = getStateCert' sender ecid paths >>= is2xx
544546

545547
extractCertData :: Blob -> Blob -> IO Blob
546548
extractCertData cid b = do
@@ -624,7 +626,7 @@ certValueAbsent cert path = case lookupPath (cert_tree cert) path of
624626

625627
getRequestStatus' :: (HasCallStack, HasAgentConfig) => Blob -> Blob -> Blob -> IO (HTTPErrOr ReqStatus)
626628
getRequestStatus' sender cid rid = do
627-
response <- getStateCert'' endPoint sender cid [["request_status", rid]]
629+
response <- getStateCert' sender cid [["request_status", rid]]
628630
case response of
629631
Left x -> return $ Left x
630632
Right cert -> do

0 commit comments

Comments
 (0)