Skip to content

Commit

Permalink
Remove 404State.
Browse files Browse the repository at this point in the history
Merge changes from master (excl. removal of devinBilek nodes)

Signed-off-by: HenrikJannsen <[email protected]>
  • Loading branch information
HenrikJannsen committed Jul 28, 2024
1 parent abd9133 commit 37d173c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
distribution: 'zulu'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.4.2
uses: gradle/gradle-build-action@v3.5.0
with:
arguments: build --scan
2 changes: 1 addition & 1 deletion .github/workflows/codacy-coverage-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
distribution: 'zulu'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.4.2
uses: gradle/gradle-build-action@v3.5.0
with:
arguments: build jacocoTestReport testCodeCoverageReport --scan

Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/bisq/core/dao/state/DaoStateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,7 @@ public Map<String, Set<String>> getTxIdSetByAddress() {
tx.getTxOutputs().stream()
.filter(this::isBsqTxOutputType)
.filter(txOutput -> txOutput.getAddress() != null)
.filter(txOutput -> !txOutput.getAddress().isEmpty())
.forEach(txOutput -> {
String address = txOutput.getAddress();
Set<String> txIdSet = cachedTxIdSetByAddress.getOrDefault(address, new HashSet<>());
Expand All @@ -1071,6 +1072,7 @@ public Map<String, Set<String>> getTxIdSetByAddress() {
getUnorderedTxOutputStream()
.filter(this::isBsqTxOutputType)
.filter(txOutput -> txOutput.getAddress() != null)
.filter(txOutput -> !txOutput.getAddress().isEmpty())
.forEach(txOutput -> {
String txId = txIdByConnectedTxOutputKey.get(txOutput.getKey());
if (txId != null) {
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/bisq/core/user/AutoConfirmSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
import java.util.concurrent.CopyOnWriteArrayList;

import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

@ToString
@Slf4j
@Getter
public final class AutoConfirmSettings implements PersistablePayload {
Expand All @@ -43,7 +45,7 @@ public interface Listener {
private long tradeLimit;
private List<String> serviceAddresses;
private String currencyCode;
private List<Listener> listeners = new CopyOnWriteArrayList<>();
private final List<Listener> listeners = new CopyOnWriteArrayList<>();

@SuppressWarnings("SameParameterValue")
static Optional<AutoConfirmSettings> getDefault(List<String> serviceAddresses, String currencyCode) {
Expand Down
10 changes: 9 additions & 1 deletion core/src/main/java/bisq/core/user/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,20 @@ private void setupPreferences() {
setUsePriceNotifications(true);
}

if (prefPayload.getAutoConfirmSettingsList().isEmpty()) {
// Remove retired XMR AutoConfirm address
var doApplyDefaults = prefPayload.getAutoConfirmSettingsList().stream()
.map(autoConfirmSettings -> autoConfirmSettings.getServiceAddresses().stream()
.anyMatch(address -> address.contains("monero3bec7m26vx6si6qo7q7imlaoz45ot5m2b5z2ppgoooo6jx2rqd")))
.findAny()
.orElse(true);
if (doApplyDefaults) {
prefPayload.getAutoConfirmSettingsList().clear();
List<String> defaultXmrTxProofServices = getDefaultXmrTxProofServices();
AutoConfirmSettings.getDefault(defaultXmrTxProofServices, "XMR")
.ifPresent(xmrAutoConfirmSettings -> {
getAutoConfirmSettingsList().add(xmrAutoConfirmSettings);
});
persistenceManager.forcePersistNow();
}

// We set the capability in CoreNetworkCapabilities if the program argument is set.
Expand Down
4 changes: 0 additions & 4 deletions inventory/src/main/resources/inv_btc_mainnet.seednodes
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Expected format: nodeaddress.onion:port (@owner)
# removed in 1.9.16
sn4o3kdfxz6pidvafxv5i5dv3jrk6twtptm7s7wchwwwb5xy37y4x5id.onion:8000 (@403State)
sn4o3s5peekvk333vkrguw3gmd6mfy6bawynejslcnva2ibdbdrxakyd.onion:8000 (@403State)
sn4o3zbnlnivbolvsgzapzmfzh6q27z5owrhqbxjlhmcsfrvbo2rd2ad.onion:8000 (@403State)
# from 1.9.15, to be removed in 1.9.18
devinv3rhon24gqf5v6ondoqgyrbzyqihzyouzv7ptltsewhfmox2zqd.onion:8000 (@devinbileck)
devinsn2teu33efff62bnvwbxmfgbfjlgqsu3ad4b4fudx3a725eqnyd.onion:8000 (@devinbileck)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
@Tag(name = "BLOCKS API")
public class ExplorerBlocksApi {
private final DaoStateService daoStateService;
private final RestApi restApi;

public ExplorerBlocksApi(@Context Application application) {
RestApi restApi = ((RestApiMain) application).getRestApi();
restApi = ((RestApiMain) application).getRestApi();
daoStateService = restApi.getDaoStateService();
}

Expand All @@ -51,6 +52,7 @@ public ExplorerBlocksApi(@Context Application application) {
@GET
@Path("get-bsq-block-by-height/{block-height}")
public JsonBlock getBsqBlockByHeight(@Parameter(description = "Block Height") @PathParam("block-height") int blockHeight) {
restApi.checkDaoReady();
List<Block> blocks = daoStateService.getBlocks();
Optional<JsonBlock> jsonBlock = checkNotNull(blocks.stream())
.filter(block -> block.getHeight() == blockHeight)
Expand All @@ -68,6 +70,7 @@ public JsonBlock getBsqBlockByHeight(@Parameter(description = "Block Height") @P
@GET
@Path("get-bsq-block-by-hash/{block-hash}")
public JsonBlock getBsqBlockByHash(@Parameter(description = "Block Hash") @PathParam("block-hash") String hash) {
restApi.checkDaoReady();
List<Block> blocks = daoStateService.getBlocks();
Optional<JsonBlock> jsonBlock = checkNotNull(blocks.stream())
.filter(block -> block.getHash().equalsIgnoreCase(hash))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ public class ExplorerDaoApi {
private final DaoFacade daoFacade;
private final ProposalService proposalService;
private final CycleService cycleService;
private final RestApi restApi;

public ExplorerDaoApi(@Context Application application) {
RestApi restApi = ((RestApiMain) application).getRestApi();
restApi = ((RestApiMain) application).getRestApi();
daoStateService = restApi.getDaoStateService();
proposalService = restApi.getProposalService();
cycleService = restApi.getCycleService();
Expand All @@ -54,6 +55,7 @@ public ExplorerDaoApi(@Context Application application) {
@GET
@Path("get-bsq-stats")
public BsqStatsDto getBsqStats() {
restApi.checkDaoReady();
long genesisSupply = daoFacade.getGenesisTotalSupply().getValue();
long issuedByCompensations = daoStateService.getIssuanceSetForType(IssuanceType.COMPENSATION).stream().mapToLong(Issuance::getAmount).sum();
long issuedByReimbursements = daoStateService.getIssuanceSetForType(IssuanceType.REIMBURSEMENT).stream().mapToLong(Issuance::getAmount).sum();
Expand All @@ -70,6 +72,7 @@ public BsqStatsDto getBsqStats() {
@GET
@Path("query-dao-cycles")
public List<JsonDaoCycle> queryDaoCycles() {
restApi.checkDaoReady();
Set<Integer> cyclesAdded = new HashSet<>();
List<JsonDaoCycle> result = new ArrayList<>();
// Creating our data structure is a bit expensive so we ensure to only create the CycleListItems once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public ExplorerTransactionsApi(@Context Application application) {
@Path("get-bsq-tx/{txid}")
public JsonTx getTx(@Parameter(description = "TxId")
@PathParam("txid") String txId) {
restApi.checkDaoReady();
Optional<JsonTx> jsonTx = daoStateService.getUnorderedTxStream()
.filter(t -> t.getId().equals(txId))
.map(tx -> BlockDataToJsonConverter.getJsonTx(daoStateService, tx))
Expand Down Expand Up @@ -101,6 +102,7 @@ public List<JsonTx> getBisqTxForAddr(@PathParam("addr") String address) {
public List<JsonTx> queryTxsPaginated(@PathParam("start") int start,
@PathParam("count") int count,
@PathParam("filters") String filters) {
restApi.checkDaoReady();
log.info("filters: {}", filters);
List<JsonTx> jsonTxs = daoStateService.getUnorderedTxStream()
.sorted(Comparator.comparing(BaseTx::getTime).reversed())
Expand Down

0 comments on commit 37d173c

Please sign in to comment.