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 64407fc4e54..d3d15929729 100644 --- a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java +++ b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java @@ -23,7 +23,6 @@ import static co.rsk.peg.ReleaseTransactionBuilder.BTC_TX_VERSION_2; import static co.rsk.peg.bitcoin.BitcoinUtils.*; import static co.rsk.peg.bitcoin.UtxoUtils.extractOutpointValues; -import static co.rsk.peg.pegin.RejectedPeginReason.INVALID_AMOUNT; import static java.util.Objects.isNull; import static org.ethereum.config.blockchain.upgrades.ConsensusRule.*; @@ -505,68 +504,72 @@ protected void registerPegIn( PeginProcessAction peginProcessAction = peginEvaluationResult.getPeginProcessAction(); switch (peginProcessAction) { - case CAN_BE_REGISTERED -> { + case REGISTER -> { logger.debug("[{}] Peg-in is valid, going to register", METHOD_NAME); executePegIn(btcTx, peginInformation, totalAmount); } - case CAN_BE_REFUNDED -> { - // If the peg-in cannot be registered means it should be rejected - handleRejectedPegin(btcTx, - peginEvaluationResult); - logger.debug("[{}] Refunding to address {} ", METHOD_NAME, - peginInformation.getBtcRefundAddress()); - generateRejectionRelease(btcTx, peginInformation.getBtcRefundAddress(), rskTxHash, - totalAmount); - markTxAsProcessed(btcTx); - } - case CANNOT_BE_REFUNDED -> { - // If the peg-in cannot be registered means it should be rejected - RejectedPeginReason rejectedPeginReason = handleRejectedPegin(btcTx, - peginEvaluationResult); - - handleNonRefundablePegin(btcTx, peginInformation.getProtocolVersion(), - rejectedPeginReason); - - if (!activations.isActive(RSKIP459)) { - return; - } - // Since RSKIP459, rejected peg-ins should be marked as processed - markTxAsProcessed(btcTx); - } + case REFUND -> handleRefundablePegin(btcTx, rskTxHash, peginEvaluationResult, + peginInformation.getBtcRefundAddress()); + case NO_REFUND -> handleNonRefundablePegin(btcTx, peginInformation.getProtocolVersion(), + peginEvaluationResult); } } - private RejectedPeginReason handleRejectedPegin(BtcTransaction btcTx, - PeginEvaluationResult peginEvaluationResult) { - return peginEvaluationResult.getRejectedPeginReason().map(reason -> { - logger.debug("[{handleRejectedPegin}] Rejected peg-in, reason {}", reason); - eventLogger.logRejectedPegin(btcTx, reason); - return reason; - }).orElseThrow(() -> { - // This flow should never be reached. There should always be a rejected pegin reason. - String message = "Invalid state. No rejected reason was returned for an invalid pegin."; - logger.error("[{handleRejectedPegin}] {}", message); - return new IllegalStateException(message); - }); + private void handleRefundablePegin(BtcTransaction btcTx, Keccak256 rskTxHash, + PeginEvaluationResult peginEvaluationResult, Address btcRefundAddress) + throws IOException { + RejectedPeginReason rejectedPeginReason = peginEvaluationResult.getRejectedPeginReason() + .orElseThrow(() -> { + // This flow should never be reached. There should always be a rejected pegin reason. + String message = "Invalid state. No rejected reason was returned for an invalid pegin."; + logger.error("[{handleRefundablePegin}] {}", message); + return new IllegalStateException(message); + }); + + logger.debug("[{handleRefundablePegin}] Rejected peg-in, reason {}", rejectedPeginReason); + eventLogger.logRejectedPegin(btcTx, rejectedPeginReason); + + logger.debug("[{handleRefundablePegin}] Refunding to address {} ", btcRefundAddress); + Coin totalAmount = computeTotalAmountSent(btcTx); + generateRejectionRelease(btcTx, btcRefundAddress, rskTxHash, + totalAmount); + markTxAsProcessed(btcTx); } private void handleNonRefundablePegin( BtcTransaction btcTx, int protocolVersion, - RejectedPeginReason rejectedPeginReason - ) { - UnrefundablePeginReason unrefundablePeginReason; - if (rejectedPeginReason == INVALID_AMOUNT) { - unrefundablePeginReason = UnrefundablePeginReason.INVALID_AMOUNT; - } else { - unrefundablePeginReason = protocolVersion == 1 ? - UnrefundablePeginReason.PEGIN_V1_REFUND_ADDRESS_NOT_SET : - UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER; - } + PeginEvaluationResult peginEvaluationResult + ) throws IOException { + RejectedPeginReason rejectedPeginReason = peginEvaluationResult.getRejectedPeginReason() + .orElseThrow(() -> { + // This flow should never be reached. There should always be a rejected pegin reason. + String message = "Invalid state. No rejected reason was returned for an invalid pegin."; + logger.error("[{handleNonRefundablePegin}] {}", message); + return new IllegalStateException(message); + }); + + logger.debug("[{handleNonRefundablePegin}] Rejected peg-in, reason {}", + rejectedPeginReason); + eventLogger.logRejectedPegin(btcTx, rejectedPeginReason); + + NonRefundablePeginReason nonRefundablePeginReason = switch (rejectedPeginReason) { + case INVALID_AMOUNT -> NonRefundablePeginReason.INVALID_AMOUNT; + case LEGACY_PEGIN_UNDETERMINED_SENDER, PEGIN_V1_INVALID_PAYLOAD -> + protocolVersion == 1 ? NonRefundablePeginReason.PEGIN_V1_REFUND_ADDRESS_NOT_SET + : NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER; + default -> throw new IllegalStateException("Unexpected value: " + rejectedPeginReason); + }; logger.debug("[handleNonRefundablePegin] Nonrefundable tx {}. Reason {}", btcTx.getHash(), - unrefundablePeginReason); - eventLogger.logUnrefundablePegin(btcTx, unrefundablePeginReason); + nonRefundablePeginReason); + eventLogger.logNonRefundablePegin(btcTx, nonRefundablePeginReason); + + if (!activations.isActive(RSKIP459)) { + return; + } + // Since RSKIP459, rejected peg-ins should be marked as processed + markTxAsProcessed(btcTx); } /** @@ -734,9 +737,9 @@ private void refundTxSender( if (activations.isActive(ConsensusRule.RSKIP181)) { if (peginInformation.getProtocolVersion() == 1) { - eventLogger.logUnrefundablePegin(btcTx, UnrefundablePeginReason.PEGIN_V1_REFUND_ADDRESS_NOT_SET); + eventLogger.logNonRefundablePegin(btcTx, NonRefundablePeginReason.PEGIN_V1_REFUND_ADDRESS_NOT_SET); } else { - eventLogger.logUnrefundablePegin(btcTx, UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); + eventLogger.logNonRefundablePegin(btcTx, NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); } } } diff --git a/rskj-core/src/main/java/co/rsk/peg/PegUtils.java b/rskj-core/src/main/java/co/rsk/peg/PegUtils.java index afe6ef68625..e5140f21f4f 100644 --- a/rskj-core/src/main/java/co/rsk/peg/PegUtils.java +++ b/rskj-core/src/main/java/co/rsk/peg/PegUtils.java @@ -182,7 +182,7 @@ static PeginEvaluationResult evaluatePegin( if(!allUTXOsToFedAreAboveMinimumPeginValue(btcTx, fedWallet, minimumPeginTxValue, activations)) { logger.debug("[evaluatePegin] Peg-in contains at least one utxo below the minimum value"); - return new PeginEvaluationResult(PeginProcessAction.CANNOT_BE_REFUNDED, INVALID_AMOUNT); + return new PeginEvaluationResult(PeginProcessAction.NO_REFUND, INVALID_AMOUNT); } try { @@ -196,8 +196,8 @@ static PeginEvaluationResult evaluatePegin( boolean hasRefundAddress = peginInformation.getBtcRefundAddress() != null; PeginProcessAction peginProcessAction = hasRefundAddress ? - PeginProcessAction.CAN_BE_REFUNDED : - PeginProcessAction.CANNOT_BE_REFUNDED; + PeginProcessAction.REFUND : + PeginProcessAction.NO_REFUND; return new PeginEvaluationResult(peginProcessAction, PEGIN_V1_INVALID_PAYLOAD); } @@ -207,7 +207,7 @@ static PeginEvaluationResult evaluatePegin( case 0: return evaluateLegacyPeginSender(peginInformation.getSenderBtcAddressType()); case 1: - return new PeginEvaluationResult(PeginProcessAction.CAN_BE_REGISTERED); + return new PeginEvaluationResult(PeginProcessAction.REGISTER); default: // This flow should never be reached. String message = String.format("Invalid state. Unexpected pegin protocol %d", protocolVersion); @@ -220,12 +220,12 @@ private static PeginEvaluationResult evaluateLegacyPeginSender(TxSenderAddressTy switch (senderAddressType) { case P2PKH: case P2SHP2WPKH: - return new PeginEvaluationResult(PeginProcessAction.CAN_BE_REGISTERED); + return new PeginEvaluationResult(PeginProcessAction.REGISTER); case P2SHMULTISIG: case P2SHP2WSH: - return new PeginEvaluationResult(PeginProcessAction.CAN_BE_REFUNDED, LEGACY_PEGIN_MULTISIG_SENDER); + return new PeginEvaluationResult(PeginProcessAction.REFUND, LEGACY_PEGIN_MULTISIG_SENDER); default: - return new PeginEvaluationResult(PeginProcessAction.CANNOT_BE_REFUNDED, LEGACY_PEGIN_UNDETERMINED_SENDER); + return new PeginEvaluationResult(PeginProcessAction.NO_REFUND, LEGACY_PEGIN_UNDETERMINED_SENDER); } } diff --git a/rskj-core/src/main/java/co/rsk/peg/pegin/PeginProcessAction.java b/rskj-core/src/main/java/co/rsk/peg/pegin/PeginProcessAction.java index 5fc6708c079..7306b1df261 100644 --- a/rskj-core/src/main/java/co/rsk/peg/pegin/PeginProcessAction.java +++ b/rskj-core/src/main/java/co/rsk/peg/pegin/PeginProcessAction.java @@ -1,7 +1,7 @@ package co.rsk.peg.pegin; public enum PeginProcessAction { - CAN_BE_REGISTERED, - CAN_BE_REFUNDED, - CANNOT_BE_REFUNDED + REGISTER, + REFUND, + NO_REFUND } diff --git a/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLogger.java b/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLogger.java index 8dd17341a9e..10f6a708e26 100644 --- a/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLogger.java +++ b/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLogger.java @@ -60,7 +60,7 @@ default void logRejectedPegin(BtcTransaction btcTx, RejectedPeginReason reason) throw new UnsupportedOperationException(); } - default void logUnrefundablePegin(BtcTransaction btcTx, UnrefundablePeginReason reason) { + default void logNonRefundablePegin(BtcTransaction btcTx, NonRefundablePeginReason reason) { throw new UnsupportedOperationException(); } diff --git a/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLoggerImpl.java b/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLoggerImpl.java index 30c549af7a9..f2b94d10688 100644 --- a/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLoggerImpl.java +++ b/rskj-core/src/main/java/co/rsk/peg/utils/BridgeEventLoggerImpl.java @@ -212,7 +212,7 @@ public void logRejectedPegin(BtcTransaction btcTx, RejectedPeginReason reason) { } @Override - public void logUnrefundablePegin(BtcTransaction btcTx, UnrefundablePeginReason reason) { + public void logNonRefundablePegin(BtcTransaction btcTx, NonRefundablePeginReason reason) { CallTransaction.Function event = BridgeEvents.UNREFUNDABLE_PEGIN.getEvent(); byte[] btcTxHashSerialized = btcTx.getHash().getBytes(); diff --git a/rskj-core/src/main/java/co/rsk/peg/utils/UnrefundablePeginReason.java b/rskj-core/src/main/java/co/rsk/peg/utils/NonRefundablePeginReason.java similarity index 75% rename from rskj-core/src/main/java/co/rsk/peg/utils/UnrefundablePeginReason.java rename to rskj-core/src/main/java/co/rsk/peg/utils/NonRefundablePeginReason.java index da523b55e8d..95db596273f 100644 --- a/rskj-core/src/main/java/co/rsk/peg/utils/UnrefundablePeginReason.java +++ b/rskj-core/src/main/java/co/rsk/peg/utils/NonRefundablePeginReason.java @@ -1,13 +1,13 @@ package co.rsk.peg.utils; -public enum UnrefundablePeginReason { +public enum NonRefundablePeginReason { LEGACY_PEGIN_UNDETERMINED_SENDER(1), PEGIN_V1_REFUND_ADDRESS_NOT_SET(2), INVALID_AMOUNT(3); private final int value; - UnrefundablePeginReason(int value) { + NonRefundablePeginReason(int value) { this.value = value; } diff --git a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRegisterBtcTransactionTest.java b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRegisterBtcTransactionTest.java index e72a8ebe7c8..7bf9cfc4464 100644 --- a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRegisterBtcTransactionTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRegisterBtcTransactionTest.java @@ -4,7 +4,7 @@ import static co.rsk.peg.PegTestUtils.*; import static co.rsk.peg.bitcoin.UtxoUtils.extractOutpointValues; import static co.rsk.peg.pegin.RejectedPeginReason.*; -import static co.rsk.peg.utils.UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER; +import static co.rsk.peg.utils.NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; @@ -31,7 +31,7 @@ import co.rsk.peg.storage.BridgeStorageAccessorImpl; import co.rsk.peg.storage.StorageAccessor; import co.rsk.peg.utils.BridgeEventLogger; -import co.rsk.peg.utils.UnrefundablePeginReason; +import co.rsk.peg.utils.NonRefundablePeginReason; import co.rsk.peg.whitelist.LockWhitelist; import co.rsk.peg.whitelist.WhitelistStorageProvider; import co.rsk.peg.whitelist.WhitelistSupportImpl; @@ -101,7 +101,7 @@ class BridgeSupportRegisterBtcTransactionTest { // Before peg-out tx index gets in use private void assertInvalidPeginIsIgnored() throws IOException { verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); verify(provider, never()).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); assertTrue(activeFederationUtxos.isEmpty()); @@ -111,7 +111,7 @@ private void assertInvalidPeginIsIgnored() throws IOException { // After peg-out tx index gets in use private void assertInvalidPeginIsRejectedWithInvalidAmountReason(BtcTransaction btcTransaction, ActivationConfig.ForBlock activations) throws IOException { verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, INVALID_AMOUNT); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin(btcTransaction, UnrefundablePeginReason.INVALID_AMOUNT); + verify(bridgeEventLogger, times(1)).logNonRefundablePegin(btcTransaction, NonRefundablePeginReason.INVALID_AMOUNT); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); var shouldMarkTxAsProcessed = activations == lovell700Activations? times(1) : never(); @@ -124,7 +124,7 @@ private void assertInvalidPeginIsRejectedWithInvalidAmountReason(BtcTransaction private void assertUnknownTxIsProcessedAsPegin(RskAddress expectedRskAddressToBeLogged, BtcTransaction btcTransaction, int protocolVersion) throws IOException { verify(bridgeEventLogger, times(1)).logPeginBtc(expectedRskAddressToBeLogged, btcTransaction, Coin.ZERO, protocolVersion); verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); assertTrue(activeFederationUtxos.isEmpty()); assertTrue(retiringFederationUtxos.isEmpty()); @@ -133,7 +133,7 @@ private void assertUnknownTxIsProcessedAsPegin(RskAddress expectedRskAddressToBe // After arrowhead600Activations but before grace period private void assertUnknownTxIsRejectedWithInvalidAmountReason(BtcTransaction btcTransaction) throws IOException { verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, INVALID_AMOUNT); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin(btcTransaction, UnrefundablePeginReason.INVALID_AMOUNT); + verify(bridgeEventLogger, times(1)).logNonRefundablePegin(btcTransaction, NonRefundablePeginReason.INVALID_AMOUNT); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); verify(provider, never()).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); assertTrue(activeFederationUtxos.isEmpty()); @@ -143,7 +143,7 @@ private void assertUnknownTxIsRejectedWithInvalidAmountReason(BtcTransaction btc // After arrowhead600Activations and grace period private void assertUnknownTxIsIgnored() throws IOException { verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); verify(provider, never()).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); assertTrue(activeFederationUtxos.isEmpty()); @@ -152,7 +152,7 @@ private void assertUnknownTxIsIgnored() throws IOException { private void assertPeginIsRejectedAndRefunded(ActivationConfig.ForBlock activations, BtcTransaction btcTransaction, Coin sentAmount, RejectedPeginReason expectedRejectedPeginReason) throws IOException { verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); assertTrue(activeFederationUtxos.isEmpty()); assertTrue(retiringFederationUtxos.isEmpty()); @@ -180,7 +180,7 @@ private void assertLegacyUndeterminedSenderPeginIsRejectedAsPeginV1InvalidPayloa verify(bridgeEventLogger, times(1)).logRejectedPegin( btcTransaction, PEGIN_V1_INVALID_PAYLOAD ); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin( + verify(bridgeEventLogger, times(1)).logNonRefundablePegin( btcTransaction, LEGACY_PEGIN_UNDETERMINED_SENDER ); @@ -207,7 +207,7 @@ private void assertLegacyUndeterminedSenderPeginIsRejected(BtcTransaction btcTra verify(bridgeEventLogger, times(1)).logRejectedPegin( btcTransaction, RejectedPeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER ); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin( + verify(bridgeEventLogger, times(1)).logNonRefundablePegin( btcTransaction, LEGACY_PEGIN_UNDETERMINED_SENDER ); @@ -229,7 +229,7 @@ private void assertInvalidPeginV1UndeterminedSenderIsRejected(BtcTransaction btc verify(bridgeEventLogger, times(1)).logRejectedPegin( btcTransaction, PEGIN_V1_INVALID_PAYLOAD ); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin( + verify(bridgeEventLogger, times(1)).logNonRefundablePegin( btcTransaction, LEGACY_PEGIN_UNDETERMINED_SENDER ); @@ -785,7 +785,7 @@ void pegin_legacy_to_active_fed( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(amountToSend), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -826,7 +826,7 @@ void pegin_multiple_outputs_to_active_fed( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(minimumPeginTxValue.multiply(10)), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -866,7 +866,7 @@ void pegin_to_active_fed_with_bech32_output( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(amountToSend), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -906,7 +906,7 @@ void pegin_to_active_fed_equal_to_minimum_with_other_random_outputs_below_minimu // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(minimumPeginTxValue), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1059,7 +1059,7 @@ void pegin_to_active_and_retiring_fed( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(minimumPeginTxValue.multiply(2)), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1133,7 +1133,7 @@ void pegin_to_active_and_retiring_fed_and_unknown_address( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(minimumPeginTxValue.multiply(2)), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1178,7 +1178,7 @@ void pegin_v1_to_retiring_fed_can_be_registered( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(amountToSend), eq(1)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1230,7 +1230,7 @@ void pegin_v1_two_rsk_op_return_cannot_be_registered( // assert verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, PEGIN_V1_INVALID_PAYLOAD); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1272,7 +1272,7 @@ void pegin_v1_invalid_protocol_legacy_sender_to_active_fed_( // assert verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, PEGIN_V1_INVALID_PAYLOAD); @@ -1315,7 +1315,7 @@ void pegin_v1_invalid_prefix_to_active_fed_can_be_registered( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(amountToSend), eq(0)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1366,7 +1366,7 @@ void pegin_v1_segwit_to_retiring_fed_can_be_registered( // assert verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logPeginBtc(any(), eq(btcTransaction), eq(amountToSend), eq(1)); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -1691,7 +1691,7 @@ void pegout_sighash_no_exists_in_provider() throws BlockStoreException, BridgeIl ); // assert - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, LEGACY_PEGIN_MULTISIG_SENDER); verify(bridgeEventLogger, times(1)).logReleaseBtcRequested(eq(rskTx.getHash().getBytes()), any(BtcTransaction.class), eq(amountToSend)); @@ -2017,7 +2017,7 @@ void migration_sighash_no_exists_in_provider() throws BlockStoreException, Bridg // assert verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, LEGACY_PEGIN_MULTISIG_SENDER); verify(bridgeEventLogger, times(1)).logReleaseBtcRequested(eq(rskTx.getHash().getBytes()), any(BtcTransaction.class), eq(amountToSend)); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); @@ -2654,7 +2654,7 @@ void old_fed_migration( ); // assert - verify(bridgeEventLogger, never()).logUnrefundablePegin(migrationTx, LEGACY_PEGIN_UNDETERMINED_SENDER); + verify(bridgeEventLogger, never()).logNonRefundablePegin(migrationTx, LEGACY_PEGIN_UNDETERMINED_SENDER); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); assertTrue(retiringFederationUtxos.isEmpty()); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(migrationTx.getHash(false), rskExecutionBlock.getNumber()); @@ -2778,7 +2778,7 @@ void no_last_retired_fed_in_storage_sending_funds_to_active_fed( // assert if (shouldUsePegoutTxIndex) { verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); verify(bridgeEventLogger, never()).logReleaseBtcRequested(any(), any(), any()); verify(provider, times(1)).setHeightBtcTxhashAlreadyProcessed(btcTransaction.getHash(false), rskExecutionBlock.getNumber()); diff --git a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRejectedPeginTest.java b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRejectedPeginTest.java index ada0dd07463..3f78930eeec 100644 --- a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRejectedPeginTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportRejectedPeginTest.java @@ -4,7 +4,7 @@ import static co.rsk.peg.BridgeSupportTestUtil.mockChainOfStoredBlocks; import static co.rsk.peg.pegin.RejectedPeginReason.INVALID_AMOUNT; import static co.rsk.peg.pegin.RejectedPeginReason.PEGIN_V1_INVALID_PAYLOAD; -import static co.rsk.peg.utils.UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER; +import static co.rsk.peg.utils.NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; @@ -44,7 +44,7 @@ import co.rsk.peg.pegin.RejectedPeginReason; import co.rsk.peg.pegininstructions.PeginInstructionsProvider; import co.rsk.peg.utils.BridgeEventLogger; -import co.rsk.peg.utils.UnrefundablePeginReason; +import co.rsk.peg.utils.NonRefundablePeginReason; import co.rsk.test.builders.BridgeSupportBuilder; import co.rsk.test.builders.FederationSupportBuilder; import java.io.IOException; @@ -75,7 +75,7 @@ class BridgeSupportRejectedPeginTest { private static final NetworkParameters btcMainnetParams = bridgeMainnetConstants.getBtcParams(); private static final ActivationConfig.ForBlock arrowHeadActivations = ActivationConfigsForTest.arrowhead600() .forBlock(0); - private static final ActivationConfig.ForBlock lovellActivations = ActivationConfigsForTest.lovell700() + private static final ActivationConfig.ForBlock allActivations = ActivationConfigsForTest.all() .forBlock(0); private static final Coin minimumPeginTxValue = bridgeMainnetConstants.getMinimumPeginTxValue( @@ -110,7 +110,7 @@ class BridgeSupportRejectedPeginTest { public static Stream activationsProvider() { return Stream.of( - Arguments.of(lovellActivations), + Arguments.of(allActivations), Arguments.of(arrowHeadActivations) ); } @@ -308,13 +308,13 @@ void registerBtcTransaction_whenBelowTheMinimum_shouldRejectPegin( // assert // tx should be marked as processed since RSKIP459 is active - var shouldMarkTxAsProcessed = activations == lovellActivations ? times(1) : never(); + var shouldMarkTxAsProcessed = activations == allActivations ? times(1) : never(); verify(provider, shouldMarkTxAsProcessed).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, INVALID_AMOUNT); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin(btcTransaction, - UnrefundablePeginReason.INVALID_AMOUNT); + verify(bridgeEventLogger, times(1)).logNonRefundablePegin(btcTransaction, + NonRefundablePeginReason.INVALID_AMOUNT); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); assertTrue(activeFederationUtxos.isEmpty()); assertTrue(retiringFederationUtxos.isEmpty()); @@ -371,7 +371,7 @@ void registerBtcTransaction_whenUndeterminedSender_shouldRejectPegin( verify(bridgeEventLogger, times(1)).logRejectedPegin( btcTransaction, RejectedPeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER ); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin( + verify(bridgeEventLogger, times(1)).logNonRefundablePegin( btcTransaction, LEGACY_PEGIN_UNDETERMINED_SENDER ); @@ -380,7 +380,7 @@ void registerBtcTransaction_whenUndeterminedSender_shouldRejectPegin( verify(bridgeEventLogger, never()).logReleaseBtcRequested(any(), any(), any()); // tx should be marked as processed since RSKIP459 is active - var shouldMarkTxAsProcessed = activations == lovellActivations ? times(1) : never(); + var shouldMarkTxAsProcessed = activations == allActivations ? times(1) : never(); verify(provider, shouldMarkTxAsProcessed).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); @@ -440,14 +440,14 @@ void registerBtcTransaction_whenPeginV1WithInvalidPayloadAndUnderminedSender_sho // assert // tx should be marked as processed since RSKIP459 is active - var shouldMarkTxAsProcessed = activations == lovellActivations ? times(1) : never(); + var shouldMarkTxAsProcessed = activations == allActivations ? times(1) : never(); verify(provider, shouldMarkTxAsProcessed).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); verify(bridgeEventLogger, times(1)).logRejectedPegin( btcTransaction, PEGIN_V1_INVALID_PAYLOAD ); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin( + verify(bridgeEventLogger, times(1)).logNonRefundablePegin( btcTransaction, LEGACY_PEGIN_UNDETERMINED_SENDER ); @@ -504,14 +504,14 @@ void registerBtcTransaction_whenUtxoToActiveFedBelowMinimumAndUtxoToRetiringFedA ); // assert - var shouldMarkTxAsProcessed = activations == lovellActivations ? times(1) : never(); + var shouldMarkTxAsProcessed = activations == allActivations ? times(1) : never(); verify(provider, shouldMarkTxAsProcessed).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, RejectedPeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); - verify(bridgeEventLogger, times(1)).logUnrefundablePegin(btcTransaction, - UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); + verify(bridgeEventLogger, times(1)).logNonRefundablePegin(btcTransaction, + NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); assertTrue(activeFederationUtxos.isEmpty()); assertTrue(retiringFederationUtxos.isEmpty()); @@ -582,7 +582,7 @@ void registerBtcTransaction_whenAttemptToRegisterFlyoverPegin_shouldIgnorePegin( private void assertUnknownTxIsIgnored() throws IOException { verify(bridgeEventLogger, never()).logRejectedPegin(any(), any()); - verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any()); + verify(bridgeEventLogger, never()).logNonRefundablePegin(any(), any()); verify(bridgeEventLogger, never()).logPeginBtc(any(), any(), any(), anyInt()); verify(provider, never()).setHeightBtcTxhashAlreadyProcessed(any(), anyLong()); assertTrue(activeFederationUtxos.isEmpty()); diff --git a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportSvpTest.java b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportSvpTest.java index 630d8a3ed90..e605aa5bec6 100644 --- a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportSvpTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportSvpTest.java @@ -31,7 +31,7 @@ import co.rsk.peg.storage.StorageAccessor; import co.rsk.peg.utils.BridgeEventLogger; import co.rsk.peg.utils.BridgeEventLoggerImpl; -import co.rsk.peg.utils.UnrefundablePeginReason; +import co.rsk.peg.utils.NonRefundablePeginReason; import co.rsk.test.builders.BridgeSupportBuilder; import co.rsk.test.builders.FederationSupportBuilder; import java.io.IOException; @@ -1457,7 +1457,7 @@ private void assertTxIsRejectedPeginAndMarkedAsProcessed(BtcTransaction rejected Function unrefundablePeginEvent = BridgeEvents.UNREFUNDABLE_PEGIN.getEvent(); List encodedTopics = getEncodedTopics(unrefundablePeginEvent, btcTxHashSerialized); - byte[] encodedData = getEncodedData(unrefundablePeginEvent, UnrefundablePeginReason.INVALID_AMOUNT.getValue()); + byte[] encodedData = getEncodedData(unrefundablePeginEvent, NonRefundablePeginReason.INVALID_AMOUNT.getValue()); assertEventWasEmittedWithExpectedTopics(encodedTopics); assertEventWasEmittedWithExpectedData(encodedData); diff --git a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportTest.java b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportTest.java index d3e91955bec..69e9b3c281f 100644 --- a/rskj-core/src/test/java/co/rsk/peg/BridgeSupportTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/BridgeSupportTest.java @@ -55,7 +55,7 @@ import co.rsk.peg.pegininstructions.*; import co.rsk.peg.storage.*; import co.rsk.peg.utils.*; -import co.rsk.peg.utils.UnrefundablePeginReason; +import co.rsk.peg.utils.NonRefundablePeginReason; import co.rsk.peg.vote.ABICallSpec; import co.rsk.peg.whitelist.*; import co.rsk.peg.whitelist.constants.WhitelistMainNetConstants; @@ -1151,7 +1151,8 @@ void eventLoggerLogPeginRejectionEvents_before_rskip_181_activation() throws Exc bridgeSupport.registerBtcTransaction(mock(Transaction.class), tx.bitcoinSerialize(), height, pmt.bitcoinSerialize()); verify(mockedEventLogger, never()).logRejectedPegin(any(BtcTransaction.class), any(RejectedPeginReason.class)); - verify(mockedEventLogger, never()).logUnrefundablePegin(any(BtcTransaction.class), any(UnrefundablePeginReason.class)); + verify(mockedEventLogger, never()).logNonRefundablePegin(any(BtcTransaction.class), any( + NonRefundablePeginReason.class)); } @Test @@ -1247,7 +1248,8 @@ void eventLoggerLogPeginRejectionEvents_after_rskip_181_activation() throws Exce ); verify(mockedEventLogger, atLeastOnce()).logRejectedPegin(any(BtcTransaction.class), any(RejectedPeginReason.class)); - verify(mockedEventLogger, atLeastOnce()).logUnrefundablePegin(any(BtcTransaction.class), any(UnrefundablePeginReason.class)); + verify(mockedEventLogger, atLeastOnce()).logNonRefundablePegin(any(BtcTransaction.class), any( + NonRefundablePeginReason.class)); } @Test diff --git a/rskj-core/src/test/java/co/rsk/peg/PegUtilsEvaluatePeginTest.java b/rskj-core/src/test/java/co/rsk/peg/PegUtilsEvaluatePeginTest.java index 2c68e61ab3b..8c3e31c5117 100644 --- a/rskj-core/src/test/java/co/rsk/peg/PegUtilsEvaluatePeginTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/PegUtilsEvaluatePeginTest.java @@ -50,11 +50,11 @@ private static Stream protocolVersionArgs() { private static Stream argumentsForWhenProtocolVersionLegacyIs0AndDifferentAddressTypes() { return Stream.of( - Arguments.of(BtcLockSender.TxSenderAddressType.P2PKH, PeginProcessAction.CAN_BE_REGISTERED, null), - Arguments.of(BtcLockSender.TxSenderAddressType.P2SHP2WPKH, PeginProcessAction.CAN_BE_REGISTERED, null), - Arguments.of(BtcLockSender.TxSenderAddressType.P2SHMULTISIG, PeginProcessAction.CAN_BE_REFUNDED, RejectedPeginReason.LEGACY_PEGIN_MULTISIG_SENDER), - Arguments.of(BtcLockSender.TxSenderAddressType.P2SHP2WSH, PeginProcessAction.CAN_BE_REFUNDED, RejectedPeginReason.LEGACY_PEGIN_MULTISIG_SENDER), - Arguments.of(BtcLockSender.TxSenderAddressType.UNKNOWN, PeginProcessAction.CANNOT_BE_REFUNDED, RejectedPeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER) + Arguments.of(BtcLockSender.TxSenderAddressType.P2PKH, PeginProcessAction.REGISTER, null), + Arguments.of(BtcLockSender.TxSenderAddressType.P2SHP2WPKH, PeginProcessAction.REGISTER, null), + Arguments.of(BtcLockSender.TxSenderAddressType.P2SHMULTISIG, PeginProcessAction.REFUND, RejectedPeginReason.LEGACY_PEGIN_MULTISIG_SENDER), + Arguments.of(BtcLockSender.TxSenderAddressType.P2SHP2WSH, PeginProcessAction.REFUND, RejectedPeginReason.LEGACY_PEGIN_MULTISIG_SENDER), + Arguments.of(BtcLockSender.TxSenderAddressType.UNKNOWN, PeginProcessAction.NO_REFUND, RejectedPeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER) ); } @@ -104,7 +104,7 @@ void evaluatePegin_valueBelowMinimum_returnsPeginEvaluationResultWithCannotBePro activations ); - assertEquals(PeginProcessAction.CANNOT_BE_REFUNDED, peginEvaluationResult.getPeginProcessAction()); + assertEquals(PeginProcessAction.NO_REFUND, peginEvaluationResult.getPeginProcessAction()); assertTrue(peginEvaluationResult.getRejectedPeginReason().isPresent()); assertEquals(RejectedPeginReason.INVALID_AMOUNT, peginEvaluationResult.getRejectedPeginReason().get()); } @@ -129,7 +129,7 @@ void evaluatePegin_btcRefundAddressNullAndDifferentProtocolVersions(int protocol activations ); - assertEquals(PeginProcessAction.CANNOT_BE_REFUNDED, peginEvaluationResult.getPeginProcessAction()); + assertEquals(PeginProcessAction.NO_REFUND, peginEvaluationResult.getPeginProcessAction()); assertTrue(peginEvaluationResult.getRejectedPeginReason().isPresent()); assertEquals(RejectedPeginReason.PEGIN_V1_INVALID_PAYLOAD, peginEvaluationResult.getRejectedPeginReason().get()); } @@ -156,7 +156,7 @@ void evaluatePegin_parseThrowsExceptionAndBtcRefundAddressIsPresent(int protocol activations ); - assertEquals(PeginProcessAction.CAN_BE_REFUNDED, peginEvaluationResult.getPeginProcessAction()); + assertEquals(PeginProcessAction.REFUND, peginEvaluationResult.getPeginProcessAction()); assertTrue(peginEvaluationResult.getRejectedPeginReason().isPresent()); assertEquals(RejectedPeginReason.PEGIN_V1_INVALID_PAYLOAD, peginEvaluationResult.getRejectedPeginReason().get()); } @@ -203,7 +203,7 @@ void evaluatePegin_validPeginInformationWithProtocolVersion1_peginProcessActionC activations ); - assertEquals(PeginProcessAction.CAN_BE_REGISTERED, peginEvaluationResult.getPeginProcessAction()); + assertEquals(PeginProcessAction.REGISTER, peginEvaluationResult.getPeginProcessAction()); } @Test() @@ -255,7 +255,7 @@ void evaluatePegin_pegout_peginProcessActionCanBeRegistered() { activations ); - assertEquals(PeginProcessAction.CAN_BE_REGISTERED, peginEvaluationResult.getPeginProcessAction()); + assertEquals(PeginProcessAction.REGISTER, peginEvaluationResult.getPeginProcessAction()); } @Test @@ -280,6 +280,6 @@ void evaluatePegin_migration_peginProcessActionCanBeRegistered() { activations ); - assertEquals(PeginProcessAction.CAN_BE_REGISTERED, peginEvaluationResult.getPeginProcessAction()); + assertEquals(PeginProcessAction.REGISTER, peginEvaluationResult.getPeginProcessAction()); } } diff --git a/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerImplTest.java b/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerImplTest.java index 635ece73774..f4a0ee250bc 100644 --- a/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerImplTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerImplTest.java @@ -398,9 +398,9 @@ void logRejectedPegin() { } @Test - void logUnrefundablePegin() { + void logNonRefundablePegin() { // Setup event logger - eventLogger.logUnrefundablePegin(BTC_TRANSACTION, UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); + eventLogger.logNonRefundablePegin(BTC_TRANSACTION, NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER); assertEquals(1, eventLogs.size()); LogInfo entry = eventLogs.get(0); @@ -423,7 +423,7 @@ void logUnrefundablePegin() { // Assert log data assertArrayEquals( - event.encodeEventData(UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER.getValue()), + event.encodeEventData(NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER.getValue()), result.getData() ); } diff --git a/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerTest.java b/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerTest.java index 598d233c48c..d4374366ae3 100644 --- a/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerTest.java +++ b/rskj-core/src/test/java/co/rsk/peg/utils/BridgeEventLoggerTest.java @@ -64,10 +64,10 @@ void logRejectedPegin() { } @Test - void logUnrefundablePegin() { - assertThrows(UnsupportedOperationException.class, () -> eventLogger.logUnrefundablePegin( + void logNonRefundablePegin() { + assertThrows(UnsupportedOperationException.class, () -> eventLogger.logNonRefundablePegin( btcTxMock, - UnrefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER + NonRefundablePeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER )); }