diff --git a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java index 066b9d9831..4914b5cdb9 100644 --- a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java +++ b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java @@ -1579,10 +1579,12 @@ public void addSignature(BtcECKey federatorBtcPublicKey, List signatures Context.propagate(btcContext); if (svpIsOngoing() && isSvpSpendTx(releaseCreationRskTxHash)) { + logger.trace("[addSignature] Going to sign svp spend transaction with federator public key {}", federatorBtcPublicKey); addSvpSpendTxSignatures(federatorBtcPublicKey, signatures); return; } + logger.trace("[addSignature] Going to sign release transaction with federator public key {}", federatorBtcPublicKey); addReleaseSignatures(federatorBtcPublicKey, signatures, releaseCreationRskTxHash); } @@ -1594,7 +1596,7 @@ private void addReleaseSignatures( BtcTransaction releaseTx = provider.getPegoutsWaitingForSignatures().get(releaseCreationRskTxHash); if (releaseTx == null) { - logger.warn("No tx waiting for signature for hash {}. Probably fully signed already.", releaseCreationRskTxHash); + logger.warn("[addReleaseSignatures] No tx waiting for signature for hash {}. Probably fully signed already.", releaseCreationRskTxHash); return; } if (!areSignaturesEnoughToSignAllTxInputs(releaseTx, signatures)) { @@ -1604,7 +1606,7 @@ private void addReleaseSignatures( Optional optionalFederation = getFederationFromPublicKey(federatorPublicKey); if (optionalFederation.isEmpty()) { logger.warn( - "[addSignature] Supplied federator btc public key {} does not belong to any of the federators.", + "[addReleaseSignatures] Supplied federator btc public key {} does not belong to any of the federators.", federatorPublicKey ); return; @@ -1614,7 +1616,7 @@ private void addReleaseSignatures( Optional federationMember = federation.getMemberByBtcPublicKey(federatorPublicKey); if (federationMember.isEmpty()){ logger.warn( - "[addSignature] Supplied federator btc public key {} doest not match any of the federator member btc public keys {}.", + "[addReleaseSignatures] Supplied federator btc public key {} doest not match any of the federator member btc public keys {}.", federatorPublicKey, federation.getBtcPublicKeys() ); return; @@ -1696,7 +1698,7 @@ private boolean areSignaturesEnoughToSignAllTxInputs(BtcTransaction releaseTx, L int signaturesSize = signatures.size(); if (inputsSize != signaturesSize) { - logger.warn("Expected {} signatures but received {}.", inputsSize, signaturesSize); + logger.warn("[areSignaturesEnoughToSignAllTxInputs] Expected {} signatures but received {}.", inputsSize, signaturesSize); return false; } return true; @@ -1707,12 +1709,12 @@ private void logMissingSignatures(BtcTransaction btcTx, Keccak256 releaseCreatio int neededSignatures = federation.getNumberOfSignaturesRequired(); int signaturesCount = neededSignatures - missingSignatures; - logger.debug("Tx {} not yet fully signed. Requires {}/{} signatures but has {}", + logger.debug("[logMissingSignatures] Tx {} not yet fully signed. Requires {}/{} signatures but has {}", releaseCreationRskTxHash, neededSignatures, federation.getSize(), signaturesCount); } private void logReleaseBtc(BtcTransaction btcTx, byte[] releaseCreationRskTxHashSerialized) { - logger.info("Tx fully signed {}. Hex: {}", btcTx, Bytes.of(btcTx.bitcoinSerialize())); + logger.info("[logReleaseBtc] Tx fully signed {}. Hex: {}", btcTx, Bytes.of(btcTx.bitcoinSerialize())); eventLogger.logReleaseBtc(btcTx, releaseCreationRskTxHashSerialized); } @@ -1757,7 +1759,7 @@ private List getTransactionSignatures(BtcECKey federatorBt if (!federatorBtcPublicKey.verify(sigHash, decodedSignature)) { logger.warn( - "Signature {} {} is not valid for hash {} and public key {}", + "[getTransactionSignatures] Signature {} {} is not valid for hash {} and public key {}", i, Bytes.of(decodedSignature.encodeToDER()), sigHash, @@ -1768,7 +1770,7 @@ private List getTransactionSignatures(BtcECKey federatorBt TransactionSignature txSig = new TransactionSignature(decodedSignature, BtcTransaction.SigHash.ALL, false); if (!txSig.isCanonical()) { - logger.warn("Signature {} {} is not canonical.", i, Bytes.of(decodedSignature.encodeToDER())); + logger.warn("[getTransactionSignatures] Signature {} {} is not canonical.", i, Bytes.of(decodedSignature.encodeToDER())); throw new SignatureException(); } txSigs.add(txSig); @@ -1783,7 +1785,7 @@ private List getDecodedSignatures(List signatur decodedSignatures.add(BtcECKey.ECDSASignature.decodeFromDER(signature)); } catch (RuntimeException e) { int index = signatures.indexOf(signature); - logger.warn("Malformed signature for input {} : {}", index, Bytes.of(signature)); + logger.warn("[getDecodedSignatures] Malformed signature for input {} : {}", index, Bytes.of(signature)); throw new SignatureException(); } } @@ -1807,7 +1809,7 @@ private boolean sign( BridgeUtils.isInputSignedByThisFederator(federatorBtcPublicKey, sigHash, input); if (alreadySignedByThisFederator) { - logger.warn("Input {} of tx {} already signed by this federator.", i, releaseCreationRskTxHash); + logger.warn("[sign] Input {} of tx {} already signed by this federator.", i, releaseCreationRskTxHash); break; } @@ -1823,14 +1825,14 @@ private boolean sign( Script inputScriptWithSignature = outputScript.getScriptSigWithSignature(inputScript, txSigs.get(i).encodeToBitcoin(), sigIndex); input.setScriptSig(inputScriptWithSignature); - logger.debug("Tx input {} for tx {} signed.", i, releaseCreationRskTxHash); + logger.debug("[sign] Tx input {} for tx {} signed.", i, releaseCreationRskTxHash); signed = true; } catch (IllegalStateException e) { Federation retiringFederation = getRetiringFederation(); if (getActiveFederation().hasBtcPublicKey(federatorBtcPublicKey)) { - logger.debug("A member of the active federation is trying to sign a tx of the retiring one"); + logger.debug("[sign] A member of the active federation is trying to sign a tx of the retiring one"); } else if (retiringFederation != null && retiringFederation.hasBtcPublicKey(federatorBtcPublicKey)) { - logger.debug("A member of the retiring federation is trying to sign a tx of the active one"); + logger.debug("[sign] A member of the retiring federation is trying to sign a tx of the active one"); } return false; }