log account key + block size

This commit is contained in:
GroovieGermanikus 2024-04-18 17:30:23 +02:00
parent 793de099d3
commit 458f82725a
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
1 changed files with 5 additions and 8 deletions

View File

@ -105,21 +105,18 @@ pub async fn main() {
); );
tokio::spawn(async move { tokio::spawn(async move {
let mut wtr = csv::Writer::from_path("accounts-mainnet.csv").unwrap();
let mut green_stream = pin!(green_stream); let mut green_stream = pin!(green_stream);
while let Some(message) = green_stream.next().await { while let Some(message) = green_stream.next().await {
match message { match message {
Message::GeyserSubscribeUpdate(subscriber_update) => { Message::GeyserSubscribeUpdate(subscriber_update) => {
match subscriber_update.update_oneof { match subscriber_update.update_oneof {
Some(UpdateOneof::Account(update)) => { Some(UpdateOneof::Account(update)) => {
info!("got update (green)!!! slot: {}", update.slot); let account_info = update.account.unwrap();
let key = update.account.unwrap().pubkey; let account_pk = Pubkey::try_from(account_info.pubkey).unwrap();
info!("got account update (green)!!! {} - {:?} - {} bytes",
update.slot, account_pk, account_info.data.len());
let bytes: [u8; 32] = let bytes: [u8; 32] =
key.try_into().unwrap_or(Pubkey::default().to_bytes()); account_pk.to_bytes();
let pubkey = Pubkey::new_from_array(bytes);
wtr.write_record(&[pubkey.to_string()]).unwrap();
wtr.flush().unwrap();
} }
_ => {} _ => {}
} }