Skip to content

Commit

Permalink
Simplify and de-dupe little endian hex string cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
webworker01 committed Jun 5, 2022
1 parent 6a9f1a3 commit 7826dd0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Komodo/Opreturn.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 73,16 @@ function decode($scriptPubKeyBinary)

if ($notarization_data !== FALSE) {
$notarization_data["name"] = trim($notarization_data["name"]);
$notarization_data["prevhash"] = bin2hex(strrev($notarization_data["prevhash"]));

if (array_key_exists('MoMhash', $notarization_data)) {
$notarization_data["MoMhash"] = bin2hex(strrev($notarization_data["MoMhash"]));
}

if (array_key_exists('btctxid', $notarization_data)) {
$notarization_data['btctxid'] = bin2hex(strrev($notarization_data['btctxid']));
$cleanup = ['prevhash', 'MoMhash', 'btctxid'];
foreach ($cleanup as $cleanup_key) {
if (array_key_exists($cleanup_key, $notarization_data)) {
$notarization_data[$cleanup_key] = bin2hex(strrev($notarization_data[$cleanup_key]));
}
}
}

return($notarization_data);
return $notarization_data;
}

}

0 comments on commit 7826dd0

Please sign in to comment.