-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhello_pubnet.rs
29 lines (23 loc) · 1.01 KB
/
hello_pubnet.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! This example is the copy of ./hello.rs but running on
//! stellar's public network. The network choice is specified
//! in the ingestion configs.
use ingest::{BoundedRange, CaptiveCore, IngestionConfig, Range, SupportedNetwork};
use stellar_xdr::next::LedgerCloseMeta;
pub fn main() {
let config = IngestionConfig {
executable_path: "/usr/local/bin/stellar-core".to_string(),
context_path: Default::default(),
network: SupportedNetwork::Pubnet,
bounded_buffer_size: None,
staggered: None,
};
let mut captive_core = CaptiveCore::new(config);
let range = Range::Bounded(BoundedRange(292395, 292396));
captive_core.prepare_ledgers_single_thread(&range).unwrap();
let ledger = captive_core.get_ledger(292395);
let ledger_seq = match ledger.as_ref().unwrap() {
LedgerCloseMeta::V1(v1) => v1.ledger_header.header.ledger_seq,
LedgerCloseMeta::V0(v0) => v0.ledger_header.header.ledger_seq,
};
println!("Hello ledger {}", ledger_seq);
}