Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UTxOHistory datatype as internal module.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
lib/wallet/src/Cardano/Wallet/DB/Store/DeltaUTxO/Model/Internal.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Cardano.Wallet.DB.Store.DeltaUTxO.Model.Internal | ||
( UTxOHistory (..) | ||
) | ||
where | ||
|
||
import Prelude | ||
|
||
import Cardano.Wallet.Primitive.Types | ||
( Slot, SlotNo ) | ||
import Cardano.Wallet.Primitive.Types.Tx.TxIn | ||
( TxIn ) | ||
import Cardano.Wallet.Primitive.Types.UTxO | ||
( UTxO ) | ||
import Data.Map.Strict | ||
( Map ) | ||
import Data.Set | ||
( Set ) | ||
|
||
-- | UTxO history. Abstract history of the UTxO. We keep track of the creation | ||
-- and spending of slot of each TxIn. This allows us to rollback to a given slot | ||
-- and prune the history to a given slot. | ||
data UTxOHistory = UTxOHistory | ||
{ history :: UTxO | ||
-- ^ All UTxO , spent and unspent. | ||
, creationSlots :: Map Slot (Set TxIn) | ||
-- ^ All TxIn, indexed by creation slot. | ||
, spentSlots :: Map SlotNo (Set TxIn) | ||
-- ^ All spent TxIn, indexed by spent slot. | ||
, spentTxIns :: Map TxIn SlotNo | ||
-- ^ All spent TxIn. | ||
, tip :: Slot | ||
-- ^ Current tip slot. | ||
, finality :: Maybe Slot | ||
-- ^ Finality slot. | ||
} | ||
deriving (Show) |