Skip to content

Commit

Permalink
Merge pull request #2148 from rsksmart/rename-getTransactionType-method
Browse files Browse the repository at this point in the history
Rename getTransactionType method
  • Loading branch information
marcos-iov authored Oct 13, 2023
2 parents 8808e7f + 762b49d commit 18ff58b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion rskj-core/src/main/java/co/rsk/peg/PegUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class PegUtils {
private PegUtils() { }

public static PegTxType getTransactionType(
public static PegTxType getTransactionTypeUsingPegoutIndex(
ActivationConfig.ForBlock activations,
BridgeStorageProvider provider,
Wallet liveFederationsWallet,
Expand Down
12 changes: 6 additions & 6 deletions rskj-core/src/main/java/co/rsk/peg/PegUtilsLegacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private PegUtilsLegacy() {}

/**
* Legacy version for identifying if a tx is a pegout
* Use instead {@link co.rsk.peg.PegUtils#getTransactionType}
* Use instead {@link co.rsk.peg.PegUtils#getTransactionTypeUsingPegoutIndex}
*
* @param tx
* @param federations
Expand All @@ -57,7 +57,7 @@ public static boolean isPegOutTx(BtcTransaction tx, List<Federation> federations

/**
* Legacy version for identifying if a tx is a pegout
* Use instead {@link co.rsk.peg.PegUtils#getTransactionType}
* Use instead {@link co.rsk.peg.PegUtils#getTransactionTypeUsingPegoutIndex}
*
* @param btcTx
* @param activations
Expand Down Expand Up @@ -119,7 +119,7 @@ protected static boolean scriptCorrectlySpendsTx(BtcTransaction tx, int index, S

/**
* Legacy version for identifying if a tx is a pegout
* Use instead {@link co.rsk.peg.PegUtils#getTransactionType}
* Use instead {@link co.rsk.peg.PegUtils#getTransactionTypeUsingPegoutIndex}
*
* @param btcTx
* @param oldFederationAddress
Expand All @@ -139,7 +139,7 @@ protected static boolean txIsFromOldFederation(BtcTransaction btcTx, Address old
}

/**
* Legacy version to identify if a btc tx is a pegin. Use instead {@link co.rsk.peg.PegUtils#getTransactionType}
* Legacy version to identify if a btc tx is a pegin. Use instead {@link co.rsk.peg.PegUtils#getTransactionTypeUsingPegoutIndex}
*
* @param tx the BTC transaction to check
* @param federation
Expand Down Expand Up @@ -167,7 +167,7 @@ public static boolean isValidPegInTx(
}

/**
* Legacy version to identify if a btc tx is a pegin. Use instead {@link co.rsk.peg.PegUtils#getTransactionType}
* Legacy version to identify if a btc tx is a pegin. Use instead {@link co.rsk.peg.PegUtils#getTransactionTypeUsingPegoutIndex}
*
* @param tx the BTC transaction to check
* @param activeFederations the active federations
Expand Down Expand Up @@ -285,7 +285,7 @@ protected static boolean isMigrationTx(

/**
* Legacy version for identifying transaction peg type
* Use instead {@link co.rsk.peg.PegUtils#getTransactionType}
* Use instead {@link co.rsk.peg.PegUtils#getTransactionTypeUsingPegoutIndex}
*
* @param btcTx
* @param activeFederation
Expand Down
40 changes: 20 additions & 20 deletions rskj-core/src/test/java/co/rsk/peg/PegUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void test_getTransactionType_before_tbd_600() {

// Act
IllegalStateException exception = Assertions.assertThrows(IllegalStateException.class, () -> {
PegUtils.getTransactionType(fingerrootActivations, provider, liveFederationWallet, btcTransaction);
PegUtils.getTransactionTypeUsingPegoutIndex(fingerrootActivations, provider, liveFederationWallet, btcTransaction);
});

// Assert
Expand All @@ -98,7 +98,7 @@ void test_getTransactionType_tx_sending_funds_to_unknown_address() {
btcTransaction.addOutput(Coin.COIN, userAddress);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -121,7 +121,7 @@ void test_getTransactionType_pegin_below_minimum_active_fed() {
btcTransaction.addOutput(minimumPeginTxValue.minus(Coin.SATOSHI), activeFederation.getAddress());

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -142,7 +142,7 @@ void test_getTransactionType_pegin_active_fed() {
btcTransaction.addOutput(Coin.COIN, activeFederation.getAddress());

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -166,7 +166,7 @@ void test_getTransactionType_pegin_output_to_active_fed_and_other_addresses() {
btcTransaction.addOutput(Coin.COIN, BitcoinTestUtils.createP2PKHAddress(btcMainnetParams, "unknown2"));

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -190,7 +190,7 @@ void test_getTransactionType_pegin_multiple_outputs_to_active_fed() {
}

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -227,7 +227,7 @@ void test_getTransactionType_pegin_output_to_retiring_fed_and_other_addresses()
btcTransaction.addOutput(Coin.COIN, BitcoinTestUtils.createP2PKHAddress(btcMainnetParams, "unknown2"));

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -248,7 +248,7 @@ void test_getTransactionType_pegin_retiring_fed() {
btcTransaction.addOutput(Coin.COIN, retiringFederation.getAddress());

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -272,7 +272,7 @@ void test_getTransactionType_pegin_multiple_outputs_to_retiring_fed() {
}

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -295,7 +295,7 @@ void test_getTransactionType_pegin_outputs_to_active_and_retiring_fed() {
btcTransaction.addOutput(Coin.COIN, retiringFederation.getAddress());

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -320,7 +320,7 @@ void test_getTransactionType_pegin_outputs_to_active_and_retiring_fed_and_other_
btcTransaction.addOutput(Coin.COIN, userAddress);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -355,7 +355,7 @@ void test_getTransactionType_pegout_no_change_output() {
when(provider.hasPegoutTxSigHash(firstInputSigHash)).thenReturn(true);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -381,7 +381,7 @@ void test_getTransactionType_pegout_no_change_output_sighash_no_exists_in_provid
btcTransaction.getInput(FIRST_INPUT_INDEX).setScriptSig(inputScript);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -417,7 +417,7 @@ void test_getTransactionType_standard_pegout() {
when(provider.hasPegoutTxSigHash(firstInputSigHash)).thenReturn(true);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand All @@ -444,7 +444,7 @@ void test_getTransactionType_standard_pegout_sighash_no_exists_in_provider() {
btcTransaction.getInput(FIRST_INPUT_INDEX).setScriptSig(inputScript);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -481,7 +481,7 @@ void test_getTransactionType_migration() {
when(provider.hasPegoutTxSigHash(firstInputSigHash)).thenReturn(true);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -510,7 +510,7 @@ void test_getTransactionType_migration_sighash_no_exists_in_provider() {
btcTransaction.getInput(FIRST_INPUT_INDEX).setScriptSig(inputScript);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -545,7 +545,7 @@ void test_getTransactionType_migration_from_retired_fed() {
when(provider.hasPegoutTxSigHash(firstInputSigHash)).thenReturn(true);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -589,7 +589,7 @@ void test_getTransactionType_flyover() {
);

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down Expand Up @@ -627,7 +627,7 @@ void test_getTransactionType_flyover_segwit() {
BtcTransaction btcTransaction = new BtcTransaction(btcTestNetParams, Hex.decode(segwitTxHex));

// Act
PegTxType pegTxType = PegUtils.getTransactionType(
PegTxType pegTxType = PegUtils.getTransactionTypeUsingPegoutIndex(
activations,
provider,
liveFederationWallet,
Expand Down

0 comments on commit 18ff58b

Please sign in to comment.