-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into release/v1.9.18
- Loading branch information
Showing
254 changed files
with
23,944 additions
and
2,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,17 @@ jobs: | |
java: ['11'] | ||
name: Test Java ${{ matrix.Java }}, ${{ matrix.os }} | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: 'true' | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4.2.1 | ||
uses: actions/setup-java@v4.5.0 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'zulu' | ||
|
||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@v3.3.2 | ||
uses: gradle/gradle-build-action@v3.5.0 | ||
with: | ||
arguments: build --scan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "bitcoind"] | ||
path = bitcoind | ||
url = https://github.com/bisq-network/bitcoind.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Bitcoin node monitor | ||
|
||
This is a simple headless node with a http server which connects periodically to the Bisq-provided Bitcoin nodes and | ||
disconnect quickly afterwards. | ||
|
||
### Run Bitcoin node monitor | ||
|
||
Run the Gradle task: | ||
|
||
```sh | ||
./gradlew btcnodemonitor:run | ||
``` | ||
|
||
Or create a run scrip by: | ||
|
||
```sh | ||
./gradlew btcnodemonitor:startBisqApp | ||
``` | ||
|
||
And then run: | ||
|
||
```sh | ||
./bisq-btcnodemonitor | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
plugins { | ||
id 'bisq.application' | ||
id 'bisq.gradle.app_start_plugin.AppStartPlugin' | ||
} | ||
|
||
mainClassName = 'bisq.btcnodemonitor.BtcNodeMonitorMain' | ||
|
||
distTar.enabled = true | ||
|
||
dependencies { | ||
implementation enforcedPlatform(project(':platform')) | ||
implementation project(':proto') | ||
implementation project(':common') | ||
implementation project(':core') | ||
implementation project(':p2p') | ||
annotationProcessor libs.lombok | ||
compileOnly libs.javax.annotation | ||
compileOnly libs.lombok | ||
implementation libs.logback.classic | ||
implementation libs.logback.core | ||
implementation libs.google.guava | ||
implementation libs.apache.commons.lang3 | ||
implementation libs.jetbrains.annotations | ||
implementation libs.slf4j.api | ||
implementation(libs.netlayer.tor.external) { | ||
exclude(module: 'slf4j-api') | ||
} | ||
implementation(libs.bitcoinj) { | ||
exclude(module: 'bcprov-jdk15on') | ||
exclude(module: 'guava') | ||
exclude(module: 'jsr305') | ||
exclude(module: 'okhttp') | ||
exclude(module: 'okio') | ||
exclude(module: 'slf4j-api') | ||
} | ||
implementation libs.spark.core | ||
} |
65 changes: 65 additions & 0 deletions
65
btcnodemonitor/src/main/java/bisq/btcnodemonitor/BtcNodeMonitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This file is part of Bisq. | ||
* | ||
* Bisq is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Bisq is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package bisq.btcnodemonitor; | ||
|
||
|
||
import bisq.core.btc.nodes.BtcNodes; | ||
|
||
import bisq.common.config.Config; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
|
||
|
||
import bisq.btcnodemonitor.btc.PeerConncetionModel; | ||
import bisq.btcnodemonitor.btc.PeerGroupService; | ||
import bisq.btcnodemonitor.server.SimpleHttpServer; | ||
import bisq.btcnodemonitor.socksProxy.ProxySetup; | ||
|
||
@Slf4j | ||
public class BtcNodeMonitor { | ||
private final PeerGroupService peerGroupService; | ||
private final ProxySetup proxySetup; | ||
private final SimpleHttpServer simpleHttpServer; | ||
|
||
public BtcNodeMonitor(Config config) { | ||
PeerConncetionModel peerConncetionModel = new PeerConncetionModel(new BtcNodes().getProvidedBtcNodes(), this::onChange); | ||
simpleHttpServer = new SimpleHttpServer(config, peerConncetionModel); | ||
proxySetup = new ProxySetup(config); | ||
peerGroupService = new PeerGroupService(config, peerConncetionModel); | ||
} | ||
|
||
public void onChange() { | ||
simpleHttpServer.onChange(); | ||
} | ||
|
||
public CompletableFuture<Void> start() { | ||
return simpleHttpServer.start() | ||
.thenCompose(nil -> proxySetup.createSocksProxy()) | ||
.thenAccept(peerGroupService::applySocks5Proxy) | ||
.thenCompose(nil -> peerGroupService.start()); | ||
} | ||
|
||
public CompletableFuture<Void> shutdown() { | ||
return peerGroupService.shutdown() | ||
.thenCompose(nil -> proxySetup.shutdown()) | ||
.thenCompose(nil -> simpleHttpServer.shutdown()); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
btcnodemonitor/src/main/java/bisq/btcnodemonitor/BtcNodeMonitorMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* This file is part of Bisq. | ||
* | ||
* Bisq is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Bisq is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package bisq.btcnodemonitor; | ||
|
||
|
||
import bisq.common.UserThread; | ||
import bisq.common.config.Config; | ||
import bisq.common.handlers.ResultHandler; | ||
import bisq.common.setup.CommonSetup; | ||
import bisq.common.setup.GracefulShutDownHandler; | ||
import bisq.common.util.SingleThreadExecutorUtils; | ||
import bisq.common.util.Utilities; | ||
|
||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class BtcNodeMonitorMain implements GracefulShutDownHandler { | ||
public static void main(String[] args) { | ||
new BtcNodeMonitorMain(args); | ||
} | ||
|
||
private final Config config; | ||
@Getter | ||
private final BtcNodeMonitor btcNodeMonitor; | ||
|
||
public BtcNodeMonitorMain(String[] args) { | ||
config = new Config("bisq_btc_node_monitor", Utilities.getUserDataDir(), args); | ||
CommonSetup.setup(config, this); | ||
configUserThread(); | ||
|
||
btcNodeMonitor = new BtcNodeMonitor(config); | ||
btcNodeMonitor.start().join(); | ||
keepRunning(); | ||
} | ||
|
||
@Override | ||
public void gracefulShutDown(ResultHandler resultHandler) { | ||
log.info("gracefulShutDown"); | ||
btcNodeMonitor.shutdown().join(); | ||
System.exit(0); | ||
resultHandler.handleResult(); | ||
} | ||
|
||
private void keepRunning() { | ||
try { | ||
Thread.currentThread().setName("BtcNodeMonitorMain"); | ||
Thread.currentThread().join(); | ||
} catch (InterruptedException e) { | ||
log.error("BtcNodeMonitorMain Thread interrupted", e); | ||
gracefulShutDown(() -> { | ||
}); | ||
} | ||
} | ||
|
||
private void configUserThread() { | ||
UserThread.setExecutor(SingleThreadExecutorUtils.getSingleThreadExecutor("UserThread")); | ||
} | ||
} |
Oops, something went wrong.