Skip to content

Commit

Permalink
Remove unthrown exceptions from method signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-iov committed Aug 20, 2024
1 parent c04b77f commit 8a81822
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions rskj-core/src/main/java/co/rsk/peg/BridgeStorageProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@ public Optional<FlyoverFederationInformation> getFlyoverFederationInformation(by
return Optional.empty();
}

FlyoverFederationInformation flyoverFederationInformation = this.safeGetFromRepository(
FlyoverFederationInformation flyoverFederationInformationInStorage = this.safeGetFromRepository(
getStorageKeyForFlyoverFederationInformation(flyoverFederationRedeemScriptHash),
data -> BridgeSerializationUtils.deserializeFlyoverFederationInformation(data, flyoverFederationRedeemScriptHash)
);
if (flyoverFederationInformation == null) {
if (flyoverFederationInformationInStorage == null) {
return Optional.empty();
}

return Optional.of(flyoverFederationInformation);
return Optional.of(flyoverFederationInformationInStorage);
}

public void setFlyoverFederationInformation(FlyoverFederationInformation flyoverFederationInformation) {
Expand Down Expand Up @@ -520,7 +520,7 @@ protected void savePegoutTxSigHashes() {
));
}

public void save() throws IOException {
public void save() {
saveBtcTxHashesAlreadyProcessed();

saveReleaseRequestQueue();
Expand Down
14 changes: 7 additions & 7 deletions rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,14 @@ public Wallet getActiveFederationWallet(boolean shouldConsiderFlyoverUTXOs) thro
* or null if there's currently no retiring federation
* @return A BTC wallet for the currently active federation
*
* @throws IOException
* @param shouldConsiderFlyoverUTXOs
*/
protected Wallet getRetiringFederationWallet(boolean shouldConsiderFlyoverUTXOs) throws IOException {
protected Wallet getRetiringFederationWallet(boolean shouldConsiderFlyoverUTXOs) {
List<UTXO> retiringFederationBtcUTXOs = federationSupport.getRetiringFederationBtcUTXOs();
return getRetiringFederationWallet(shouldConsiderFlyoverUTXOs, retiringFederationBtcUTXOs.size());
}

private Wallet getRetiringFederationWallet(boolean shouldConsiderFlyoverUTXOs, int utxosSizeLimit) throws IOException {
private Wallet getRetiringFederationWallet(boolean shouldConsiderFlyoverUTXOs, int utxosSizeLimit) {
Federation federation = getRetiringFederation();
if (federation == null) {
logger.debug("[getRetiringFederationWallet] No retiring federation found");
Expand Down Expand Up @@ -978,9 +977,10 @@ private void processFundsMigration(Transaction rskTx) throws IOException {
long federationAge = rskExecutionBlock.getNumber() - activeFederation.getCreationBlockNumber();
logger.trace("[processFundsMigration] Active federation (age={}) is in migration age.", federationAge);
if (hasMinimumFundsToMigrate(retiringFederationWallet)){
Coin retiringFederationBalance = retiringFederationWallet.getBalance();
logger.info(
"[processFundsMigration] Retiring federation has funds to migrate: {}.",
retiringFederationWallet.getBalance().toFriendlyString()
retiringFederationBalance.toFriendlyString()
);

migrateFunds(
Expand Down Expand Up @@ -2031,7 +2031,7 @@ private List<Federation> getLiveFederations() {
return liveFederations;
}

public Integer voteFederationChange(Transaction tx, ABICallSpec callSpec) throws BridgeIllegalArgumentException {
public Integer voteFederationChange(Transaction tx, ABICallSpec callSpec) {
return federationSupport.voteFederationChange(tx, callSpec, signatureCache, eventLogger);
}

Expand Down Expand Up @@ -2533,7 +2533,7 @@ protected void saveFlyoverActiveFederationDataInStorage(
Keccak256 derivationHash,
FlyoverFederationInformation flyoverFederationInformation,
List<UTXO> utxosList
) throws IOException {
) {
provider.markFlyoverDerivationHashAsUsed(btcTxHash, derivationHash);
provider.setFlyoverFederationInformation(flyoverFederationInformation);
federationSupport.getActiveFederationBtcUTXOs().addAll(utxosList);
Expand All @@ -2544,7 +2544,7 @@ protected void saveFlyoverRetiringFederationDataInStorage(
Keccak256 derivationHash,
FlyoverFederationInformation flyoverRetiringFederationInformation,
List<UTXO> utxosList
) throws IOException {
) {
provider.markFlyoverDerivationHashAsUsed(btcTxHash, derivationHash);
provider.setFlyoverRetiringFederationInformation(flyoverRetiringFederationInformation);
federationSupport.getRetiringFederationBtcUTXOs().addAll(utxosList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ public interface FederationSupport {
byte[] getPendingFederatorBtcPublicKey(int index);
byte[] getPendingFederatorPublicKeyOfType(int index, FederationMember.KeyType keyType);

int voteFederationChange(Transaction tx, ABICallSpec callSpec, SignatureCache signatureCache, BridgeEventLogger eventLogger);
int voteFederationChange(
Transaction tx,
ABICallSpec callSpec,
SignatureCache signatureCache,
BridgeEventLogger eventLogger
);
long getActiveFederationCreationBlockHeight();
Optional<Script> getLastRetiredFederationP2SHScript();

Expand Down

0 comments on commit 8a81822

Please # to comment.