Skip to content

Commit

Permalink
Refresh current fee receiver list whenever a fee tx is validated.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacxx authored and ripcurlx committed May 2, 2022
1 parent 4d17f97 commit b40e424
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public class MempoolService {
private final FilterManager filterManager;
private final DaoFacade daoFacade;
private final DaoStateService daoStateService;
private final List<String> btcFeeReceivers = new ArrayList<>();
@Getter
private int outstandingRequests = 0;

Expand All @@ -79,7 +78,6 @@ public MempoolService(Socks5ProxyProvider socks5ProxyProvider,
}

public void onAllServicesInitialized() {
btcFeeReceivers.addAll(getAllBtcFeeReceivers());
}

public boolean canRequestBeMade() {
Expand Down Expand Up @@ -158,7 +156,7 @@ private FutureCallback<String> callbackForMakerTxValidation(MempoolRequest theRe
public void onSuccess(@Nullable String jsonTxt) {
UserThread.execute(() -> {
outstandingRequests--;
resultHandler.accept(txValidator.parseJsonValidateMakerFeeTx(jsonTxt, btcFeeReceivers));
resultHandler.accept(txValidator.parseJsonValidateMakerFeeTx(jsonTxt, getAllBtcFeeReceivers()));
});
}

Expand Down Expand Up @@ -188,7 +186,7 @@ private FutureCallback<String> callbackForTakerTxValidation(MempoolRequest theRe
public void onSuccess(@Nullable String jsonTxt) {
UserThread.execute(() -> {
outstandingRequests--;
resultHandler.accept(txValidator.parseJsonValidateTakerFeeTx(jsonTxt, btcFeeReceivers));
resultHandler.accept(txValidator.parseJsonValidateTakerFeeTx(jsonTxt, getAllBtcFeeReceivers()));
});
}

Expand Down Expand Up @@ -252,7 +250,7 @@ private List<String> getAllBtcFeeReceivers() {
}
});
btcFeeReceivers.addAll(daoFacade.getAllDonationAddresses());
log.info("Known BTC fee receivers: {}", btcFeeReceivers.toString());
log.debug("Known BTC fee receivers: {}", btcFeeReceivers.toString());

return btcFeeReceivers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ private boolean checkFeeAddressBTC(String jsonTxt, List<String> btcFeeReceivers)
String error = "fee address: " + jsonFeeAddress.getAsString() + " was not a known BTC fee receiver";
errorList.add(error);
log.info(error);
log.info("Known BTC fee receivers: {}", btcFeeReceivers.toString());
}
} catch (JsonSyntaxException e) {
errorList.add(e.toString());
Expand Down

0 comments on commit b40e424

Please sign in to comment.