Return Ok(None) when the registrar contract returns empty slice (#11257)

This commit is contained in:
David 2019-11-15 14:27:34 +01:00 committed by Marek Kotewicz
parent eb565a7e2b
commit 93f700d961
2 changed files with 4 additions and 3 deletions

View File

@ -44,12 +44,12 @@ impl ServiceTransactionChecker {
client: &C,
tx: &SignedTransaction
) -> Result<bool, String> {
let sender = tx.sender();
// Skip checking the contract if the transaction does not have zero gas price
if !tx.gas_price.is_zero() {
return Ok(false)
}
let sender = tx.sender();
self.check_address(client, sender)
}

View File

@ -42,9 +42,10 @@ pub trait RegistrarClient: CallContract + Send + Sync {
let id = encode_input(hashed_key, DNS_A_RECORD);
let address_bytes = self.call_contract(block, registrar_address, id)?;
if address_bytes.is_empty() {
return Ok(None)
}
let address = decode_output(&address_bytes).map_err(|e| e.to_string())?;
if address.is_zero() {
Ok(None)
} else {