Safe Haskell | None |
---|---|
Language | Haskell98 |
In-memory cache for blockchain metadata
- data Chain = Chain {}
- chainBlockHash :: Chain -> Hash256
- chainPrevHash :: Chain -> Hash256
- data ChainTable = ChainTable {
- _tablePrev :: !(Map Hash256 Hash256)
- _tableNext :: !(Map Hash256 [Hash256])
- _tableBlock :: !(Map Hash256 Chain)
- _tableHeight :: !(Map Hash256 Int)
- _tableLongest :: !(Array Int Chain)
- buildChainTable :: IO ChainTable
- buildChainTable' :: FilePath -> IO ChainTable
- forAllBlocks_ :: ChainTable -> (Int -> Block (Tx RawScript RawScript) -> IO ()) -> IO ()
- forAllBlocks :: ChainTable -> (Int -> Block (Tx RawScript RawScript) -> IO a) -> IO [a]
- buildMap :: Ord k => (b -> a) -> (b -> a -> a) -> [(k, b)] -> Map k a
- sortNub :: Ord a => [a] -> [a]
- setNub :: Ord a => [a] -> [a]
- forceList_ :: [a] -> ()
- unfoldr' :: (b -> Maybe (a, b)) -> b -> [a]
blockchain
The block-chain as an (inverted) tree.
Note: The Ord instance compares the block hash (it defined only for internal reasons)
Chain | |
|
chainBlockHash :: Chain -> Hash256 Source #
chainPrevHash :: Chain -> Hash256 Source #
building the chain and related metadata
data ChainTable Source #
BlockChain metadata
ChainTable | |
|
buildChainTable' :: FilePath -> IO ChainTable Source #
The argument is the block directory
conveniance functions
forAllBlocks_ :: ChainTable -> (Int -> Block (Tx RawScript RawScript) -> IO ()) -> IO () Source #
Calls a user action for all blocks in the longest chain. The Int
is the block height
(with the genesis block having height zero).
misc helper functions (to be moved to some Misc.XXX modules)
forceList_ :: [a] -> () Source #