Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Sep 5, 2024
1 parent f5b2e76 commit 309661f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rskj-core/src/main/java/co/rsk/peg/bitcoin/BitcoinUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,29 @@ public static Optional<Script> extractRedeemScriptFromInput(TransactionInput txI
}

public static Script removeSignaturesFromErpScriptSig(Script scriptSig) {
List<ScriptChunk> scriptSigChunks = scriptSig.getChunks();
ScriptBuilder scriptBuilder = new ScriptBuilder();

ScriptBuilder builder = new ScriptBuilder();
List<ScriptChunk> scriptSigChunks = scriptSig.getChunks();

int op0ChunkIndex = 0;
int redeemScriptChunkIndex = scriptSigChunks.size() - 1;
int opIfElseChunkIndex = redeemScriptChunkIndex - 1;

ScriptChunk op0Chunk = scriptSigChunks.get(op0ChunkIndex);
builder.addChunk(op0Chunk);
scriptBuilder.addChunk(op0Chunk);

int signaturesStartIndex = op0ChunkIndex + 1;
int signaturesEndIndex = opIfElseChunkIndex - 1;
for (int i = signaturesStartIndex; i <= signaturesEndIndex ; i++) {
byte[] data = new byte[0];
builder.data(data);
scriptBuilder.data(data);
}

ScriptChunk opIfElseChunk = scriptSigChunks.get(opIfElseChunkIndex);
builder.addChunk(opIfElseChunk);
scriptBuilder.addChunk(opIfElseChunk);
ScriptChunk redeemScriptChunk = scriptSigChunks.get(redeemScriptChunkIndex);
builder.addChunk(redeemScriptChunk);
scriptBuilder.addChunk(redeemScriptChunk);

return builder.build();
return scriptBuilder.build();
}
}

0 comments on commit 309661f

Please sign in to comment.