@@ -216,8 +216,8 @@ public void onBlock(org.ethereum.core.Block block, List<TransactionReceipt> rece
216216 if (!isPegoutEnabled || nodeBlockProcessor .hasBetterBlockToSync ()) {
217217 return ;
218218 }
219- // Pegout must be processed on an every-single-block basis,
220- // since otherwise we could be missing pegout potentially mined
219+ // Pegout events must be processed on an every-single-block basis,
220+ // since otherwise we could be missing pegouts potentially mined
221221 // on what originally were side-chains and then turned into best-chains.
222222 Stream <LogInfo > transactionLogs = receipts .stream ().map (TransactionReceipt ::getLogInfoList ).flatMap (Collection ::stream );
223223 Stream <LogInfo > bridgeLogs = transactionLogs .filter (info -> Arrays .equals (info .getAddress (), PrecompiledContracts .BRIDGE_ADDR .getBytes ()));
@@ -248,7 +248,7 @@ private BtcTransaction convertToBtcTxFromSolidityData(byte[] dataFromBtcReleaseT
248248
249249 protected void processPegouts (Set <Map .Entry <Keccak256 , BtcTransaction >> pegouts ) {
250250 try {
251- logger .debug ("[processPegout ] Starting process with {} pegouts" , pegouts .size ());
251+ logger .debug ("[processPegouts ] Starting process with {} pegouts" , pegouts .size ());
252252 int version = signer .getVersionForKeyId (BTC_KEY_ID .getKeyId ());
253253 // Get pegout information and store it in a new list
254254 List <PegoutCreationInformation > pegoutsReadyToSign = new ArrayList <>();
@@ -257,7 +257,7 @@ protected void processPegouts(Set<Map.Entry<Keccak256, BtcTransaction>> pegouts)
257257 tryGetPegoutInformation (version , pegout .getKey (), pegoutBtcTx )
258258 .ifPresent (pegoutsReadyToSign ::add );
259259 }
260- logger .debug ("[processPegout ] Going to sign {} pegouts" , pegoutsReadyToSign .size ());
260+ logger .debug ("[processPegouts ] Going to sign {} pegouts" , pegoutsReadyToSign .size ());
261261 // TODO: Sorting and then looping again is not efficient but we are making a compromise on performance here as we don't have that many pegouts
262262 // Sort descending
263263 pegoutsReadyToSign .sort ((a , b ) -> (int ) (b .getPegoutCreationRskBlock ().getNumber () - a .getPegoutCreationRskBlock ().getNumber ()));
@@ -266,9 +266,9 @@ protected void processPegouts(Set<Map.Entry<Keccak256, BtcTransaction>> pegouts)
266266 signConfirmedPegout (version , pegoutsReadyToSign .get (0 ));
267267 }
268268 } catch (Exception e ) {
269- logger .error ("[processPegout ] There was an error trying to process pegouts" , e );
269+ logger .error ("[processPegouts ] There was an error trying to process pegouts" , e );
270270 }
271- logger .trace ("[processPegout ] Finished processing pegouts" );
271+ logger .trace ("[processPegouts ] Finished processing pegouts" );
272272 }
273273
274274 protected Optional <PegoutCreationInformation > tryGetPegoutInformation (
@@ -278,19 +278,19 @@ protected Optional<PegoutCreationInformation> tryGetPegoutInformation(
278278 ) {
279279 try {
280280 // Discard transactions this fed already signed or cannot be signed by the observed federations
281- logger .trace ("[tryGetPegoutInformation] Validating if pegout btcTxHash {} can be signed by observed federations and " +
281+ logger .trace ("[tryGetPegoutInformation] Validating if pegoutBtcTxHash {} can be signed by observed federations and " +
282282 "that it is not already signed by current fed" , pegoutBtcTx .getHash ());
283- validateConfirmedPegoutCanBeSigned (pegoutBtcTx );
283+ validatePegoutBtcTxCanBeSigned (pegoutBtcTx );
284284
285285 // IMPORTANT: As per the current behaviour of the bridge, no pegout should have inputs to be signed
286286 // by different federations. Taking this into account, when removing the signatures from the tx new
287287 // scriptSigs are created that all spend from the same federation
288288 logger .trace ("[tryGetPegoutInformation] Removing possible signatures from pegout btcTxHash {}" , pegoutBtcTx .getHash ());
289289 Federation spendingFed = getSpendingFederation (pegoutBtcTx );
290- removeSignaturesFromPegoutBtxTx (pegoutBtcTx , spendingFed );
290+ removeSignaturesFromPegoutBtcTx (pegoutBtcTx , spendingFed );
291291 logger .trace ("[tryGetPegoutInformation] pegout btcTxHash without signatures {}" , pegoutBtcTx .getHash ());
292292
293- logger .trace ("[tryGetPegoutInformation] Is tx in storage? {}" , storageAccessor .hasBtcTxHash (pegoutBtcTx .getHash ()));
293+ logger .trace ("[tryGetPegoutInformation] Is pegout btc tx in storage? {}" , storageAccessor .hasBtcTxHash (pegoutBtcTx .getHash ()));
294294 // Try to get the pegoutCreationRskTxHash from the map in memory, and if not found then use pegoutConfirmationRskTxHash
295295 Keccak256 pegoutCreationRskTxHash = storageAccessor .hasBtcTxHash (pegoutBtcTx .getHash ()) ?
296296 storageAccessor .getRskTxHash (pegoutBtcTx .getHash ()) :
@@ -319,18 +319,18 @@ protected Optional<PegoutCreationInformation> tryGetPegoutInformation(
319319 return Optional .empty ();
320320 }
321321
322- protected void validateConfirmedPegoutCanBeSigned (BtcTransaction pegoutBtcTx ) throws FederatorAlreadySignedException , FederationCantSignException {
322+ protected void validatePegoutBtcTxCanBeSigned (BtcTransaction pegoutBtcTx ) throws FederatorAlreadySignedException , FederationCantSignException {
323323 try {
324324 BtcECKey federatorPublicKey = signer .getPublicKey (BTC_KEY_ID .getKeyId ()).toBtcKey ();
325- logger .trace ("[validateConfirmedPegoutCanBeSigned ] Federator public key {}" , federatorPublicKey );
325+ logger .trace ("[validatePegoutBtcTxCanBeSigned ] Federator public key {}" , federatorPublicKey );
326326
327327 for (int inputIndex = 0 ; inputIndex < pegoutBtcTx .getInputs ().size (); inputIndex ++) {
328328 TransactionInput txIn = pegoutBtcTx .getInput (inputIndex );
329329 Script redeemScript = getRedeemScriptFromInput (txIn );
330330 Script standardRedeemScript = extractStandardRedeemScript (redeemScript );
331331
332332 // Check if input is not already signed by the current federator
333- logger .trace ("[validateConfirmedPegoutCanBeSigned ] Checking if the input {} is not already signed by the current federator" , inputIndex );
333+ logger .trace ("[validatePegoutBtcTxCanBeSigned ] Checking if the input {} is not already signed by the current federator" , inputIndex );
334334 co .rsk .bitcoinj .core .Sha256Hash sigHash = pegoutBtcTx .hashForSignature (
335335 inputIndex ,
336336 redeemScript ,
@@ -348,12 +348,12 @@ protected void validateConfirmedPegoutCanBeSigned(BtcTransaction pegoutBtcTx) th
348348 }
349349
350350 // Check if any of the observed federations can sign the tx
351- logger .trace ("[validateConfirmedPegoutCanBeSigned ] Checking if any of the observed federations can sign the pegout btc tx input {}" , inputIndex );
351+ logger .trace ("[validatePegoutBtcTxCanBeSigned ] Checking if any of the observed federations can sign the pegout btc tx input {}" , inputIndex );
352352 observedFederations .stream ()
353- .forEach (f -> logger .trace ("[validateConfirmedPegoutCanBeSigned ] federation p2sh redeem script {}" , f .getRedeemScript ()));
353+ .forEach (f -> logger .trace ("[validatePegoutBtcTxCanBeSigned ] federation p2sh redeem script {}" , f .getRedeemScript ()));
354354 List <Federation > spendingFedFilter = observedFederations .stream ()
355355 .filter (f -> (extractDefaultRedeemScript (f )).equals (standardRedeemScript )).collect (Collectors .toList ());
356- logger .debug ("[validateConfirmedPegoutCanBeSigned ] spendingFedFilter size {}" , spendingFedFilter .size ());
356+ logger .debug ("[validatePegoutBtcTxCanBeSigned ] spendingFedFilter size {}" , spendingFedFilter .size ());
357357 if (spendingFedFilter .isEmpty ()) {
358358 String message = String .format (
359359 "PegoutBtcTxHash %s can't be signed by any of the observed federations" ,
@@ -363,7 +363,7 @@ protected void validateConfirmedPegoutCanBeSigned(BtcTransaction pegoutBtcTx) th
363363 }
364364 }
365365 } catch (SignerException e ) {
366- String message = String .format ("[validateConfirmedPegoutCanBeSigned ] Error validating pegoutBtcTxHash %s, " +
366+ String message = String .format ("[validatePegoutBtcTxCanBeSigned ] Error validating pegoutBtcTxHash %s, " +
367367 "failed to get current federator public key" , pegoutBtcTx .getHashAsString ());
368368 logger .error (message , e );
369369 }
@@ -434,16 +434,16 @@ public void onBroadcastingSignedPegout(BtcTransaction signedBtcTx) {
434434 Received pegoutBtcTx inputs are replaced by base inputs without signatures that spend from the given federation.
435435 This way the pegoutBtcTx has the same hash as the one registered in release_requested event topics.
436436 */
437- protected void removeSignaturesFromPegoutBtxTx (BtcTransaction pegoutBtcTx , Federation spendingFed ) {
437+ protected void removeSignaturesFromPegoutBtcTx (BtcTransaction pegoutBtcTx , Federation spendingFed ) {
438438 for (int inputIndex = 0 ; inputIndex < pegoutBtcTx .getInputs ().size (); inputIndex ++) {
439439 //Get redeem script for current input
440440 TransactionInput txInput = pegoutBtcTx .getInput (inputIndex );
441441 Script inputRedeemScript = getRedeemScriptFromInput (txInput );
442- logger .trace ("[removeSignaturesFromPegoutBtxTx ] input {} scriptSig {}" , inputIndex , pegoutBtcTx .getInput (inputIndex ).getScriptSig ());
443- logger .trace ("[removeSignaturesFromPegoutBtxTx ] input {} redeem script {}" , inputIndex , inputRedeemScript );
442+ logger .trace ("[removeSignaturesFromPegoutBtcTx ] input {} scriptSig {}" , inputIndex , pegoutBtcTx .getInput (inputIndex ).getScriptSig ());
443+ logger .trace ("[removeSignaturesFromPegoutBtcTx ] input {} redeem script {}" , inputIndex , inputRedeemScript );
444444
445445 txInput .setScriptSig (createBaseInputScriptThatSpendsFromTheFederation (spendingFed , inputRedeemScript ));
446- logger .debug ("[removeSignaturesFromPegoutBtxTx ] Updated input {} scriptSig with base input script that " +
446+ logger .debug ("[removeSignaturesFromPegoutBtcTx ] Updated input {} scriptSig with base input script that " +
447447 "spends from the federation {}" , inputIndex , spendingFed .getAddress ());
448448 }
449449 }
0 commit comments