Skip to content

Commit

Permalink
Add debug points
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed Apr 3, 2024
1 parent fdc23db commit 18e3e4b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hydra-cluster/src/Hydra/Cluster/Faucet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,20 @@ returnFundsToFaucet tracer node@RunningNode{networkId, nodeSocket} sender = do

(senderVk, senderSk) <- keysFor sender
utxo <- queryUTxOFor networkId nodeSocket QueryTip senderVk
traceShowM ("RemainingFunds utxo:" <> renderUTxO utxo)
retryOnExceptions tracer $ do
let utxoValue = balance @Tx utxo
let allLovelace = selectLovelace utxoValue
traceShowM ("allLovelace:" <> show allLovelace)
-- select tokens other than ADA here so we can burn it afterwards
let otherTokens = filterValue (/= AdaAssetId) utxoValue
traceShowM ("otherTokens:" <> renderValue otherTokens)
-- XXX: Using a hard-coded high-enough value to satisfy the min utxo value.
-- NOTE: We use the faucet address as the change deliberately here.
fee <- calculateTxFee node senderSk utxo faucetAddress 1_500_000
traceShowM ("fee:" <> show fee)
let returnBalance = allLovelace - fee
traceShowM ("returnBalance:" <> show returnBalance)
tx <- sign senderSk <$> buildTxBody utxo faucetAddress returnBalance otherTokens
submitTransaction networkId nodeSocket tx
void $ awaitTransaction networkId nodeSocket tx
Expand Down

0 comments on commit 18e3e4b

Please sign in to comment.