Skip to content

Commit

Permalink
fix(wallet): ensure block hash exists (#4083)
Browse files Browse the repository at this point in the history
Description
---
Adds a quick data validation check before updating the database. The base node may return a response without a block_hash and the resulting db update creates an invalidatable scenario for the wallet.

Motivation and Context
---
An aurora wallet is failing to validate and causing problems

How Has This Been Tested?
---
It has not yet been tested.
  • Loading branch information
brianp authored May 9, 2022
1 parent 1464f8b commit a258984
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,22 @@ where
.map_err(TransactionServiceError::ProtobufConversionError)?;
let sig = response.signature;
if let Some(unconfirmed_tx) = batch_signatures.get(&sig) {
if response.location == TxLocation::Mined {
if response.location == TxLocation::Mined && response.block_hash.is_some() {
mined.push((
(*unconfirmed_tx).clone(),
response.block_height,
response.block_hash.unwrap(),
response.confirmations,
));
} else {
warn!(
target: LOG_TARGET,
"Marking transaction {} as unmined and confirmed '{}' with block '{}' (Operation ID: {})",
&unconfirmed_tx.tx_id,
&response.confirmations >= &self.config.num_confirmations_required,
response.block_hash.is_some(),
self.operation_id,
);
unmined.push((*unconfirmed_tx).clone());
}
}
Expand Down

0 comments on commit a258984

Please sign in to comment.