Skip to content

Commit

Permalink
skip miner txs
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Nov 27, 2024
1 parent 6f9fc83 commit af2d011
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/json_rescue_v5_extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ pub fn extract_v5_json_rescue(
// wtxs.events
// wtxs.block_timestamp

tx_vec.push(wtxs);
// TODO: create arg to exclude miner txs
if wtxs.relation_label != RelationLabel::Miner {
tx_vec.push(wtxs);
}
}
TransactionDataView::BlockMetadata { timestamp_usecs: _ } => {
// TODO get epoch events
Expand Down
6 changes: 3 additions & 3 deletions src/json_rescue_v5_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub async fn concurrent_decompress_and_extract(tgz_file: &Path, pool: &Graph) ->
task::spawn(async move {
let _permit = parse_semaphore.acquire().await.unwrap(); // Control parsing concurrency
if let Ok((mut r, _e)) = extract_v5_json_rescue(&j) {
let drain: Vec<WarehouseTxMaster> = r.drain(..).collect();
let drain: Vec<WarehouseTxMaster> = std::mem::take(&mut r);

if !drain.is_empty() {
let _db_permit = semaphore.acquire().await.unwrap(); // Control DB insert concurrency
Expand All @@ -102,7 +102,7 @@ pub async fn concurrent_decompress_and_extract(tgz_file: &Path, pool: &Graph) ->
}
}
}
Ok(())
Ok::<(), anyhow::Error>(())
})
});

Expand Down Expand Up @@ -151,7 +151,7 @@ pub async fn stream_decompress_and_extract(tgz_file: &Path, pool: &Graph) -> Res
let _parse_permit = parse_semaphore.acquire().await.unwrap();

if let Ok((mut records, _e)) = extract_v5_json_rescue(&j) {
let batch = records.drain(..).collect::<Vec<_>>();
let batch = std::mem::take(&mut records);

if !batch.is_empty() {
let _insert_permit = insert_semaphore.acquire().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/schema_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use libra_backwards_compatibility::sdk::{
use libra_types::{exports::AccountAddress, move_resource::coin_register_event::CoinRegisterEvent};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RelationLabel {
Tx, // undefined tx
Transfer(AccountAddress),
Expand Down

0 comments on commit af2d011

Please sign in to comment.