Skip to content

Commit

Permalink
Refactor BitcoinUtilsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-iov committed Feb 6, 2025
1 parent 5bf2f78 commit 56c0311
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rskj-core/src/test/java/co/rsk/peg/bitcoin/BitcoinUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static co.rsk.bitcoinj.script.ScriptOpCodes.OP_NOT;
import static co.rsk.peg.bitcoin.BitcoinUtils.*;
import static org.ethereum.util.ByteUtil.EMPTY_BYTE_ARRAY;
import static org.junit.jupiter.api.Assertions.*;

import co.rsk.bitcoinj.core.*;
Expand Down Expand Up @@ -469,7 +470,6 @@ void removeSignaturesFromTransactionWithP2shMultiSigInputs_whenTransactionIsLega
// assert
assertEquals(transactionBeforeSigning, transaction);

byte[] emptyByte = new byte[] {};
for (TransactionInput input : transaction.getInputs()) {
List<ScriptChunk> scriptSigChunks = input.getScriptSig().getChunks();

Expand All @@ -480,8 +480,8 @@ void removeSignaturesFromTransactionWithP2shMultiSigInputs_whenTransactionIsLega

// assert script sig does not have signatures
for (int i = 0; i < redeemScriptChunkIndex - 1; i++) {
byte[] scriptSigChunkData = scriptSigChunks.get(i).data;
assertArrayEquals(emptyByte, scriptSigChunkData);
int scriptSigChunkOpCode = scriptSigChunks.get(i).opcode;
assertEquals(ScriptOpCodes.OP_0, scriptSigChunkOpCode);
}
}
}
Expand All @@ -496,7 +496,7 @@ void removeSignaturesFromTransactionWithP2shMultiSigInputs_whenNotAllInputsHaveP
transaction.addInput(BitcoinTestUtils.createHash(1), 0, scriptSig);

// having an empty script sig means we cannot get the redeem script from it
Script emptyScriptSig = new Script(new byte[] {});
Script emptyScriptSig = new Script(EMPTY_BYTE_ARRAY);
transaction.addInput(BitcoinTestUtils.createHash(2), 0, emptyScriptSig);

transaction.addOutput(Coin.COIN, destinationAddress);
Expand Down Expand Up @@ -550,7 +550,7 @@ void createBaseP2SHInputScriptThatSpendsFromRedeemScript_shouldCreateExpectedScr
assertArrayEquals(redeemScript.getProgram(), scriptSigChunks.get(redeemScriptChunkIndex).data); // last chunk should be the redeem script

for (ScriptChunk chunk : scriptSigChunks.subList(0, redeemScriptChunkIndex)) { // all the other chunks should be zero
assertEquals(0, chunk.opcode);
assertEquals(ScriptOpCodes.OP_0, chunk.opcode);
}
}

Expand Down

0 comments on commit 56c0311

Please sign in to comment.