Skip to content

Commit bd6421f

Browse files
committed
Cleanup old code
1 parent d68c6a4 commit bd6421f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/BotPlutusInterface/Contract.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ awaitTxStatusChange contractEnv txId = do
196196
let status = transactionStatus blk txState txId
197197
pure $ fromRight Unknown status
198198
where
199-
-- Attempts to find the tx in chain index. If the tx does not appear after
200-
-- 5 blocks we give up
201199
queryChainIndexForTxState :: Eff effs (Maybe TxIdState)
202200
queryChainIndexForTxState = do
203201
mTx <- join . preview _TxIdResponse <$> (queryChainIndex @w $ TxFromTxId txId)

src/BotPlutusInterface/Helpers.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ import Plutus.Contract.Types (Contract, throwError)
99
import Prelude
1010

1111
awaitTxConfirmedUntilSlot :: forall w s e. (AsContractError e) => TxId -> Slot -> Contract w s e ()
12-
awaitTxConfirmedUntilSlot i maxSlot = go 0
12+
awaitTxConfirmedUntilSlot txId maxSlot = go 0
1313
where
1414
go :: Integer -> Contract w s e ()
1515
go n = do
16-
mTx <- awaitTxStatusChange i
16+
mTx <- awaitTxStatusChange txId
1717
case mTx of
1818
Unknown -> do
1919
curSlot <- currentSlot
20-
if curSlot >= maxSlot
21-
then throwError @e $ review _OtherContractError $ pack $ "Could not find tx after maxAttempts. ID: " ++ show i
20+
if curSlot > maxSlot
21+
then
22+
throwError @e $
23+
review _OtherContractError $
24+
pack $
25+
"Could not find transaction - " ++ show txId ++ " - before slot " ++ show maxSlot
2226
else do
2327
_ <- waitNSlots 20
2428
go (n + 1)

0 commit comments

Comments
 (0)