Bump the gradle-minor-and-patch group across 1 directory with 65 updates (#841)

This commit is contained in:
dependabot[bot]
2026-05-18 17:52:41 +03:00
committed by GitHub
parent ca08c8f474
commit 52beea3141
22 changed files with 221 additions and 184 deletions

View File

@@ -10,7 +10,7 @@ buildscript {
gradlePluginPortal() gradlePluginPortal()
} }
dependencies { dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.1' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.10.0'
} }
} }

View File

@@ -1,6 +1,6 @@
kotlin.code.style=official kotlin.code.style=official
grpcVersion=1.49.2 grpcVersion=1.49.2
reactiveGrpcVersion=1.2.0 reactiveGrpcVersion=1.2.4

View File

@@ -1,33 +1,33 @@
[versions] [versions]
groovy = "5.0.3" groovy = "5.0.6"
protoc = "4.33.2" protoc = "4.34.1"
jackson = "2.20.1" jackson = "2.21.3"
grpc = "1.78.0" grpc = "1.81.0"
spring-boot = "4.0.1" spring-boot = "4.0.6"
reactor = "3.8.1" reactor = "3.8.5"
netty = "4.2.9.Final" netty = "4.2.13.Final"
netty-tcnative = "2.0.74.Final" netty-tcnative = "2.0.77.Final"
kotlin = "2.3.0" kotlin = "2.3.21"
httpcomponents = "5.5.1" httpcomponents = "5.6.1"
[libraries] [libraries]
apache-commons-lang3 = "org.apache.commons:commons-lang3:3.9" apache-commons-lang3 = "org.apache.commons:commons-lang3:3.20.0"
apache-commons-collections4 = "org.apache.commons:commons-collections4:4.3" apache-commons-collections4 = "org.apache.commons:commons-collections4:4.5.0"
apache-commons-math3 = "org.apache.commons:commons-math3:3.6.1" apache-commons-math3 = "org.apache.commons:commons-math3:3.6.1"
commons-codec = "commons-codec:commons-codec:1.20.0" commons-codec = "commons-codec:commons-codec:1.22.0"
bitcoinj = "org.bitcoinj:bitcoinj-core:0.15.8" bitcoinj = "org.bitcoinj:bitcoinj-core:0.17.1"
logstash-encoder = "net.logstash.logback:logstash-logback-encoder:9.0" logstash-encoder = "net.logstash.logback:logstash-logback-encoder:9.0"
janino = "org.codehaus.janino:janino:3.1.9" janino = "org.codehaus.janino:janino:3.1.12"
bouncycastle-prov = "org.bouncycastle:bcprov-jdk15on:1.61" bouncycastle-prov = "org.bouncycastle:bcprov-jdk15on:1.70"
bouncycastle-pkix = 'org.bouncycastle:bcpkix-jdk15on:1.61' bouncycastle-pkix = 'org.bouncycastle:bcpkix-jdk15on:1.70'
caffeine = "com.github.ben-manes.caffeine:caffeine:2.8.5" caffeine = "com.github.ben-manes.caffeine:caffeine:2.8.5"
commons-io = "commons-io:commons-io:2.6" commons-io = "commons-io:commons-io:2.22.0"
cglib-nodep = "cglib:cglib-nodep:3.3.0" cglib-nodep = "cglib:cglib-nodep:3.3.0"
@@ -52,7 +52,7 @@ jackson-datatype-jsr310 = { module = "com.fasterxml.jackson.datatype:jackson-dat
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" } jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
jackson-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" } jackson-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" }
java-websocket = "org.java-websocket:Java-WebSocket:1.5.1" java-websocket = "org.java-websocket:Java-WebSocket:1.6.0"
javax-annotations = "javax.annotation:javax.annotation-api:1.3.2" javax-annotations = "javax.annotation:javax.annotation-api:1.3.2"
@@ -61,13 +61,13 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref =
lettuce-core = "io.lettuce:lettuce-core:7.5.2.RELEASE" lettuce-core = "io.lettuce:lettuce-core:7.5.2.RELEASE"
prom-exporter-server = "io.prometheus:prometheus-metrics-exporter-httpserver:1.5.0" prom-exporter-server = "io.prometheus:prometheus-metrics-exporter-httpserver:1.6.1"
micrometer-registry-prometheus = "io.micrometer:micrometer-registry-prometheus:1.16.0" micrometer-registry-prometheus = "io.micrometer:micrometer-registry-prometheus:1.16.5"
micrometer-ctx-prop = "io.micrometer:context-propagation:1.2.0" micrometer-ctx-prop = "io.micrometer:context-propagation:1.2.1"
mockserver-netty = "org.mock-server:mockserver-netty:5.15.0" mockserver-netty = "org.mock-server:mockserver-netty:5.15.0"
mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:6.1.0" mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:6.3.0"
netty-common = { module = "io.netty:netty-common", version.ref = "netty" } netty-common = { module = "io.netty:netty-common", version.ref = "netty" }
netty-transport = { module = "io.netty:netty-transport", version.ref = "netty" } netty-transport = { module = "io.netty:netty-transport", version.ref = "netty" }
@@ -83,18 +83,18 @@ netty-tcnative-core = { module = "io.netty:netty-tcnative", version.ref = "netty
netty-tcnative-boringssl = { module = "io.netty:netty-tcnative-boringssl-static", version.ref = "netty-tcnative"} netty-tcnative-boringssl = { module = "io.netty:netty-tcnative-boringssl-static", version.ref = "netty-tcnative"}
netty-macos = { module = "io.netty:netty-resolver-dns-native-macos", version.ref = "netty" } netty-macos = { module = "io.netty:netty-resolver-dns-native-macos", version.ref = "netty" }
zeromq = "org.zeromq:jeromq:0.5.2" zeromq = "org.zeromq:jeromq:0.6.0"
objgenesis = "org.objenesis:objenesis:3.1" objgenesis = "org.objenesis:objenesis:3.5"
reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "reactor" } reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "reactor" }
reactor-micrometer = { module = "io.projectreactor:reactor-core-micrometer", version.ref = "reactor" } reactor-micrometer = { module = "io.projectreactor:reactor-core-micrometer", version.ref = "reactor" }
reactor-netty = { module = "io.projectreactor.netty:reactor-netty", version = "1.3.1" } reactor-netty = { module = "io.projectreactor.netty:reactor-netty", version = "1.3.5" }
reactor-extra = { module = "io.projectreactor.addons:reactor-extra", version = "3.6.0" } reactor-extra = { module = "io.projectreactor.addons:reactor-extra", version = "3.6.0" }
reactor-kotlin = { module = "io.projectreactor.kotlin:reactor-kotlin-extensions", version = "1.1.7" } reactor-kotlin = { module = "io.projectreactor.kotlin:reactor-kotlin-extensions", version = "1.3.0" }
reactor-test = { module = "io.projectreactor:reactor-test", version.ref = "reactor" } reactor-test = { module = "io.projectreactor:reactor-test", version.ref = "reactor" }
reactor-grpc-stub = "com.salesforce.servicelibs:reactor-grpc-stub:1.2.0" reactor-grpc-stub = "com.salesforce.servicelibs:reactor-grpc-stub:1.2.4"
snake-yaml = "org.yaml:snakeyaml:2.6" snake-yaml = "org.yaml:snakeyaml:2.6"
@@ -105,15 +105,15 @@ spring-boot-starter-actuator = { module = "org.springframework.boot:spring-boot-
spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "spring-boot" } spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "spring-boot" }
testcontainers = "org.testcontainers:testcontainers:2.0.3" testcontainers = "org.testcontainers:testcontainers:2.0.5"
testcontainers-ganache = "io.github.ganchix:testcontainers-java-module-ganache:0.0.4" testcontainers-ganache = "io.github.ganchix:testcontainers-java-module-ganache:0.0.4"
assertj = "org.assertj:assertj-core:3.23.1" assertj = "org.assertj:assertj-core:3.27.7"
brave-instrumentation-grpc = "io.zipkin.brave:brave-instrumentation-grpc:6.3.0" brave-instrumentation-grpc = "io.zipkin.brave:brave-instrumentation-grpc:6.3.1"
brave-ctx-slf4j = "io.zipkin.brave:brave-context-slf4j:6.3.0" brave-ctx-slf4j = "io.zipkin.brave:brave-context-slf4j:6.3.1"
auth0-jwt = "com.auth0:java-jwt:4.4.0" auth0-jwt = "com.auth0:java-jwt:4.5.2"
mockito-inline = "org.mockito:mockito-inline:5.2.0" mockito-inline = "org.mockito:mockito-inline:5.2.0"
@@ -135,8 +135,8 @@ bouncycastle = ["bouncycastle-pkix", "bouncycastle-prov"]
[plugins] [plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
jib = { id = "com.google.cloud.tools.jib", version = "3.5.2" } jib = { id = "com.google.cloud.tools.jib", version = "3.5.3" }
spring = { id = "org.springframework.boot", version = "4.0.1" } spring = { id = "org.springframework.boot", version = "4.0.6" }
git = { id = "com.palantir.git-version", version = "5.0.0" } git = { id = "com.palantir.git-version", version = "5.0.0" }
protobuf = { id = "com.google.protobuf", version = "0.9.6" } protobuf = { id = "com.google.protobuf", version = "0.10.0" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.6.0" } ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.6.0" }

Binary file not shown.

View File

@@ -1,5 +1,8 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

50
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,11 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -133,22 +132,29 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -165,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -193,18 +198,27 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# shell script including quotes and variable substitutions, so put them in DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded. # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

59
gradlew.bat vendored
View File

@@ -13,19 +13,22 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables, and ensure extensions are enabled
if "%OS%"=="Windows_NT" setlocal setlocal EnableExtensions
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@@ -40,15 +43,15 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail "%COMSPEC%" /c exit 1
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
@@ -56,34 +59,24 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail "%COMSPEC%" /c exit 1
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* @rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
:end :exitWithErrorLevel
@rem End local scope for the variables with windows NT shell @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
if "%ERRORLEVEL%"=="0" goto mainEnd "%COMSPEC%" /c exit %ERRORLEVEL%
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -15,7 +15,7 @@
*/ */
package io.emeraldpay.dshackle.upstream.bitcoin package io.emeraldpay.dshackle.upstream.bitcoin
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono

View File

@@ -25,7 +25,7 @@ import io.emeraldpay.dshackle.upstream.Lifecycle
import io.emeraldpay.dshackle.upstream.Selector import io.emeraldpay.dshackle.upstream.Selector
import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import reactor.kotlin.core.publisher.cast import reactor.kotlin.core.publisher.cast

View File

@@ -22,7 +22,7 @@ import io.netty.handler.codec.http.HttpHeaderNames
import io.netty.handler.codec.http.HttpHeaders import io.netty.handler.codec.http.HttpHeaders
import io.netty.handler.ssl.SslContextBuilder import io.netty.handler.ssl.SslContextBuilder
import io.netty.resolver.DefaultAddressResolverGroup import io.netty.resolver.DefaultAddressResolverGroup
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import reactor.netty.http.client.HttpClient import reactor.netty.http.client.HttpClient

View File

@@ -18,7 +18,7 @@ package io.emeraldpay.dshackle.upstream.bitcoin
import io.emeraldpay.dshackle.upstream.Head import io.emeraldpay.dshackle.upstream.Head
import io.emeraldpay.dshackle.upstream.bitcoin.data.EsploraUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.EsploraUnspent
import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import java.util.function.Function import java.util.function.Function

View File

@@ -26,7 +26,8 @@ import io.emeraldpay.dshackle.upstream.calls.CallMethods
import io.emeraldpay.dshackle.upstream.ethereum.rpc.RpcException import io.emeraldpay.dshackle.upstream.ethereum.rpc.RpcException
import io.emeraldpay.dshackle.upstream.ethereum.rpc.RpcResponseError import io.emeraldpay.dshackle.upstream.ethereum.rpc.RpcResponseError
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.bitcoinj.base.AddressParser
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
@@ -70,7 +71,7 @@ class LocalCallRouter(
} }
val addresses = key.params.list[2] val addresses = key.params.list[2]
if (addresses is List<*> && addresses.size > 0) { if (addresses is List<*> && addresses.size > 0) {
val address = addresses[0].toString().let { Address.fromString(null, it) } val address = addresses[0].toString().let { AddressParser.getDefault().parseAddress(it) }
return reader.listUnspent(address).map { return reader.listUnspent(address).map {
val rpc = it.map(convertUnspent(address)) val rpc = it.map(convertUnspent(address))
val json = Global.objectMapper.writeValueAsBytes(rpc) val json = Global.objectMapper.writeValueAsBytes(rpc)

View File

@@ -3,7 +3,7 @@ package io.emeraldpay.dshackle.upstream.bitcoin
import io.emeraldpay.dshackle.upstream.Capability import io.emeraldpay.dshackle.upstream.Capability
import io.emeraldpay.dshackle.upstream.Selector import io.emeraldpay.dshackle.upstream.Selector
import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
class RemoteUnspentReader( class RemoteUnspentReader(

View File

@@ -24,7 +24,7 @@ import io.emeraldpay.dshackle.upstream.Selector
import io.emeraldpay.dshackle.upstream.bitcoin.data.RpcUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.RpcUnspent
import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono

View File

@@ -17,6 +17,6 @@ package io.emeraldpay.dshackle.upstream.bitcoin
import io.emeraldpay.dshackle.reader.Reader import io.emeraldpay.dshackle.reader.Reader
import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
interface UnspentReader : Reader<Address, List<SimpleUnspent>> interface UnspentReader : Reader<Address, List<SimpleUnspent>>

View File

@@ -15,15 +15,16 @@
*/ */
package io.emeraldpay.dshackle.upstream.bitcoin package io.emeraldpay.dshackle.upstream.bitcoin
import org.bitcoinj.core.Address import org.bitcoinj.base.Address
import org.bitcoinj.core.ECKey import org.bitcoinj.base.BitcoinNetwork
import org.bitcoinj.base.LegacyAddress
import org.bitcoinj.base.ScriptType
import org.bitcoinj.base.SegwitAddress
import org.bitcoinj.core.NetworkParameters import org.bitcoinj.core.NetworkParameters
import org.bitcoinj.crypto.ChildNumber import org.bitcoinj.crypto.ChildNumber
import org.bitcoinj.crypto.DeterministicKey import org.bitcoinj.crypto.DeterministicKey
import org.bitcoinj.crypto.ECKey
import org.bitcoinj.crypto.HDKeyDerivation import org.bitcoinj.crypto.HDKeyDerivation
import org.bitcoinj.params.MainNetParams
import org.bitcoinj.params.TestNet3Params
import org.bitcoinj.script.Script
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Flux import reactor.core.publisher.Flux
import reactor.util.function.Tuples import reactor.util.function.Tuples
@@ -35,8 +36,6 @@ open class XpubAddresses(
companion object { companion object {
private val log = LoggerFactory.getLogger(XpubAddresses::class.java) private val log = LoggerFactory.getLogger(XpubAddresses::class.java)
private val MAINNET = MainNetParams()
private val TESTNET = TestNet3Params()
private val INACTIVE_LIMIT = 20 private val INACTIVE_LIMIT = 20
} }
@@ -45,39 +44,45 @@ open class XpubAddresses(
// https://electrum.readthedocs.io/en/latest/xpub_version_bytes.html // https://electrum.readthedocs.io/en/latest/xpub_version_bytes.html
// TODO doesn't support SH keys right now. should? // TODO doesn't support SH keys right now. should?
val prefix = xpub.substring(0, 4) val prefix = xpub.substring(0, 4)
val type: Script.ScriptType val type: ScriptType
val network: NetworkParameters val params: NetworkParameters
when (prefix) { when (prefix) {
"xpub" -> { "xpub" -> {
type = Script.ScriptType.P2PKH type = ScriptType.P2PKH
network = MAINNET params = NetworkParameters.of(BitcoinNetwork.MAINNET)
} }
"zpub" -> { "zpub" -> {
type = Script.ScriptType.P2WPKH type = ScriptType.P2WPKH
network = MAINNET params = NetworkParameters.of(BitcoinNetwork.MAINNET)
} }
"tpub" -> { "tpub" -> {
type = Script.ScriptType.P2PKH type = ScriptType.P2PKH
network = TESTNET params = NetworkParameters.of(BitcoinNetwork.TESTNET)
} }
"vpub" -> { "vpub" -> {
type = Script.ScriptType.P2WPKH type = ScriptType.P2WPKH
network = TESTNET params = NetworkParameters.of(BitcoinNetwork.TESTNET)
} }
else -> return Flux.error(IllegalArgumentException("Unsupported type: $prefix")) else -> return Flux.error(IllegalArgumentException("Unsupported type: $prefix"))
} }
val key: DeterministicKey val key: DeterministicKey
try { try {
key = DeterministicKey.deserializeB58(xpub, network) key = DeterministicKey.deserializeB58(xpub, params)
} catch (t: Throwable) { } catch (t: Throwable) {
return Flux.error(t) return Flux.error(t)
} }
return Flux.range(start, limit) return Flux.range(start, limit)
.map { HDKeyDerivation.deriveChildKey(key, ChildNumber(it, false)) } .map { HDKeyDerivation.deriveChildKey(key, ChildNumber(it, false)) }
.map { Address.fromKey(network, ECKey.fromPublicOnly(it.pubKeyPoint), type) } .map { addressFromKey(params, ECKey.fromPublicOnly(it.pubKey), type) }
}
private fun addressFromKey(params: NetworkParameters, key: ECKey, type: ScriptType): Address = when (type) {
ScriptType.P2PKH -> LegacyAddress.fromKey(params, key)
ScriptType.P2WPKH -> SegwitAddress.fromKey(params, key)
else -> throw IllegalArgumentException("Unsupported script type: $type")
} }
open fun activeAddresses(xpub: String, start: Int, limit: Int): Flux<Address> { open fun activeAddresses(xpub: String, start: Int, limit: Int): Flux<Address> {

View File

@@ -34,7 +34,7 @@ import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import reactor.kotlin.extra.retry.retryRandomBackoff import reactor.util.retry.Retry
import java.math.BigInteger import java.math.BigInteger
import java.time.Duration import java.time.Duration
import java.util.concurrent.TimeoutException import java.util.concurrent.TimeoutException
@@ -75,12 +75,17 @@ abstract class AbstractCallLimitValidator(
Mono.fromCallable { log.error("No response for eth_call limit check from ${upstream.getId()}") } Mono.fromCallable { log.error("No response for eth_call limit check from ${upstream.getId()}") }
.then(Mono.error(TimeoutException("Validation timeout for call limit"))), .then(Mono.error(TimeoutException("Validation timeout for call limit"))),
) )
.retryRandomBackoff(3, Duration.ofMillis(100), Duration.ofMillis(500)) { ctx -> .retryWhen(
log.warn( Retry.backoff(3, Duration.ofMillis(100))
"error during validateCallLimit for ${upstream.getId()}, iteration ${ctx.iteration()}, " + .maxBackoff(Duration.ofMillis(500))
"message ${ctx.exception().message}", .jitter(1.0)
) .doBeforeRetry { signal ->
} log.warn(
"error during validateCallLimit for ${upstream.getId()}, iteration ${signal.totalRetries() + 1}, " +
"message ${signal.failure().message}",
)
},
)
.onErrorReturn(ValidateUpstreamSettingsResult.UPSTREAM_SETTINGS_ERROR) .onErrorReturn(ValidateUpstreamSettingsResult.UPSTREAM_SETTINGS_ERROR)
} }
@@ -164,14 +169,19 @@ class ChainIdValidator(
private fun chainId(): Mono<String> { private fun chainId(): Mono<String> {
return validatorReader.get() return validatorReader.get()
.read(ChainRequest("eth_chainId", ListParams())) .read(ChainRequest("eth_chainId", ListParams()))
.retryRandomBackoff(3, Duration.ofMillis(100), Duration.ofMillis(500)) { ctx -> .retryWhen(
log.warn( Retry.backoff(3, Duration.ofMillis(100))
"error during chainId retrieving for {}, iteration {}, reason - {}", .maxBackoff(Duration.ofMillis(500))
upstream.getId(), .jitter(1.0)
ctx.iteration(), .doBeforeRetry { signal ->
ctx.exception().message, log.warn(
) "error during chainId retrieving for {}, iteration {}, reason - {}",
} upstream.getId(),
signal.totalRetries() + 1,
signal.failure().message,
)
},
)
.doOnError { log.error("Error during execution 'eth_chainId' - {} for {}", it.message, upstream.getId()) } .doOnError { log.error("Error during execution 'eth_chainId' - {} for {}", it.message, upstream.getId()) }
.flatMap(ChainResponse::requireStringResult) .flatMap(ChainResponse::requireStringResult)
} }
@@ -179,14 +189,19 @@ class ChainIdValidator(
private fun netVersion(): Mono<String> { private fun netVersion(): Mono<String> {
return validatorReader.get() return validatorReader.get()
.read(ChainRequest("net_version", ListParams())) .read(ChainRequest("net_version", ListParams()))
.retryRandomBackoff(3, Duration.ofMillis(100), Duration.ofMillis(500)) { ctx -> .retryWhen(
log.warn( Retry.backoff(3, Duration.ofMillis(100))
"error during netVersion retrieving for {}, iteration {}, reason - {}", .maxBackoff(Duration.ofMillis(500))
upstream.getId(), .jitter(1.0)
ctx.iteration(), .doBeforeRetry { signal ->
ctx.exception().message, log.warn(
) "error during netVersion retrieving for {}, iteration {}, reason - {}",
} upstream.getId(),
signal.totalRetries() + 1,
signal.failure().message,
)
},
)
.doOnError { log.error("Error during execution 'net_version' - {} for {}", it.message, upstream.getId()) } .doOnError { log.error("Error during execution 'net_version' - {} for {}", it.message, upstream.getId()) }
.flatMap(ChainResponse::requireStringResult) .flatMap(ChainResponse::requireStringResult)
} }
@@ -264,14 +279,19 @@ class ErigonBuggedValidator(
private fun isErigon(): Mono<Boolean> = private fun isErigon(): Mono<Boolean> =
upstream.getIngressReader() upstream.getIngressReader()
.read(ChainRequest("web3_clientVersion", ListParams())) .read(ChainRequest("web3_clientVersion", ListParams()))
.retryRandomBackoff(3, Duration.ofMillis(100), Duration.ofMillis(500)) { ctx -> .retryWhen(
log.warn( Retry.backoff(3, Duration.ofMillis(100))
"error during clientVersion retrieving for {}, iteration {}, reason - {}", .maxBackoff(Duration.ofMillis(500))
upstream.getId(), .jitter(1.0)
ctx.iteration(), .doBeforeRetry { signal ->
ctx.exception().message, log.warn(
) "error during clientVersion retrieving for {}, iteration {}, reason - {}",
} upstream.getId(),
signal.totalRetries() + 1,
signal.failure().message,
)
},
)
.flatMap(ChainResponse::requireStringResult) .flatMap(ChainResponse::requireStringResult)
.map { it.lowercase().contains("erigon") } .map { it.lowercase().contains("erigon") }
.doOnError { log.error("Error during execution 'web3_clientVersion' - {} for {}", it.message, upstream.getId()) } .doOnError { log.error("Error during execution 'web3_clientVersion' - {} for {}", it.message, upstream.getId()) }

View File

@@ -26,7 +26,7 @@ import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import reactor.kotlin.extra.retry.retryRandomBackoff import reactor.util.retry.Retry
import java.time.Duration import java.time.Duration
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicReference import java.util.concurrent.atomic.AtomicReference
@@ -84,12 +84,17 @@ class LogIndexValidator(
} }
} }
.timeout(Duration.ofSeconds(15)) .timeout(Duration.ofSeconds(15))
.retryRandomBackoff(2, Duration.ofMillis(200), Duration.ofMillis(1000)) { ctx -> .retryWhen(
log.debug( Retry.backoff(2, Duration.ofMillis(200))
"Retry logIndex validation for ${upstream.getId()}, iteration ${ctx.iteration()}, " + .maxBackoff(Duration.ofMillis(1000))
"error: ${ctx.exception().message}", .jitter(1.0)
) .doBeforeRetry { signal ->
} log.debug(
"Retry logIndex validation for ${upstream.getId()}, iteration ${signal.totalRetries() + 1}, " +
"error: ${signal.failure().message}",
)
},
)
.onErrorResume { err -> .onErrorResume { err ->
log.warn("Error during logIndex validation for ${upstream.getId()}: ${err.message}") log.warn("Error during logIndex validation for ${upstream.getId()}: ${err.message}")
// In case of error, return last known state to avoid false positives // In case of error, return last known state to avoid false positives

View File

@@ -35,7 +35,7 @@ import reactor.core.publisher.Flux
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import reactor.core.publisher.Sinks import reactor.core.publisher.Sinks
import reactor.core.scheduler.Scheduler import reactor.core.scheduler.Scheduler
import reactor.kotlin.extra.retry.retryExponentialBackoff import reactor.util.retry.Retry
import java.time.Duration import java.time.Duration
import java.util.function.Function import java.util.function.Function
@@ -108,14 +108,14 @@ class GrpcHead(
blocks = blocks.doOnNext { blocks = blocks.doOnNext {
log.trace("Received block ${it.height}") log.trace("Received block ${it.height}")
}.retryExponentialBackoff( }.retryWhen(
Long.MAX_VALUE, Retry.backoff(Long.MAX_VALUE, Duration.ofMillis(100))
Duration.ofMillis(100), .maxBackoff(Duration.ofSeconds(60))
Duration.ofSeconds(60), .jitter(0.5)
true, .doBeforeRetry {
) { log.debug("Retry grpc head connection ${parent.getId()}")
log.debug("Retry grpc head connection ${parent.getId()}") },
} )
headSubscription = super.follow(blocks) headSubscription = super.follow(blocks)
} }

View File

@@ -1,7 +1,7 @@
package io.emeraldpay.dshackle.upstream.bitcoin package io.emeraldpay.dshackle.upstream.bitcoin
import io.emeraldpay.dshackle.upstream.bitcoin.data.EsploraUnspent import io.emeraldpay.dshackle.upstream.bitcoin.data.EsploraUnspent
import org.bitcoinj.core.Address import org.bitcoinj.base.AddressParser
/** /**
* Copyright (c) 2020 EmeraldPay, Inc * Copyright (c) 2020 EmeraldPay, Inc
@@ -19,8 +19,6 @@ import org.bitcoinj.core.Address
* limitations under the License. * limitations under the License.
*/ */
import org.bitcoinj.params.MainNetParams
import org.bitcoinj.params.TestNet3Params
import org.mockserver.integration.ClientAndServer import org.mockserver.integration.ClientAndServer
import org.mockserver.model.HttpRequest import org.mockserver.model.HttpRequest
import org.mockserver.model.HttpResponse import org.mockserver.model.HttpResponse
@@ -53,7 +51,7 @@ class EsploraClientSpec extends Specification {
) )
def client = new EsploraClient(new URI("http://localhost:${mockServer.port}"), null, null) def client = new EsploraClient(new URI("http://localhost:${mockServer.port}"), null, null)
when: when:
def act = client.getUtxo(Address.fromString(new MainNetParams(), "35vktkPo4wdK8Twu4VMiuPLdCx23XEykGY")) def act = client.getUtxo(AddressParser.getDefault().parseAddress("35vktkPo4wdK8Twu4VMiuPLdCx23XEykGY"))
then: then:
StepVerifier.create(act) StepVerifier.create(act)
@@ -74,7 +72,7 @@ class EsploraClientSpec extends Specification {
.verify(Duration.ofSeconds(3)) .verify(Duration.ofSeconds(3))
when: when:
def actTotal = client.getUtxo(Address.fromString(new MainNetParams(), "35vktkPo4wdK8Twu4VMiuPLdCx23XEykGY")) def actTotal = client.getUtxo(AddressParser.getDefault().parseAddress("35vktkPo4wdK8Twu4VMiuPLdCx23XEykGY"))
.block() .block()
.sum { it.value } .sum { it.value }
@@ -94,7 +92,7 @@ class EsploraClientSpec extends Specification {
) )
def client = new EsploraClient(new URI("http://localhost:${mockServer.port}"), null, null) def client = new EsploraClient(new URI("http://localhost:${mockServer.port}"), null, null)
when: when:
def act = client.getTransactions(Address.fromString(TestNet3Params.get(), "tb1qyatuwvkfx8thy2ntmtuea6v42vp3zefqvll8kx")) def act = client.getTransactions(AddressParser.getDefault().parseAddress("tb1qyatuwvkfx8thy2ntmtuea6v42vp3zefqvll8kx"))
then: then:
StepVerifier.create(act) StepVerifier.create(act)
@@ -124,7 +122,7 @@ class EsploraClientSpec extends Specification {
) )
def client = new EsploraClient(new URI("http://localhost:${mockServer.port}"), null, null) def client = new EsploraClient(new URI("http://localhost:${mockServer.port}"), null, null)
when: when:
def act = client.getTransactions(Address.fromString(TestNet3Params.get(), "tb1qyatuwvkfx8thy2ntmtuea6v42vp3zefqvll8kx")) def act = client.getTransactions(AddressParser.getDefault().parseAddress("tb1qyatuwvkfx8thy2ntmtuea6v42vp3zefqvll8kx"))
then: then:
StepVerifier.create(act) StepVerifier.create(act)

View File

@@ -19,8 +19,7 @@ import io.emeraldpay.dshackle.reader.Reader
import io.emeraldpay.dshackle.upstream.ChainRequest import io.emeraldpay.dshackle.upstream.ChainRequest
import io.emeraldpay.dshackle.upstream.ChainResponse import io.emeraldpay.dshackle.upstream.ChainResponse
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.bitcoinj.core.Address import org.bitcoinj.base.AddressParser
import org.bitcoinj.params.MainNetParams
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import spock.lang.Specification import spock.lang.Specification
@@ -38,7 +37,7 @@ class RpcUnspentReaderSpec extends Specification {
def reader = new RpcUnspentReader(upstreams) def reader = new RpcUnspentReader(upstreams)
when: when:
def act = reader.read(Address.fromString(new MainNetParams(), "1K7xkspJg7DDKNwzXgoRSDCUxiFsRegsSK")).block() def act = reader.read(AddressParser.getDefault().parseAddress("1K7xkspJg7DDKNwzXgoRSDCUxiFsRegsSK")).block()
then: then:
// cat src/test/resources/bitcoin/unspent-one-addr.json | jq '. | length' // cat src/test/resources/bitcoin/unspent-one-addr.json | jq '. | length'
@@ -72,7 +71,7 @@ class RpcUnspentReaderSpec extends Specification {
def reader = new RpcUnspentReader(upstreams) def reader = new RpcUnspentReader(upstreams)
when: when:
def act = reader.read(Address.fromString(new MainNetParams(), "35hK24tcLEWcgNA4JxpvbkNkoAcDGqQPsP")).block() def act = reader.read(AddressParser.getDefault().parseAddress("35hK24tcLEWcgNA4JxpvbkNkoAcDGqQPsP")).block()
then: then:
// cat src/test/resources/bitcoin/unspent-two-addr.json | jq '[.[] | select(.address == "35hK24tcLEWcgNA4JxpvbkNkoAcDGqQPsP")] | length' // cat src/test/resources/bitcoin/unspent-two-addr.json | jq '[.[] | select(.address == "35hK24tcLEWcgNA4JxpvbkNkoAcDGqQPsP")] | length'
@@ -107,7 +106,7 @@ class RpcUnspentReaderSpec extends Specification {
def reader = new RpcUnspentReader(upstreams) def reader = new RpcUnspentReader(upstreams)
when: when:
def act = reader.read(Address.fromString(new MainNetParams(), "1K7xkspJg7DDKNwzXgoRSDCUxiFsRegsSK")).block() def act = reader.read(AddressParser.getDefault().parseAddress("1K7xkspJg7DDKNwzXgoRSDCUxiFsRegsSK")).block()
then: then:
// cat src/test/resources/bitcoin/unspent-two-addr.json | jq '[.[] | select(.address == "1K7xkspJg7DDKNwzXgoRSDCUxiFsRegsSK")] | length' // cat src/test/resources/bitcoin/unspent-two-addr.json | jq '[.[] | select(.address == "1K7xkspJg7DDKNwzXgoRSDCUxiFsRegsSK")] | length'

View File

@@ -15,8 +15,7 @@
*/ */
package io.emeraldpay.dshackle.upstream.bitcoin package io.emeraldpay.dshackle.upstream.bitcoin
import org.bitcoinj.core.Address import org.bitcoinj.base.AddressParser
import org.bitcoinj.params.MainNetParams
import reactor.core.publisher.Mono import reactor.core.publisher.Mono
import reactor.test.StepVerifier import reactor.test.StepVerifier
import spock.lang.Specification import spock.lang.Specification
@@ -119,7 +118,7 @@ class XpubAddressesSpec extends Specification {
def "list when only fist is active"() { def "list when only fist is active"() {
setup: setup:
AddressActiveCheck check = Mock(AddressActiveCheck) { AddressActiveCheck check = Mock(AddressActiveCheck) {
1 * isActive(Address.fromString(MainNetParams.get(), "bc1qaexx257l7sgm62szw2ulj6n2v99t5ph9ekkul3")) >> Mono.just(true) 1 * isActive(AddressParser.getDefault().parseAddress("bc1qaexx257l7sgm62szw2ulj6n2v99t5ph9ekkul3")) >> Mono.just(true)
20 * isActive(_) >> Mono.just(false) 20 * isActive(_) >> Mono.just(false)
} }
XpubAddresses addresses = new XpubAddresses(check) XpubAddresses addresses = new XpubAddresses(check)
@@ -143,7 +142,7 @@ class XpubAddressesSpec extends Specification {
def "list when only 3rd is active"() { def "list when only 3rd is active"() {
setup: setup:
AddressActiveCheck check = Mock(AddressActiveCheck) { AddressActiveCheck check = Mock(AddressActiveCheck) {
1 * isActive(Address.fromString(MainNetParams.get(), "bc1qah84zz7aavf3f5eyx5f29809y6xugqyphq0wtz")) >> Mono.just(true) 1 * isActive(AddressParser.getDefault().parseAddress("bc1qah84zz7aavf3f5eyx5f29809y6xugqyphq0wtz")) >> Mono.just(true)
// 2 times before, 20 times after // 2 times before, 20 times after
22 * isActive(_) >> Mono.just(false) 22 * isActive(_) >> Mono.just(false)
} }
@@ -169,11 +168,11 @@ class XpubAddressesSpec extends Specification {
setup: setup:
AddressActiveCheck check = Mock(AddressActiveCheck) { AddressActiveCheck check = Mock(AddressActiveCheck) {
// 2 // 2
1 * isActive(Address.fromString(MainNetParams.get(), "bc1qah84zz7aavf3f5eyx5f29809y6xugqyphq0wtz")) >> Mono.just(true) 1 * isActive(AddressParser.getDefault().parseAddress("bc1qah84zz7aavf3f5eyx5f29809y6xugqyphq0wtz")) >> Mono.just(true)
// 11 // 11
1 * isActive(Address.fromString(MainNetParams.get(), "bc1q3kqug4cx95a02yhwn6geelftmw3zklrgmhjll8")) >> Mono.just(true) 1 * isActive(AddressParser.getDefault().parseAddress("bc1q3kqug4cx95a02yhwn6geelftmw3zklrgmhjll8")) >> Mono.just(true)
// 22 // 22
1 * isActive(Address.fromString(MainNetParams.get(), "bc1qf7m2rrmrksj34vhgxmm04y43dlj7c5f58f8ku6")) >> Mono.just(true) 1 * isActive(AddressParser.getDefault().parseAddress("bc1qf7m2rrmrksj34vhgxmm04y43dlj7c5f58f8ku6")) >> Mono.just(true)
// 0..1 = 2 // 0..1 = 2
// + 3..10 = 8 // + 3..10 = 8
// + 12..21 = 10 // + 12..21 = 10