Skip to content

Commit

Permalink
refactor: logic simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
aya015757881 committed Jul 5, 2024
1 parent 79ed253 commit ab96e04
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions anychain-tron/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ impl Transaction for TronTransaction {
let (raw, sig) = if let Ok(tx) = TransactionProto::parse_from_bytes(tx) {
let raw = tx.raw_data.unwrap();
let sig = tx.signature[0].clone();
(raw, Some(sig))
match sig.len() == 65 {
true => (raw, Some(TronTransactionSignature(sig))),
false => (raw, None),
}
} else if let Ok(raw) = TransactionRaw::parse_from_bytes(tx) {
(raw, None)
} else {
Expand All @@ -170,17 +173,6 @@ impl Transaction for TronTransaction {
contract: raw.contract[0].clone(),
};

let sig = match sig {
Some(sig) => {
if sig.len() == 65 {
Some(TronTransactionSignature(sig))
} else {
None
}
}
None => None,
};

Ok(Self {
data: param,
signature: sig,
Expand Down

0 comments on commit ab96e04

Please sign in to comment.