diff --git a/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java b/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java index 857b99a3cf..467a0c3718 100644 --- a/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java +++ b/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java @@ -149,6 +149,20 @@ void registerBtc_forARepeatedLegacyBtcTransaction_shouldNotPerformAnyChange() th assertEquals(expectedReceiverBalance, repository.getBalance(rskReceiver)); } + @Test + void whenRegisterALegacyBtcTransactionWithNegativeHeight_shouldNotPerformAnyChange() throws Exception { + // Arrange + co.rsk.core.Coin expectedReceiverBalance = repository.getBalance(rskReceiver); + List expectedFederationUTXOs = federationSupport.getActiveFederationBtcUTXOs(); + + // Act + bridgeSupport.registerBtcTransaction(rskTx, bitcoinTransaction.bitcoinSerialize(), -1, pmtWithTransactions.bitcoinSerialize()); + bridgeSupport.save(); + + // Assert + assertEquals(expectedFederationUTXOs, federationSupport.getActiveFederationBtcUTXOs()); + assertEquals(expectedReceiverBalance, repository.getBalance(rskReceiver)); + } private static UTXO utxoOf(BtcTransaction bitcoinTransaction, TransactionOutput output) { return new UTXO( bitcoinTransaction.getHash(),