The canonical chain discovery algorithm takes a list of precomputed block paths and classifies them into 3 distinct categories:
- Deep Canoinical Blocks: These are blocks that form a canonical chain from the genesis block up to the witness root.
pub struct Block { | |
balance: u64, | |
} | |
fn get_balance(blocks: &Vec<Block>, index: usize) -> Option<u64> { | |
// handle out of bounds | |
match blocks.get(index) { | |
Some(block) => Some(block.balance), | |
None => None, | |
} |
use std::collections::VecDeque; | |
type Point = (i32, i32); | |
fn count_number_of_lakes(grid: Vec<Vec<usize>>) -> usize { | |
let mut count = 0; | |
let n = grid.len(); | |
let m = grid[0].len(); | |
if n == 0 || m == 0 { | |
return 0; |
use glob::glob; | |
use std::{ | |
fs, | |
path::{Path, PathBuf}, time::Instant, | |
}; | |
/// The BlockFileMetaData represents the parsed meta data from the | |
/// Precomputed Block filename. | |
/// | |
/// Each mainnet precomputed block has the following grammar. |
use tokio::signal; | |
use tokio::sync::watch; | |
use tokio::task; | |
/// State machine that represents the states the Mina Indexer can be in | |
#[derive(Debug, Clone)] | |
enum State { | |
Ready(Ready), | |
Init(Init), | |
Running(Running), |
User commands, commonly called transactions, are user-initiated actions on the Mina blockchain. There are two types of transactions: payment transactions and stake delegations.
use std::{fs, sync::Arc, thread}; | |
use crossbeam_channel::bounded; | |
use mina_indexer::{block::ingestion, mina_blocks::v1::precomputed_block::parse_file}; | |
use tempfile::TempDir; | |
#[test] | |
fn block_ingestion_watch_blocks() -> anyhow::Result<()> { | |
let block_src = "tests/data/non_sequential_blocks/mainnet-2-3NLyWnjZqUECniE1q719CoLmes6WDQAod4vrTeLfN7XXJbHv6EHH.json"; | |
let (watch_tx, watch_rx) = bounded(16); |
query StakesQuery($limit: Int = 10, $sort_by: StakeSortByInput!, $query: StakeQueryInput!) { | |
stakes(limit: $limit, sortBy: $sort_by, query: $query ) { | |
balance | |
chainId | |
delegate | |
epoch | |
ledgerHash | |
nonce | |
pk | |
public_key |
query TransactionsQuery($limit: Int = 10, $sort_by: TransactionSortByInput!, $query: TransactionQueryInput!) { | |
transactions(limit: $limit, sortBy: $sort_by, query: $query ) { | |
blockHeight | |
canonical | |
amount | |
fee | |
kind | |
id | |
to | |
from |
query BlocksQuery($query: BlockQueryInput!, $limit: Int = 10, $sort_by: BlockSortByInput!) { | |
blocks(query: $query, limit: $limit, sortBy: $sort_by) { | |
blockHeight | |
dateTime | |
stateHash | |
transactions { | |
coinbase | |
coinbaseReceiverAccount { | |
publicKey | |
} |