Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle payload filtered txns for default processor #423

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions rust/processor/src/db/common/models/default_models/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,34 @@ impl Transaction {

match txn_data {
TxnData::User(user_txn) => {
let payload = user_txn
let request = &user_txn
.request
.as_ref()
.expect("Getting user request failed.")
.expect("Getting user request failed.");

let mut payload_cleaned = None;
let (payload, payload_type) = match request.payload.as_ref() {
Some(payload) => {
payload_cleaned = get_clean_payload(&payload, version);
(payload_cleaned, Some(get_payload_type(&payload)))
},
None => (None, None),
};

let (payload_cleaned, payload_type) = request
yuunlimm marked this conversation as resolved.
Show resolved Hide resolved
.payload
.as_ref()
.expect("Getting payload failed.");
let payload_cleaned = get_clean_payload(payload, version);
let payload_type = get_payload_type(payload);
.map(|payload| {
let cleaned = get_clean_payload(payload, version);
(Some(cleaned), Some(get_payload_type(payload)))
})
.unwrap_or((None, None));

(
Self::from_transaction_info_with_data(
transaction_info,
payload_cleaned,
Some(payload_type),
payload,
payload_type,
version,
transaction_type,
user_txn.events.len() as i64,
Expand All @@ -221,8 +235,11 @@ impl Transaction {
)
},
TxnData::Genesis(genesis_txn) => {
let payload = genesis_txn.payload.as_ref().unwrap();
let payload_cleaned = get_clean_writeset(payload, version);
let payload_cleaned = genesis_txn
.payload
.as_ref()
.map(|payload| get_clean_writeset(payload, version))
.unwrap_or(None);
// It's genesis so no big deal
let payload_type = None;
(
Expand Down
Loading