mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
Windows Secp Update & fix for parsing Windows paths (#2398)
* Windows Secp Update * Add docs about errors * Fix paths in config * Bump timeout
This commit is contained in:
parent
e1422ddbc2
commit
67e7426260
23
.github/workflows/Compile.yml
vendored
23
.github/workflows/Compile.yml
vendored
@ -23,26 +23,3 @@ jobs:
|
||||
key: ${{ runner.os }}-cache
|
||||
- name: Compile and Check Formatting
|
||||
run: sbt ++2.12.12 test:compile scalafmtCheckAll
|
||||
|
||||
# FIXME Need new secp256k1 bindings on windows
|
||||
# WindowsTest:
|
||||
# runs-on: windows-latest
|
||||
# steps:
|
||||
# - name: Configure git
|
||||
# run: "git config --global core.autocrlf false"
|
||||
# shell: bash
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v2
|
||||
# - name: Setup Scala
|
||||
# uses: olafurpg/setup-scala@v10
|
||||
# - name: Cache
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: |
|
||||
# ~/.ivy2/cache
|
||||
# ~/.sbt
|
||||
# ~/.bitcoin-s/binaries
|
||||
# key: ${{ runner.os }}-cache
|
||||
# - name: Windows Crypto, Core, and Database tests
|
||||
# run: sbt ++${SCALA_2_13} cryptoTest/test coreTest/test dbCommonsTest/test
|
||||
# shell: bash
|
||||
|
29
.github/workflows/Windows.yml
vendored
Normal file
29
.github/workflows/Windows.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: Windows Tests
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Configure git
|
||||
run: "git config --global core.autocrlf false"
|
||||
shell: bash
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Scala
|
||||
uses: olafurpg/setup-scala@v10
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.ivy2/cache
|
||||
~/.sbt
|
||||
~/.bitcoin-s/binaries
|
||||
key: ${{ runner.os }}-cache
|
||||
- name: Windows Crypto, Core, and Database tests
|
||||
run: sbt ++2.13.4 cryptoTest/test coreTest/test dbCommonsTest/test
|
||||
shell: bash
|
@ -1,13 +1,13 @@
|
||||
package org.bitcoins.server
|
||||
|
||||
import java.nio.file.{Path, Paths}
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
import com.typesafe.config.{Config, ConfigFactory}
|
||||
import org.bitcoins.core.config._
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.db.AppConfig
|
||||
import org.bitcoins.db.AppConfig.safePathToString
|
||||
|
||||
import java.nio.file.{Path, Paths}
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
import scala.util.Properties
|
||||
|
||||
@ -54,7 +54,8 @@ trait BitcoinSRunner extends BitcoinSLogger {
|
||||
}
|
||||
|
||||
val datadirConfig: Config =
|
||||
ConfigFactory.parseString(s"bitcoin-s.datadir = $datadirPath")
|
||||
ConfigFactory.parseString(
|
||||
s"bitcoin-s.datadir = ${safePathToString(datadirPath)}")
|
||||
|
||||
lazy val baseConfig: Config = configIndexOpt match {
|
||||
case None =>
|
||||
|
@ -296,7 +296,7 @@ object TxUtil extends BitcoinSLogger {
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.duration.DurationInt
|
||||
|
||||
Await.result(TxUtil.addDummySigs(tx, inputInfos), 5.seconds)
|
||||
Await.result(TxUtil.addDummySigs(tx, inputInfos), 20.seconds)
|
||||
}
|
||||
|
||||
val actualFee = creditingAmount - spentAmount
|
||||
|
@ -53,7 +53,7 @@ class AppConfigTest extends BitcoinSAsyncTest {
|
||||
val conf = ConfigFactory.parseString {
|
||||
s"""
|
||||
|bitcoin-s {
|
||||
| datadir = $dir
|
||||
| datadir = ${AppConfig.safePathToString(dir)}
|
||||
|}
|
||||
""".stripMargin
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
bitcoin-s {
|
||||
|
||||
network = regtest # regtest, testnet3, mainnet, signet
|
||||
datadir = ${HOME}".bitcoin-s/"
|
||||
datadir = ${HOME}/.bitcoin-s
|
||||
|
||||
dbDefault = {
|
||||
dataSourceClass = slick.jdbc.DatabaseUrlDataSource
|
||||
profile = "slick.jdbc.SQLiteProfile$"
|
||||
|
||||
db {
|
||||
//for information on parameters available here see
|
||||
//https://scala-slick.org/doc/3.3.1/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig(String,Config,Driver,ClassLoader):Database
|
||||
# for information on parameters available here see
|
||||
# https://scala-slick.org/doc/3.3.1/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig(String,Config,Driver,ClassLoader):Database
|
||||
path = ${bitcoin-s.datadir}/${bitcoin-s.network}/
|
||||
driver = org.sqlite.JDBC
|
||||
user = ""
|
||||
|
@ -162,6 +162,12 @@ abstract class AppConfig extends StartStopAsync[Unit] with BitcoinSLogger {
|
||||
|
||||
object AppConfig extends BitcoinSLogger {
|
||||
|
||||
def safePathToString(path: Path): String = {
|
||||
val pathStr = path.toString.replace("\\", "/")
|
||||
|
||||
s""""$pathStr"""" // Add quotes around it
|
||||
}
|
||||
|
||||
def getBaseConfig(
|
||||
baseDatadir: Path,
|
||||
configOverrides: List[Config] = List.empty): Config = {
|
||||
@ -178,8 +184,8 @@ object AppConfig extends BitcoinSLogger {
|
||||
}
|
||||
|
||||
val withDatadir =
|
||||
ConfigFactory.parseString(s"bitcoin-s.datadir = $baseDatadir",
|
||||
configOptions)
|
||||
ConfigFactory.parseString(
|
||||
s"bitcoin-s.datadir = ${safePathToString(baseDatadir)}")
|
||||
withDatadir.withFallback(config)
|
||||
}
|
||||
|
||||
@ -233,7 +239,10 @@ object AppConfig extends BitcoinSLogger {
|
||||
* both with and without a trailing `/`
|
||||
*/
|
||||
private val defaultDatadirRegex: Regex = {
|
||||
(Properties.userHome + "/.bitcoin-s/(testnet3|mainnet|regtest)/?$").r
|
||||
// Fix for windows
|
||||
val home = Properties.userHome.replace('\\', '/')
|
||||
|
||||
(home + "/.bitcoin-s/(testnet3|mainnet|regtest)/?$").r
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bitcoins.db
|
||||
|
||||
import com.typesafe.config._
|
||||
import org.bitcoins.db.AppConfig.safePathToString
|
||||
import org.bitcoins.db.DatabaseDriver.{PostgreSQL, SQLite}
|
||||
import slick.basic.DatabaseConfig
|
||||
import slick.jdbc.JdbcProfile
|
||||
@ -31,7 +32,7 @@ abstract class DbAppConfig extends AppConfig {
|
||||
lazy val jdbcUrl: String = {
|
||||
driver match {
|
||||
case SQLite =>
|
||||
s""""jdbc:sqlite:"$dbPath/$dbName"""
|
||||
s""""jdbc:sqlite:"${safePathToString(dbPath)}/$dbName"""
|
||||
case PostgreSQL =>
|
||||
s""""jdbc:postgresql://$dbHost:$dbPort/$dbName""""
|
||||
}
|
||||
@ -93,7 +94,7 @@ abstract class DbAppConfig extends AppConfig {
|
||||
|bitcoin-s {
|
||||
| $moduleName {
|
||||
| db {
|
||||
| path = $dbPath
|
||||
| path = ${safePathToString(dbPath)}
|
||||
| name = $dbName
|
||||
| url = $jdbcUrl
|
||||
| }
|
||||
|
@ -401,6 +401,10 @@ I normally first build the C binaries and add to Bitcoin-S before coming back to
|
||||
./configure --host=x86_64-w64-mingw32 --enable-experimental --enable-module_ecdh --enable-jni && make clean && make CFLAGS="-std=c99"
|
||||
```
|
||||
|
||||
There may be some errors that can be ignored:
|
||||
- `Could not determine the host path corresponding to`
|
||||
- `redeclared without dllimport attribute: previous dllimport ignored`
|
||||
|
||||
3. Copy binaries into bitcoin-s natives for your system
|
||||
|
||||
You have now built the C binaries for your JNI bindings for your operating system and you should now find your operating system's directory in `bitcoin-s/secp256k1jni/natives` and replace its contents with the contents of `secp256k1/.libs` (which contains the compiled binaries).
|
||||
|
Binary file not shown.
@ -7,8 +7,8 @@ bitcoin-s {
|
||||
profile = "slick.jdbc.SQLiteProfile$"
|
||||
|
||||
db {
|
||||
//for information on parameters available here see
|
||||
//https://scala-slick.org/doc/3.3.1/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig(String,Config,Driver,ClassLoader):Database
|
||||
# for information on parameters available here see
|
||||
# https://scala-slick.org/doc/3.3.1/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig(String,Config,Driver,ClassLoader):Database
|
||||
path = ${bitcoin-s.datadir}/${bitcoin-s.network}/
|
||||
driver = org.sqlite.JDBC
|
||||
user = ""
|
||||
|
Loading…
Reference in New Issue
Block a user