Skip to content

Commit 0b0942f

Browse files
sgillespiekderme
authored andcommitted
fix: Use treasury donation for deposit calculation
1 parent 043ee32 commit 0b0942f

File tree

1 file changed

+3
-3
lines changed
  • cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert

1 file changed

+3
-3
lines changed

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert/Tx.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
7777
let !mdeposits = if not (Generic.txValidContract tx) then Just (Coin 0) else lookupDepositsMap txHash (apDepositsMap applyResult)
7878
let !outSum = fromIntegral $ unCoin $ Generic.txOutSum tx
7979
!withdrawalSum = fromIntegral $ unCoin $ Generic.txWithdrawalSum tx
80-
!treasuryDonation = fromIntegral . unCoin $ Generic.txTreasuryDonation tx
80+
!treasuryDonation = unCoin $ Generic.txTreasuryDonation tx
8181
hasConsumed = getHasConsumedOrPruneTxOut syncEnv
8282
disInOut <- liftIO $ getDisableInOutState syncEnv
8383
-- In some txs and with specific configuration we may be able to find necessary data within the tx body.
@@ -93,7 +93,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
9393
then pure (resolvedInputs, fees, Nothing)
9494
else
9595
let !inSum = sum $ map unDbLovelace $ catMaybes amounts
96-
in pure (resolvedInputs, fees, Just $ fromIntegral (inSum + withdrawalSum) - fromIntegral outSum - fromIntegral fees)
96+
in pure (resolvedInputs, fees, Just $ fromIntegral (inSum + withdrawalSum) - fromIntegral outSum - fees - treasuryDonation)
9797
(_, _, Nothing) -> do
9898
-- Nothing in fees means a phase 2 failure
9999
(resolvedInsFull, amounts) <- splitLast <$> mapM (resolveTxInputs hasConsumed True (fst <$> groupedTxOut grouped)) (Generic.txInputs tx)
@@ -118,7 +118,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
118118
, DB.txInvalidHereafter = DbWord64 . unSlotNo <$> Generic.txInvalidHereafter tx
119119
, DB.txValidContract = Generic.txValidContract tx
120120
, DB.txScriptSize = sum $ Generic.txScriptSizes tx
121-
, DB.txTreasuryDonation = DB.DbLovelace treasuryDonation
121+
, DB.txTreasuryDonation = DB.DbLovelace (fromIntegral treasuryDonation)
122122
}
123123

124124
when (ioTxCBOR iopts) $ do

0 commit comments

Comments
 (0)