Skip to content

Commit

Permalink
Tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoreliovlabs committed Apr 12, 2024
1 parent 3928697 commit b269200
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rskj-core/src/main/java/co/rsk/util/ContractUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ public static boolean isClaimTxAndValid(Transaction newTx,
Constants constants,
SignatureCache signatureCache,
PropertyGetter propertyGetter) {
byte[] functionSelector = Arrays.copyOfRange(newTx.getData(), 0, 4);
if(newTx.getReceiveAddress().toHexString().equalsIgnoreCase(constants.getEtherSwapContractAddress())
&& Arrays.equals(functionSelector, Constants.CLAIM_FUNCTION_SIGNATURE)) {
if(newTx.getReceiveAddress() != null
&& newTx.getData() != null
&& newTx.getReceiveAddress().toHexString().equalsIgnoreCase(constants.getEtherSwapContractAddress())
&& Arrays.equals(Arrays.copyOfRange(newTx.getData(), 0, 4), Constants.CLAIM_FUNCTION_SIGNATURE)) {

String swapHash = HexUtils.toUnformattedJsonHex(calculateSwapHash(newTx, signatureCache));
byte[] key = HashUtil.keccak256(HexUtils.decode(HexUtils.stringToByteArray(swapHash + SWAPS_MAP_POSITION)));
Expand Down

0 comments on commit b269200

Please sign in to comment.