Skip to content

Commit 59e3a46

Browse files
committed
refactor(btcreleaseclient): rename vars
1 parent 76509d5 commit 59e3a46

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/main/java/co/rsk/federate/btcreleaseclient/BtcReleaseClient.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,22 @@ public void onBlock(org.ethereum.core.Block block, List<TransactionReceipt> rece
287287
* </p>
288288
*
289289
* @param currentBlockNumber the current block number in the blockchain
290-
* @param svpSpendTx the Keccak256 hash and the Bitcoin transaction of the svp spend transaction waiting to be signed
290+
* @param svpSpendTxEntry the Keccak256 hash and the Bitcoin transaction of the svp spend transaction waiting to be signed
291291
* @return {@code true} if the transaction has the required number of confirmations and is ready to be signed;
292292
* {@code false} otherwise
293293
*/
294-
private boolean isSVPSpendTxReadyToSign(long currentBlockNumber, Map.Entry<Keccak256, BtcTransaction> svpSpendTx) {
294+
private boolean isSVPSpendTxReadyToSign(long currentBlockNumber, Map.Entry<Keccak256, BtcTransaction> svpSpendTxEntry) {
295295
try {
296296

297-
BtcTransaction btcTx = svpSpendTx.getValue();
297+
BtcTransaction svpSpendTx = svpSpendTxEntry.getValue();
298298

299-
logger.debug("[isSvpSpendTxReadyToSign] SVP spend tx before removing signatures [{}]", btcTx.getHash());
300-
BitcoinUtils.removeSignaturesFromTransactionWithP2shMultiSigInputs(btcTx);
301-
logger.debug("[isSvpSpendTxReadyToSign] SVP spend tx after removing signatures [{}]", btcTx.getHash());
299+
logger.debug("[isSvpSpendTxReadyToSign] SVP spend tx before removing signatures [{}]", svpSpendTx.getHash());
300+
BitcoinUtils.removeSignaturesFromTransactionWithP2shMultiSigInputs(svpSpendTx);
301+
logger.debug("[isSvpSpendTxReadyToSign] SVP spend tx after removing signatures [{}]", svpSpendTx.getHash());
302302

303303
int version = signer.getVersionForKeyId(BTC.getKeyId());
304304
ReleaseCreationInformation releaseCreationInformation = releaseCreationInformationGetter.getTxInfoToSign(
305-
version, svpSpendTx.getKey(), btcTx);
305+
version, svpSpendTxEntry.getKey(), svpSpendTx);
306306

307307
boolean isReadyToSign = Optional.ofNullable(releaseCreationInformation)
308308
.map(ReleaseCreationInformation::getPegoutCreationBlock)
@@ -312,7 +312,7 @@ private boolean isSVPSpendTxReadyToSign(long currentBlockNumber, Map.Entry<Kecca
312312
.isPresent();
313313

314314
logger.info("[isSvpSpendTxReadyToSign] SVP spend tx readiness check for signing: tx hash [{}], Current block [{}], Ready to sign? [{}]",
315-
svpSpendTx.getKey(),
315+
svpSpendTxEntry.getKey(),
316316
currentBlockNumber,
317317
isReadyToSign ? "YES" : "NO");
318318

src/test/java/co/rsk/federate/btcreleaseclient/BtcReleaseClientTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,8 @@ void onBestBlock_whenOnlySvpSpendTxWaitingForSignaturesIsAvailable_shouldAddSign
771771
@Test
772772
void onBestBlock_whenSvpSpendTxWaitingForSignaturesIsAvailableWithSignatureFromAnotherFederationMember_shouldSendAddSignature() throws Exception {
773773
// Arrange
774-
List<BtcECKey> federationPrivateKeys = TestUtils.getFederationPrivateKeys(9);
775-
Federation proposedFederation = TestUtils.createFederation(bridgeConstants.getBtcParams(), federationPrivateKeys);
776-
FederationMember federationMember = proposedFederation.getMembers().get(0);
774+
List<BtcECKey> federationKeys = TestUtils.getFederationPrivateKeys(9);
775+
Federation proposedFederation = TestUtils.createFederation(bridgeConstants.getBtcParams(), federationKeys);
777776
Script scriptSig = proposedFederation.getP2SHScript().createEmptyInputScript(null, proposedFederation.getRedeemScript());
778777

779778
BtcTransaction svpSpendTx = new BtcTransaction(params);
@@ -788,7 +787,7 @@ void onBestBlock_whenSvpSpendTxWaitingForSignaturesIsAvailableWithSignatureFromA
788787
BitcoinTestUtils.signTransactionInputFromP2shMultiSig(
789788
svpSpendTx,
790789
inputs.indexOf(input),
791-
List.of(federationPrivateKeys.get(0))
790+
List.of(federationKeys.get(0))
792791
);
793792
}
794793

@@ -804,6 +803,7 @@ void onBestBlock_whenSvpSpendTxWaitingForSignaturesIsAvailableWithSignatureFromA
804803
}).when(ethereum).addListener(any(EthereumListener.class));
805804

806805
FederatorSupport federatorSupport = mock(FederatorSupport.class);
806+
FederationMember federationMember = proposedFederation.getMembers().get(0);
807807
doReturn(federationMember).when(federatorSupport).getFederationMember();
808808
// return svp spend tx waiting for signatures
809809
doReturn(Optional.of(stateForProposedFederator)).when(federatorSupport).getStateForProposedFederator();

0 commit comments

Comments
 (0)