fixing error for first request

This commit is contained in:
Godmode Galactus 2023-10-16 15:53:44 +02:00
parent 177e68a514
commit 29616a19c9
No known key found for this signature in database
GPG Key ID: A04142C71ABB0DEA
3 changed files with 22 additions and 8 deletions

View File

@ -2,8 +2,8 @@ CREATE SCHEMA banking_stage_results;
CREATE TABLE banking_stage_results.transaction_infos (
signature CHAR(88) NOT NULL,
message CHAR(1280),
errors CHAR(10000) NOT NULL,
message text,
errors text,
is_executed BOOL,
is_confirmed BOOL,
first_notification_slot BIGINT NOT NULL,

View File

@ -68,9 +68,11 @@ async fn main() {
x.add_notification(&transaction);
}
None => {
let mut x = TransactionInfo::new(&transaction);
x.add_notification(&transaction);
map_of_infos.insert(
sig,
TransactionInfo::new(transaction.signature, transaction.slot),
x,
);
}
}

View File

@ -79,14 +79,26 @@ pub struct TransactionInfo {
}
impl TransactionInfo {
pub fn new(signature: String, first_notification_slot: Slot) -> Self {
pub fn new(notification: &SubscribeUpdateBankingTransactionResults) -> Self {
let mut errors = HashMap::new();
let is_executed = notification.error.is_none();
match &notification.error {
Some(e) => {
let error: TransactionError = bincode::deserialize(&e.err).unwrap();
let key = ErrorKey { error, slot: notification.slot };
errors.insert( key, 1);
},
None => {
}
};
Self {
signature,
signature: notification.signature.clone(),
transaction_message: None,
errors: HashMap::new(),
is_executed: false,
errors,
is_executed,
is_confirmed: false,
first_notification_slot,
first_notification_slot: notification.slot,
cu_requested: None,
prioritization_fees: None,
}