Call getMethodDataAsync when knownMethodData[fourBytePrefix] object is empty (#8836)

Fixes #8835

In cases where the registry failed to load, and the sig is set to `{}` on this line: e85b162651/ui/app/helpers/utils/transactions.util.js (L78) this proceeds to set the method prefix to `{}` in knownMethodData.

Additionally check if the method prefix object is empty to proceed call getMethodDataAsync again.

I could only reproduce by intentionally failing the method registry lookup and found this solution. I could not find an instance where the registry consistently failed to lookup even on slow/throttled/high latency networks.
feature/default_network_editable
Thomas Huang 5 years ago committed by GitHub
parent b090625dc1
commit 4354e9eb93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ui/app/store/actions.js

@ -2160,7 +2160,7 @@ export function getContractMethodData (data = '') {
const prefixedData = ethUtil.addHexPrefix(data)
const fourBytePrefix = prefixedData.slice(0, 10)
const { knownMethodData } = getState().metamask
if (knownMethodData && knownMethodData[fourBytePrefix]) {
if (knownMethodData && knownMethodData[fourBytePrefix] && Object.keys(knownMethodData[fourBytePrefix]).length !== 0) {
return Promise.resolve(knownMethodData[fourBytePrefix])
}

Loading…
Cancel
Save