Skip to content

Commit

Permalink
chore: handle a right getrawtransaction response
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Oct 29, 2023
1 parent 8ea1bdd commit a9fa944
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,22 @@ pub fn fetch_asset_lock_transaction_output_sync_v0<C: CoreRPCLike>(
));
};

if transaction_height > proof.core_chain_locked_height {
let is_transaction_not_mined = transaction_height == -1;
let transaction_height = transaction_height as u32;

// Return an error if transaction is not mined
// or if it is mined after the chain locked height
if is_transaction_not_mined || transaction_height > proof.core_chain_locked_height {
let reported_height = if is_transaction_not_mined {
None
} else {
Some(transaction_height)
};

return Ok(ConsensusValidationResult::new_with_error(
InvalidAssetLockProofTransactionHeightError::new(
proof.core_chain_locked_height,
Some(transaction_height),
reported_height,
)
.into(),
));
Expand Down

0 comments on commit a9fa944

Please sign in to comment.