0.7.25
This commit is contained in:
@@ -28,10 +28,7 @@ impl KbPoolOriginService {
|
||||
/// Creates a new pool-origin service.
|
||||
pub fn new(database: std::sync::Arc<crate::KbDatabase>) -> Self {
|
||||
let persistence = crate::KbDetectionPersistenceService::new(database.clone());
|
||||
Self {
|
||||
database,
|
||||
persistence,
|
||||
}
|
||||
return Self { database, persistence };
|
||||
}
|
||||
|
||||
/// Records pool-origin rows for one resolved transaction signature.
|
||||
@@ -52,7 +49,7 @@ impl KbPoolOriginService {
|
||||
"cannot record pool origins for unknown transaction '{}'",
|
||||
signature
|
||||
)));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let transaction_id = match transaction.id {
|
||||
@@ -62,7 +59,7 @@ impl KbPoolOriginService {
|
||||
"transaction '{}' has no internal id",
|
||||
signature
|
||||
)));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let decoded_events_result = crate::list_dex_decoded_events_by_transaction_id(
|
||||
@@ -85,7 +82,7 @@ impl KbPoolOriginService {
|
||||
return Err(crate::KbError::InvalidState(
|
||||
"decoded event has no internal id".to_string(),
|
||||
));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let pool_address = match decoded_event.pool_account.clone() {
|
||||
@@ -111,7 +108,7 @@ impl KbPoolOriginService {
|
||||
"pool '{}' has no internal id",
|
||||
pool.address
|
||||
)));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if seen_pool_ids.contains(&pool_id) {
|
||||
@@ -234,8 +231,7 @@ impl KbPoolOriginService {
|
||||
created_origin,
|
||||
});
|
||||
}
|
||||
|
||||
Ok(results)
|
||||
return Ok(results);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +261,7 @@ mod tests {
|
||||
Ok(database) => database,
|
||||
Err(error) => panic!("database init must succeed: {}", error),
|
||||
};
|
||||
std::sync::Arc::new(database)
|
||||
return std::sync::Arc::new(database);
|
||||
}
|
||||
|
||||
async fn seed_bags_backed_meteora_dbc_transaction(
|
||||
@@ -362,9 +358,7 @@ mod tests {
|
||||
seed_bags_backed_meteora_dbc_transaction(database.clone(), "sig-pool-origin-1").await;
|
||||
|
||||
let service = crate::KbPoolOriginService::new(database.clone());
|
||||
let record_result = service
|
||||
.record_transaction_by_signature("sig-pool-origin-1")
|
||||
.await;
|
||||
let record_result = service.record_transaction_by_signature("sig-pool-origin-1").await;
|
||||
let results = match record_result {
|
||||
Ok(results) => results,
|
||||
Err(error) => panic!("pool-origin recording must succeed: {}", error),
|
||||
@@ -398,9 +392,7 @@ mod tests {
|
||||
|
||||
let service = crate::KbPoolOriginService::new(database.clone());
|
||||
|
||||
let first_result = service
|
||||
.record_transaction_by_signature("sig-pool-origin-2")
|
||||
.await;
|
||||
let first_result = service.record_transaction_by_signature("sig-pool-origin-2").await;
|
||||
let first_results = match first_result {
|
||||
Ok(first_results) => first_results,
|
||||
Err(error) => panic!("first pool-origin recording must succeed: {}", error),
|
||||
@@ -408,9 +400,7 @@ mod tests {
|
||||
assert_eq!(first_results.len(), 1);
|
||||
assert!(first_results[0].created_origin);
|
||||
|
||||
let second_result = service
|
||||
.record_transaction_by_signature("sig-pool-origin-2")
|
||||
.await;
|
||||
let second_result = service.record_transaction_by_signature("sig-pool-origin-2").await;
|
||||
let second_results = match second_result {
|
||||
Ok(second_results) => second_results,
|
||||
Err(error) => panic!("second pool-origin recording must succeed: {}", error),
|
||||
|
||||
Reference in New Issue
Block a user