Skip to content

Commit

Permalink
Modify SQLite function checkpointFromEntity to process tokens.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Dec 2, 2020
1 parent 2af6f8c commit 203df6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/core/src/Cardano/Wallet/DB/Sqlite.hs
Expand Up @@ -1173,9 +1173,15 @@ checkpointFromEntity cp utxo s =
) = cp
header = (W.BlockHeader slot (Quantity bh) headerHash parentHeaderHash)
utxo' = W.UTxO . Map.fromList $
[ (W.TxIn input ix, W.TxOut addr (TB.fromCoin coin))
| UTxO _ _ (TxId input) ix addr coin <- fst <$> utxo
[ (W.TxIn input ix, W.TxOut addr (mkTokenBundle coin tokens))
| (UTxO _ _ (TxId input) ix addr coin, tokens) <- utxo
]
mkTokenBundle coin tokens =
TB.fromFlatList coin (mkTokenEntry <$> tokens)
mkTokenEntry token =
( TB.AssetId (utxoTokenPolicyId token) (utxoTokenName token)
, utxoTokenQuantity token
)
gp = W.GenesisParameters
{ getGenesisBlockHash = coerce genesisHash
, getGenesisBlockDate = W.StartTime genesisStart
Expand Down

0 comments on commit 203df6e

Please sign in to comment.