-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from xycloo/v20.0.0-rc1
Update for protocol 20
- Loading branch information
Showing
7 changed files
with
121 additions
and
7 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
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
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,32 @@ | ||
//! 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::Testnet, | ||
bounded_buffer_size: None, | ||
staggered: None, | ||
}; | ||
|
||
let mut captive_core = CaptiveCore::new(config); | ||
|
||
let range = Range::Bounded(BoundedRange(1844380, 1844381)); | ||
captive_core.prepare_ledgers_single_thread(&range).unwrap(); | ||
|
||
let ledger = captive_core.get_ledger(1844381); | ||
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, | ||
LedgerCloseMeta::V2(v2) => v2.ledger_header.header.ledger_seq, | ||
}; | ||
|
||
println!("{:?}", ledger); | ||
|
||
println!("Hello ledger {}", ledger_seq); | ||
} |
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,43 @@ | ||
// Note: this example is still untested. | ||
|
||
use ingest::{CaptiveCore, IngestionConfig, SupportedNetwork}; | ||
use stellar_xdr::next::{LedgerCloseMeta, TransactionMeta}; | ||
|
||
pub fn main() { | ||
let config = IngestionConfig { | ||
executable_path: "/usr/local/bin/stellar-core".to_string(), | ||
context_path: Default::default(), | ||
network: SupportedNetwork::Testnet, | ||
bounded_buffer_size: None, | ||
staggered: None, | ||
}; | ||
|
||
let mut captive_core = CaptiveCore::new(config); | ||
|
||
let receiver = captive_core.start_online_no_range().unwrap(); | ||
|
||
println!("Printing tx sets"); | ||
for result in receiver.iter() { | ||
let ledger = result.ledger_close_meta.unwrap().ledger_close_meta; | ||
match &ledger { | ||
LedgerCloseMeta::V0(v0) => { | ||
println!( | ||
"v0 meta: {}", | ||
serde_json::to_string_pretty(&v0.tx_set).unwrap() | ||
) | ||
} | ||
LedgerCloseMeta::V1(v1) => { | ||
println!( | ||
"v1 meta: {}", | ||
serde_json::to_string_pretty(&v1.tx_set).unwrap() | ||
) | ||
} | ||
LedgerCloseMeta::V2(v2) => { | ||
println!( | ||
"v2 meta: {}", | ||
serde_json::to_string_pretty(&v2.tx_set).unwrap() | ||
) | ||
} | ||
} | ||
} | ||
} |
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
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
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