mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 18:47:38 +01:00
Merge pull request #2019
* Refactor logging to only use grizzled slf4j * Fix docs * test travis config change
This commit is contained in:
parent
975e8d0fda
commit
1e3aee55c3
52 changed files with 162 additions and 403 deletions
|
@ -1,16 +1,4 @@
|
||||||
<configuration>
|
<configuration scan="true" scanPeriod="15 seconds" >
|
||||||
<!-- see how long statements took to execute by setting to DEBUG -->
|
|
||||||
<logger name="slick.jdbc.JdbcBackend.benchmark" level="INFO"/>
|
|
||||||
|
|
||||||
<!-- see what statements are executed by setting to DEBUG -->
|
|
||||||
<logger name="slick.jdbc.JdbcBackend.statement" level="INFO"/>
|
|
||||||
|
|
||||||
<!-- see what slick is compiling to in sql -->
|
|
||||||
<logger name="slick.compiler" level="INFO"/>
|
|
||||||
|
|
||||||
<!-- see what's returned by Slick -->
|
|
||||||
<logger name="slick.jdbc.StatementInvoker.result" level="INFO"/>
|
|
||||||
|
|
||||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%date{yyyy-MM-dd'T'HH:mm:ss,SSXXX} %level [%logger{0}] %msg%n</pattern>
|
<pattern>%date{yyyy-MM-dd'T'HH:mm:ss,SSXXX} %level [%logger{0}] %msg%n</pattern>
|
||||||
|
@ -43,4 +31,79 @@
|
||||||
<appender-ref ref="ASYNC"/>
|
<appender-ref ref="ASYNC"/>
|
||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="FILE"/>
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
|
<!-- ╔═══════════════════════╗ -->
|
||||||
|
<!-- ║ Bitcoin-S logging ║-->
|
||||||
|
<!-- ╚═══════════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- ╔═══════════════════╗ -->
|
||||||
|
<!-- ║ Configuration ║ -->
|
||||||
|
<!-- ╚═══════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- inspect resolved DB connection -->
|
||||||
|
<logger name="org.bitcoins.db.SafeDatabase" level="WARN"/>
|
||||||
|
|
||||||
|
<!-- inspect resolved config -->
|
||||||
|
<logger name="org.bitcoins.chain.config" level="WARN"/>
|
||||||
|
<logger name="org.bitcoins.node.config" level="WARN"/>
|
||||||
|
<logger name="org.bitcoins.wallet.config" level="WARN"/>
|
||||||
|
|
||||||
|
<!-- inspect table creation, etc -->
|
||||||
|
<logger name="org.bitcoins.chain.db" level="WARN" />
|
||||||
|
<logger name="org.bitcoins.node.db" level="WARN" />
|
||||||
|
<logger name="org.bitcoins.wallet.db" level="WARN" />
|
||||||
|
|
||||||
|
<!-- ╔═════════════════╗ -->
|
||||||
|
<!-- ║ Node module ║ -->
|
||||||
|
<!-- ╚═════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- See incoming message names and the peer it's sent from -->
|
||||||
|
<logger name="org.bitcoins.node.networking.peer.PeerMessageReceiver" level="INFO"/>
|
||||||
|
|
||||||
|
<!-- See outgoing message names and the peer it's sent to -->
|
||||||
|
<logger name="org.bitcoins.node.networking.peer.PeerMessageSender" level="INFO"/>
|
||||||
|
|
||||||
|
<!-- Inspect handling of headers and inventory messages -->
|
||||||
|
<logger name="org.bitcoins.node.networking.peer.DataMessageHandler" level="INFO"/>
|
||||||
|
|
||||||
|
<!-- inspect TCP details -->
|
||||||
|
<logger name="org.bitcoins.node.networking.P2PClientActor" level="INFO"/>
|
||||||
|
|
||||||
|
<!-- ╔════════════════════╗ -->
|
||||||
|
<!-- ║ Chain module ║ -->
|
||||||
|
<!-- ╚════════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- See queries received by chain handler, as well as result of -->
|
||||||
|
<!-- connecting new block headers to chain -->
|
||||||
|
<logger name="org.bitcoins.chain.blockchain.ChainHandler" level="WARN"/>
|
||||||
|
|
||||||
|
<logger name="org.bitcoins.chain.validation" level="WARN"/>
|
||||||
|
|
||||||
|
<!-- ╔═════════════════════╗ -->
|
||||||
|
<!-- ║ Wallet module ║ -->
|
||||||
|
<!-- ╚═════════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- ╔═══════════════════════════╗ -->
|
||||||
|
<!-- ║ Bitcoin-S logging end ║-->
|
||||||
|
<!-- ╚═══════════════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- ╔═════════════════════════╗ -->
|
||||||
|
<!-- ║ External libraries ║ -->
|
||||||
|
<!-- ╚═════════════════════════╝ -->
|
||||||
|
|
||||||
|
<!-- Disable slick logging in server -->
|
||||||
|
<logger name="slick" level="OFF"/>
|
||||||
|
<logger name="com.zaxxer" level="OFF"/>
|
||||||
|
|
||||||
|
<!-- Get rid of messages like this:
|
||||||
|
Connection attempt failed. Backing off new connection
|
||||||
|
attempts for at least 800 milliseconds. -->
|
||||||
|
<logger name="akka.http.impl.engine.client.PoolGateway" level="OFF"/>
|
||||||
|
|
||||||
|
<!-- get rid of "Slf4jLogger started" messages -->
|
||||||
|
<logger name="akka.event.slf4j.Slf4jLogger" level="OFF"/>
|
||||||
|
|
||||||
|
<!-- get rid of "Running CoordinatedShutdown Phase" messages -->
|
||||||
|
<logger name="akka.actor.slf4j.CoordinatedShutdown" level="OFF"/>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
|
@ -1,22 +1,6 @@
|
||||||
package org.bitcoins.server
|
package org.bitcoins.server
|
||||||
|
|
||||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
import grizzled.slf4j.Logging
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
/** Exposes access to the HTTP RPC server logger */
|
/** Exposes access to the HTTP RPC server logger */
|
||||||
private[bitcoins] trait HttpLogger {
|
private[bitcoins] trait HttpLogger extends Logging
|
||||||
|
|
||||||
protected[bitcoins] def logger(implicit config: LoggerConfig): Logger = {
|
|
||||||
HttpLoggerImpl(config).getLogger
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private[server] case class HttpLoggerImpl(override val conf: LoggerConfig)
|
|
||||||
extends AppLoggers {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the HTTP RPC server submobule logger
|
|
||||||
*/
|
|
||||||
def getLogger: Logger =
|
|
||||||
getLoggerImpl(LoggerKind.Http)
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.bitcoins.chain.models.{
|
||||||
import org.bitcoins.core.Core
|
import org.bitcoins.core.Core
|
||||||
import org.bitcoins.core.api.chain.ChainApi
|
import org.bitcoins.core.api.chain.ChainApi
|
||||||
import org.bitcoins.core.config.{BitcoinNetworks, MainNet, RegTest, TestNet3}
|
import org.bitcoins.core.config.{BitcoinNetworks, MainNet, RegTest, TestNet3}
|
||||||
import org.bitcoins.core.util.{BitcoinSLogger, FutureUtil, NetworkUtil}
|
import org.bitcoins.core.util.{FutureUtil, NetworkUtil}
|
||||||
import org.bitcoins.db._
|
import org.bitcoins.db._
|
||||||
import org.bitcoins.feeprovider.BitcoinerLiveFeeRateProvider
|
import org.bitcoins.feeprovider.BitcoinerLiveFeeRateProvider
|
||||||
import org.bitcoins.node._
|
import org.bitcoins.node._
|
||||||
|
@ -28,7 +28,7 @@ import org.bitcoins.wallet.config.WalletAppConfig
|
||||||
import scala.concurrent.{ExecutionContext, Future, Promise}
|
import scala.concurrent.{ExecutionContext, Future, Promise}
|
||||||
import scala.util.Properties
|
import scala.util.Properties
|
||||||
|
|
||||||
object Main extends App with BitcoinSLogger {
|
object Main extends App with HttpLogger {
|
||||||
|
|
||||||
def runMain(args: Vector[String]): Future[Unit] = {
|
def runMain(args: Vector[String]): Future[Unit] = {
|
||||||
val argsWithIndex = args.zipWithIndex
|
val argsWithIndex = args.zipWithIndex
|
||||||
|
@ -105,8 +105,6 @@ object Main extends App with BitcoinSLogger {
|
||||||
val forceChainWorkRecalc: Boolean =
|
val forceChainWorkRecalc: Boolean =
|
||||||
args.exists(_.toLowerCase == "--force-recalc-chainwork")
|
args.exists(_.toLowerCase == "--force-recalc-chainwork")
|
||||||
|
|
||||||
val logger = HttpLoggerImpl(conf.nodeConf).getLogger
|
|
||||||
|
|
||||||
implicit val walletConf: WalletAppConfig = conf.walletConf
|
implicit val walletConf: WalletAppConfig = conf.walletConf
|
||||||
implicit val nodeConf: NodeAppConfig = conf.nodeConf
|
implicit val nodeConf: NodeAppConfig = conf.nodeConf
|
||||||
implicit val chainConf: ChainAppConfig = conf.chainConf
|
implicit val chainConf: ChainAppConfig = conf.chainConf
|
||||||
|
|
|
@ -18,7 +18,6 @@ case class Server(
|
||||||
handlers: Seq[ServerRoute],
|
handlers: Seq[ServerRoute],
|
||||||
rpcport: Int = 9999)(implicit system: ActorSystem)
|
rpcport: Int = 9999)(implicit system: ActorSystem)
|
||||||
extends HttpLogger {
|
extends HttpLogger {
|
||||||
implicit private val config: AppConfig = conf
|
|
||||||
|
|
||||||
import system.dispatcher
|
import system.dispatcher
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.chain.config
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
import ch.qos.logback.classic.Level
|
|
||||||
import com.typesafe.config.ConfigFactory
|
import com.typesafe.config.ConfigFactory
|
||||||
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
||||||
import org.bitcoins.testkit.chain.ChainUnitTest
|
import org.bitcoins.testkit.chain.ChainUnitTest
|
||||||
|
@ -77,8 +76,6 @@ class ChainAppConfigTest extends ChainUnitTest {
|
||||||
|
|
||||||
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
||||||
assert(appConfig.network == TestNet3)
|
assert(appConfig.network == TestNet3)
|
||||||
assert(appConfig.logLevel == Level.OFF)
|
|
||||||
assert(appConfig.p2pLogLevel == Level.WARN)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def afterAll: Unit = {
|
override def afterAll: Unit = {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.bitcoins.chain
|
package org.bitcoins.chain
|
||||||
|
|
||||||
|
import grizzled.slf4j.Logger
|
||||||
import org.bitcoins.core.api.{Callback2, CallbackHandler}
|
import org.bitcoins.core.api.{Callback2, CallbackHandler}
|
||||||
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
import scala.concurrent.{ExecutionContext, Future}
|
import scala.concurrent.{ExecutionContext, Future}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
package org.bitcoins.chain
|
package org.bitcoins.chain
|
||||||
|
|
||||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
import grizzled.slf4j.Logging
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
/** Exposes access to the chain verification logger */
|
/** Exposes access to the chain verification logger */
|
||||||
private[bitcoins] trait ChainVerificationLogger {
|
private[bitcoins] trait ChainVerificationLogger extends Logging
|
||||||
|
|
||||||
protected[bitcoins] def logger(implicit config: LoggerConfig): Logger = {
|
|
||||||
ChainVerificationLoggerImpl(config).getLogger
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private[chain] case class ChainVerificationLoggerImpl(
|
|
||||||
override val conf: LoggerConfig)
|
|
||||||
extends AppLoggers {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the chain verification submobule logger
|
|
||||||
*/
|
|
||||||
def getLogger: Logger =
|
|
||||||
getLoggerImpl(LoggerKind.ChainVerification)
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.chain.blockchain.sync
|
||||||
|
|
||||||
import org.bitcoins.chain.ChainVerificationLogger
|
import org.bitcoins.chain.ChainVerificationLogger
|
||||||
import org.bitcoins.chain.blockchain.ChainHandler
|
import org.bitcoins.chain.blockchain.ChainHandler
|
||||||
import org.bitcoins.chain.config.ChainAppConfig
|
|
||||||
import org.bitcoins.core.api.chain.ChainApi
|
import org.bitcoins.core.api.chain.ChainApi
|
||||||
import org.bitcoins.core.api.chain.db.BlockHeaderDb
|
import org.bitcoins.core.api.chain.db.BlockHeaderDb
|
||||||
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
||||||
|
@ -25,8 +24,7 @@ abstract class ChainSync extends ChainVerificationLogger {
|
||||||
chainHandler: ChainHandler,
|
chainHandler: ChainHandler,
|
||||||
getBlockHeaderFunc: DoubleSha256DigestBE => Future[BlockHeader],
|
getBlockHeaderFunc: DoubleSha256DigestBE => Future[BlockHeader],
|
||||||
getBestBlockHashFunc: () => Future[DoubleSha256DigestBE])(implicit
|
getBestBlockHashFunc: () => Future[DoubleSha256DigestBE])(implicit
|
||||||
ec: ExecutionContext,
|
ec: ExecutionContext): Future[ChainApi] = {
|
||||||
conf: ChainAppConfig): Future[ChainApi] = {
|
|
||||||
val currentTipsF: Future[Vector[BlockHeaderDb]] = {
|
val currentTipsF: Future[Vector[BlockHeaderDb]] = {
|
||||||
chainHandler.blockHeaderDAO.chainTips
|
chainHandler.blockHeaderDAO.chainTips
|
||||||
}
|
}
|
||||||
|
@ -69,8 +67,7 @@ abstract class ChainSync extends ChainVerificationLogger {
|
||||||
tips: Vector[BlockHeaderDb],
|
tips: Vector[BlockHeaderDb],
|
||||||
bestBlockHash: DoubleSha256DigestBE,
|
bestBlockHash: DoubleSha256DigestBE,
|
||||||
getBlockHeaderFunc: DoubleSha256DigestBE => Future[BlockHeader])(implicit
|
getBlockHeaderFunc: DoubleSha256DigestBE => Future[BlockHeader])(implicit
|
||||||
ec: ExecutionContext,
|
ec: ExecutionContext): Future[ChainApi] = {
|
||||||
conf: ChainAppConfig): Future[ChainApi] = {
|
|
||||||
require(tips.nonEmpty, s"Cannot sync without the genesis block")
|
require(tips.nonEmpty, s"Cannot sync without the genesis block")
|
||||||
|
|
||||||
//we need to walk backwards on the chain until we get to one of our tips
|
//we need to walk backwards on the chain until we get to one of our tips
|
||||||
|
|
|
@ -133,8 +133,7 @@ abstract class FilterSync extends ChainVerificationLogger {
|
||||||
missingHeaders: Vector[BlockHeaderDb],
|
missingHeaders: Vector[BlockHeaderDb],
|
||||||
ourBestFilterHeaderOpt: Option[CompactFilterHeaderDb],
|
ourBestFilterHeaderOpt: Option[CompactFilterHeaderDb],
|
||||||
getFilterFunc: BlockHeader => Future[FilterWithHeaderHash])(implicit
|
getFilterFunc: BlockHeader => Future[FilterWithHeaderHash])(implicit
|
||||||
ec: ExecutionContext,
|
ec: ExecutionContext): Future[ChainApi] = {
|
||||||
chainAppConfig: ChainAppConfig): Future[ChainApi] = {
|
|
||||||
//now that we have headers that are missing filters, let's fetch the filters
|
//now that we have headers that are missing filters, let's fetch the filters
|
||||||
|
|
||||||
val fetchNested = missingHeaders.map { b =>
|
val fetchNested = missingHeaders.map { b =>
|
||||||
|
|
|
@ -286,7 +286,7 @@ case class BlockHeaderDAO()(implicit
|
||||||
* This should only be used if the chain work has not been calculated
|
* This should only be used if the chain work has not been calculated
|
||||||
*/
|
*/
|
||||||
def chainTipsByHeight: Future[Vector[BlockHeaderDb]] = {
|
def chainTipsByHeight: Future[Vector[BlockHeaderDb]] = {
|
||||||
logger.debug(s"Getting chain tips from: ${dbConfig.config}")
|
logger.debug(s"Getting chain tips from database")
|
||||||
val aggregate = {
|
val aggregate = {
|
||||||
maxHeightQuery.flatMap { height =>
|
maxHeightQuery.flatMap { height =>
|
||||||
logger.debug(s"Max block height: $height")
|
logger.debug(s"Max block height: $height")
|
||||||
|
@ -302,7 +302,7 @@ case class BlockHeaderDAO()(implicit
|
||||||
}
|
}
|
||||||
|
|
||||||
def chainTips: Future[Vector[BlockHeaderDb]] = {
|
def chainTips: Future[Vector[BlockHeaderDb]] = {
|
||||||
logger.debug(s"Getting chain tips from: ${dbConfig.config}")
|
logger.debug(s"Getting chain tips from database")
|
||||||
val aggregate = {
|
val aggregate = {
|
||||||
maxWorkQuery.flatMap { work =>
|
maxWorkQuery.flatMap { work =>
|
||||||
logger.debug(s"Max block work: $work")
|
logger.debug(s"Max block work: $work")
|
||||||
|
|
|
@ -60,7 +60,7 @@ sealed abstract class TipValidation extends ChainVerificationLogger {
|
||||||
/** Logs the result of [[org.bitcoins.chain.validation.TipValidation.checkNewTip() checkNewTip]] */
|
/** Logs the result of [[org.bitcoins.chain.validation.TipValidation.checkNewTip() checkNewTip]] */
|
||||||
private def logTipResult(
|
private def logTipResult(
|
||||||
connectTipResult: TipUpdateResult,
|
connectTipResult: TipUpdateResult,
|
||||||
currentTip: BlockHeaderDb)(implicit conf: ChainAppConfig): Unit = {
|
currentTip: BlockHeaderDb): Unit = {
|
||||||
connectTipResult match {
|
connectTipResult match {
|
||||||
case TipUpdateResult.Success(tipDb) =>
|
case TipUpdateResult.Success(tipDb) =>
|
||||||
logger.trace(
|
logger.trace(
|
||||||
|
|
|
@ -11,8 +11,8 @@ import org.scalacheck.{Prop, Properties}
|
||||||
* Created by chris on 7/25/16.
|
* Created by chris on 7/25/16.
|
||||||
*/
|
*/
|
||||||
class TransactionSignatureCreatorSpec
|
class TransactionSignatureCreatorSpec
|
||||||
extends Properties("TransactionSignatureCreatorSpec") {
|
extends Properties("TransactionSignatureCreatorSpec")
|
||||||
private val logger = BitcoinSLogger.logger
|
with BitcoinSLogger {
|
||||||
|
|
||||||
property("Must generate a valid signature for a p2pk transaction") =
|
property("Must generate a valid signature for a p2pk transaction") =
|
||||||
Prop.forAll(TransactionGenerators.signedP2PKTransaction) {
|
Prop.forAll(TransactionGenerators.signedP2PKTransaction) {
|
||||||
|
|
|
@ -9,8 +9,7 @@ import scala.util.Try
|
||||||
/**
|
/**
|
||||||
* Created by chris on 6/16/16.
|
* Created by chris on 6/16/16.
|
||||||
*/
|
*/
|
||||||
class UInt32Spec extends Properties("UInt32") {
|
class UInt32Spec extends Properties("UInt32") with BitcoinSLogger {
|
||||||
private val logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
property("serialization symmetry") = {
|
property("serialization symmetry") = {
|
||||||
Prop.forAll(NumberGenerator.uInt32s) { uInt32: UInt32 =>
|
Prop.forAll(NumberGenerator.uInt32s) { uInt32: UInt32 =>
|
||||||
|
|
|
@ -6,8 +6,8 @@ import org.scalacheck.{Gen, Prop, Properties}
|
||||||
|
|
||||||
import scala.util.Try
|
import scala.util.Try
|
||||||
|
|
||||||
class UInt8Spec extends Properties("UInt8Spec") {
|
class UInt8Spec extends Properties("UInt8Spec") with BitcoinSLogger {
|
||||||
private val logger = BitcoinSLogger.logger
|
|
||||||
property("convert uint8 -> byte -> uint8") = {
|
property("convert uint8 -> byte -> uint8") = {
|
||||||
Prop.forAll(NumberGenerator.uInt8) {
|
Prop.forAll(NumberGenerator.uInt8) {
|
||||||
case u8: UInt8 =>
|
case u8: UInt8 =>
|
||||||
|
|
|
@ -7,8 +7,9 @@ import org.scalacheck.{Prop, Properties}
|
||||||
/**
|
/**
|
||||||
* Created by chris on 6/22/16.
|
* Created by chris on 6/22/16.
|
||||||
*/
|
*/
|
||||||
class P2PKScriptSignatureSpec extends Properties("P2PKSpec") {
|
class P2PKScriptSignatureSpec
|
||||||
private def logger = BitcoinSLogger.logger
|
extends Properties("P2PKSpec")
|
||||||
|
with BitcoinSLogger {
|
||||||
|
|
||||||
property("Serialization symmetry") =
|
property("Serialization symmetry") =
|
||||||
Prop.forAll(ScriptGenerators.p2pkScriptSignature) { p2pkScriptSig =>
|
Prop.forAll(ScriptGenerators.p2pkScriptSignature) { p2pkScriptSig =>
|
||||||
|
|
|
@ -4,8 +4,10 @@ import org.bitcoins.testkit.core.gen.{ScriptGenerators, WitnessGenerators}
|
||||||
import org.bitcoins.core.util.BitcoinSLogger
|
import org.bitcoins.core.util.BitcoinSLogger
|
||||||
import org.scalacheck.{Prop, Properties}
|
import org.scalacheck.{Prop, Properties}
|
||||||
|
|
||||||
class ScriptWitnessSpec extends Properties("ScriptWitnessSpec") {
|
class ScriptWitnessSpec
|
||||||
private val logger = BitcoinSLogger.logger
|
extends Properties("ScriptWitnessSpec")
|
||||||
|
with BitcoinSLogger {
|
||||||
|
|
||||||
property("serialization symmetry") = {
|
property("serialization symmetry") = {
|
||||||
Prop.forAll(WitnessGenerators.scriptWitness) { scriptWit =>
|
Prop.forAll(WitnessGenerators.scriptWitness) { scriptWit =>
|
||||||
val x = ScriptWitness(scriptWit.stack)
|
val x = ScriptWitness(scriptWit.stack)
|
||||||
|
|
|
@ -7,8 +7,10 @@ import org.scalacheck.{Prop, Properties}
|
||||||
/**
|
/**
|
||||||
* Created by chris on 6/24/16.
|
* Created by chris on 6/24/16.
|
||||||
*/
|
*/
|
||||||
class TransactionInputSpec extends Properties("TranactionInputSpec") {
|
class TransactionInputSpec
|
||||||
private val logger = BitcoinSLogger.logger
|
extends Properties("TranactionInputSpec")
|
||||||
|
with BitcoinSLogger {
|
||||||
|
|
||||||
property("Serialization symmetry") = {
|
property("Serialization symmetry") = {
|
||||||
Prop.forAllNoShrink(TransactionGenerators.input) { input =>
|
Prop.forAllNoShrink(TransactionGenerators.input) { input =>
|
||||||
val result = TransactionInput(input.hex) == input
|
val result = TransactionInput(input.hex) == input
|
||||||
|
|
|
@ -4,8 +4,8 @@ import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||||
import org.bitcoins.core.util.BitcoinSLogger
|
import org.bitcoins.core.util.BitcoinSLogger
|
||||||
import org.scalacheck.{Prop, Properties}
|
import org.scalacheck.{Prop, Properties}
|
||||||
|
|
||||||
class HashTypeSpec extends Properties("HashTypeSpec") {
|
class HashTypeSpec extends Properties("HashTypeSpec") with BitcoinSLogger {
|
||||||
private val logger = BitcoinSLogger.logger
|
|
||||||
property("serialization symmetry") = {
|
property("serialization symmetry") = {
|
||||||
Prop.forAll(NumberGenerator.int32s) { i32 =>
|
Prop.forAll(NumberGenerator.int32s) { i32 =>
|
||||||
val hashType = HashType.fromBytes(i32.bytes)
|
val hashType = HashType.fromBytes(i32.bytes)
|
||||||
|
|
|
@ -7,8 +7,7 @@ import org.scalacheck.{Prop, Properties}
|
||||||
/**
|
/**
|
||||||
* Created by chris on 6/20/16.
|
* Created by chris on 6/20/16.
|
||||||
*/
|
*/
|
||||||
class NumberUtilSpec extends Properties("NumberUtilSpec") {
|
class NumberUtilSpec extends Properties("NumberUtilSpec") with BitcoinSLogger {
|
||||||
private val logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
property("Serialization symmetry for BigInt") =
|
property("Serialization symmetry for BigInt") =
|
||||||
Prop.forAll(NumberGenerator.bigInts) { bigInt: BigInt =>
|
Prop.forAll(NumberGenerator.bigInts) { bigInt: BigInt =>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.bitcoins.core.api
|
package org.bitcoins.core.api
|
||||||
|
|
||||||
|
import grizzled.slf4j.Logger
|
||||||
import org.bitcoins.core.util.{FutureUtil, SeqWrapper}
|
import org.bitcoins.core.util.{FutureUtil, SeqWrapper}
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
import scala.concurrent.{ExecutionContext, Future}
|
import scala.concurrent.{ExecutionContext, Future}
|
||||||
import scala.util.control.NonFatal
|
import scala.util.control.NonFatal
|
||||||
|
|
|
@ -21,9 +21,7 @@ import scodec.bits.ByteVector
|
||||||
* bitcoinj version of this
|
* bitcoinj version of this
|
||||||
* [[https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Transaction.java#L924-L1008]]
|
* [[https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Transaction.java#L924-L1008]]
|
||||||
*/
|
*/
|
||||||
sealed abstract class TransactionSignatureSerializer {
|
sealed abstract class TransactionSignatureSerializer extends BitcoinSLogger {
|
||||||
|
|
||||||
private val logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitcoin Core's bug is that SignatureHash was supposed to return a hash and on this codepath it
|
* Bitcoin Core's bug is that SignatureHash was supposed to return a hash and on this codepath it
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.bitcoins.core.policy.Policy
|
||||||
import org.bitcoins.core.protocol.script._
|
import org.bitcoins.core.protocol.script._
|
||||||
import org.bitcoins.core.script.control.OP_RETURN
|
import org.bitcoins.core.script.control.OP_RETURN
|
||||||
import org.bitcoins.core.script.crypto.HashType
|
import org.bitcoins.core.script.crypto.HashType
|
||||||
import org.bitcoins.core.wallet.builder.RawTxSigner.logger
|
import org.bitcoins.core.util.BitcoinSLogger
|
||||||
import org.bitcoins.core.wallet.builder.TxBuilderError
|
import org.bitcoins.core.wallet.builder.TxBuilderError
|
||||||
import org.bitcoins.core.wallet.fee.FeeUnit
|
import org.bitcoins.core.wallet.fee.FeeUnit
|
||||||
import org.bitcoins.core.wallet.signer.BitcoinSigner
|
import org.bitcoins.core.wallet.signer.BitcoinSigner
|
||||||
|
@ -17,7 +17,7 @@ import scala.annotation.tailrec
|
||||||
import scala.concurrent.{Await, ExecutionContext, Future}
|
import scala.concurrent.{Await, ExecutionContext, Future}
|
||||||
import scala.util.{Failure, Success, Try}
|
import scala.util.{Failure, Success, Try}
|
||||||
|
|
||||||
object TxUtil {
|
object TxUtil extends BitcoinSLogger {
|
||||||
|
|
||||||
private def computeNextLockTime(
|
private def computeNextLockTime(
|
||||||
currentLockTimeOpt: Option[UInt32],
|
currentLockTimeOpt: Option[UInt32],
|
||||||
|
|
|
@ -19,8 +19,7 @@ import scala.annotation.tailrec
|
||||||
/**
|
/**
|
||||||
* Created by chris on 1/25/16.
|
* Created by chris on 1/25/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class ArithmeticInterpreter {
|
sealed abstract class ArithmeticInterpreter extends BitcoinSLogger {
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/** a is added to b. */
|
/** a is added to b. */
|
||||||
def opAdd(program: ExecutionInProgressScriptProgram): StartedScriptProgram = {
|
def opAdd(program: ExecutionInProgressScriptProgram): StartedScriptProgram = {
|
||||||
|
|
|
@ -16,8 +16,7 @@ import org.bitcoins.core.util.BitcoinSLogger
|
||||||
/**
|
/**
|
||||||
* Created by chris on 1/6/16.
|
* Created by chris on 1/6/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class BitwiseInterpreter {
|
sealed abstract class BitwiseInterpreter extends BitcoinSLogger {
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/** Returns 1 if the inputs are exactly equal, 0 otherwise. */
|
/** Returns 1 if the inputs are exactly equal, 0 otherwise. */
|
||||||
def opEqual(
|
def opEqual(
|
||||||
|
|
|
@ -13,8 +13,7 @@ import scala.annotation.tailrec
|
||||||
/**
|
/**
|
||||||
* Created by chris on 1/24/16.
|
* Created by chris on 1/24/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class ConstantInterpreter {
|
sealed abstract class ConstantInterpreter extends BitcoinSLogger {
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/** The next byte contains the number of bytes to be pushed onto the stack. */
|
/** The next byte contains the number of bytes to be pushed onto the stack. */
|
||||||
def opPushData1(
|
def opPushData1(
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
package org.bitcoins.core.script.control
|
package org.bitcoins.core.script.control
|
||||||
|
|
||||||
import org.bitcoins.core.protocol.script.{SigVersionWitnessV0, SignatureVersion}
|
import org.bitcoins.core.protocol.script.{SigVersionWitnessV0, SignatureVersion}
|
||||||
|
import org.bitcoins.core.script.constant._
|
||||||
|
import org.bitcoins.core.script.flag.ScriptFlagUtil
|
||||||
|
import org.bitcoins.core.script.result._
|
||||||
import org.bitcoins.core.script.{
|
import org.bitcoins.core.script.{
|
||||||
ExecutionInProgressScriptProgram,
|
ExecutionInProgressScriptProgram,
|
||||||
StartedScriptProgram
|
StartedScriptProgram
|
||||||
}
|
}
|
||||||
import org.bitcoins.core.script.constant._
|
|
||||||
import org.bitcoins.core.script.flag.ScriptFlagUtil
|
|
||||||
import org.bitcoins.core.script.result._
|
|
||||||
import org.bitcoins.core.util._
|
import org.bitcoins.core.util._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by chris on 1/6/16.
|
* Created by chris on 1/6/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class ControlOperationsInterpreter {
|
sealed abstract class ControlOperationsInterpreter extends BitcoinSLogger {
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/** Factors out the similarities between OP_IF and OP_NOTIF */
|
/** Factors out the similarities between OP_IF and OP_NOTIF */
|
||||||
private def opConditional(conditional: ConditionalOperation)(
|
private def opConditional(conditional: ConditionalOperation)(
|
||||||
|
|
|
@ -22,9 +22,7 @@ import scodec.bits.ByteVector
|
||||||
/**
|
/**
|
||||||
* Created by chris on 1/6/16.
|
* Created by chris on 1/6/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class CryptoInterpreter {
|
sealed abstract class CryptoInterpreter extends BitcoinSLogger {
|
||||||
|
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/** The input is hashed twice: first with SHA-256 and then with RIPEMD-160. */
|
/** The input is hashed twice: first with SHA-256 and then with RIPEMD-160. */
|
||||||
def opHash160(
|
def opHash160(
|
||||||
|
|
|
@ -20,9 +20,7 @@ import scala.annotation.tailrec
|
||||||
/**
|
/**
|
||||||
* Created by chris on 2/8/16.
|
* Created by chris on 2/8/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class LockTimeInterpreter {
|
sealed abstract class LockTimeInterpreter extends BitcoinSLogger {
|
||||||
|
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks transaction as invalid if the top stack item is greater than the transaction's `nLockTime` field,
|
* Marks transaction as invalid if the top stack item is greater than the transaction's `nLockTime` field,
|
||||||
|
|
|
@ -11,9 +11,7 @@ import org.bitcoins.core.util.BitcoinSLogger
|
||||||
/**
|
/**
|
||||||
* Created by chris on 2/4/16.
|
* Created by chris on 2/4/16.
|
||||||
*/
|
*/
|
||||||
sealed abstract class SpliceInterpreter {
|
sealed abstract class SpliceInterpreter extends BitcoinSLogger {
|
||||||
|
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/** Pushes the string length of the top element of the stack (without popping it). */
|
/** Pushes the string length of the top element of the stack (without popping it). */
|
||||||
def opSize(
|
def opSize(
|
||||||
|
|
|
@ -16,8 +16,7 @@ import scala.util.{Failure, Success, Try}
|
||||||
* Stack operations implemented in the script programming language
|
* Stack operations implemented in the script programming language
|
||||||
* https://en.bitcoin.it/wiki/Script#Stack
|
* https://en.bitcoin.it/wiki/Script#Stack
|
||||||
*/
|
*/
|
||||||
sealed abstract class StackInterpreter {
|
sealed abstract class StackInterpreter extends BitcoinSLogger {
|
||||||
private def logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicates the element on top of the stack
|
* Duplicates the element on top of the stack
|
||||||
|
|
|
@ -1,45 +1,5 @@
|
||||||
bitcoin-s {
|
bitcoin-s {
|
||||||
datadir = ${HOME}/.bitcoin-s
|
|
||||||
network = regtest # regtest, testnet3, mainnet
|
network = regtest # regtest, testnet3, mainnet
|
||||||
|
|
||||||
logging {
|
|
||||||
# Ignore bitcoin-s logging config and use a logback config
|
|
||||||
logback = false
|
|
||||||
|
|
||||||
level = WARN # trace, debug, info, warn, error, off
|
|
||||||
|
|
||||||
# You can also tune specific module loggers.
|
|
||||||
# They each take the same levels as above.
|
|
||||||
# If they are commented out (as they are
|
|
||||||
# by default), `logging.level` gets used
|
|
||||||
# instead.
|
|
||||||
# The available loggers are:
|
|
||||||
|
|
||||||
# incoming and outgoing P2P messages
|
|
||||||
# p2p = info
|
|
||||||
|
|
||||||
# verification of block headers, merkle trees
|
|
||||||
# chain-verification = info
|
|
||||||
|
|
||||||
# generation of addresses, signing of TXs
|
|
||||||
# key-handling = info
|
|
||||||
|
|
||||||
# wallet operations not related to key management
|
|
||||||
# wallet = info
|
|
||||||
|
|
||||||
# HTTP RPC server
|
|
||||||
# http = info
|
|
||||||
|
|
||||||
# Database interactions
|
|
||||||
# database = info
|
|
||||||
|
|
||||||
# whether or not to write to the log file
|
|
||||||
disable-file = false
|
|
||||||
|
|
||||||
# whether or not to log to stdout
|
|
||||||
disable-console = false
|
|
||||||
}
|
|
||||||
|
|
||||||
node {
|
node {
|
||||||
peers = ["localhost"] # a list of peer addresses in form "hostname:portnumber"
|
peers = ["localhost"] # a list of peer addresses in form "hostname:portnumber"
|
||||||
# (e.g. "neutrino.testnet3.suredbits.com:18333")
|
# (e.g. "neutrino.testnet3.suredbits.com:18333")
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.db
|
||||||
|
|
||||||
import java.nio.file.{Files, Path, Paths}
|
import java.nio.file.{Files, Path, Paths}
|
||||||
|
|
||||||
import ch.qos.logback.classic.Level
|
|
||||||
import com.typesafe.config._
|
import com.typesafe.config._
|
||||||
import org.bitcoins.core.config._
|
import org.bitcoins.core.config._
|
||||||
import org.bitcoins.core.protocol.blockchain.ChainParams
|
import org.bitcoins.core.protocol.blockchain.ChainParams
|
||||||
|
@ -10,7 +9,7 @@ import org.bitcoins.core.util.{BitcoinSLogger, StartStopAsync}
|
||||||
import slick.basic.DatabaseConfig
|
import slick.basic.DatabaseConfig
|
||||||
import slick.jdbc.JdbcProfile
|
import slick.jdbc.JdbcProfile
|
||||||
|
|
||||||
import scala.concurrent.{Future}
|
import scala.concurrent.Future
|
||||||
import scala.util.matching.Regex
|
import scala.util.matching.Regex
|
||||||
import scala.util.{Failure, Properties, Success, Try}
|
import scala.util.{Failure, Properties, Success, Try}
|
||||||
|
|
||||||
|
@ -21,9 +20,7 @@ import scala.util.{Failure, Properties, Success, Try}
|
||||||
* @see [[https://github.com/bitcoin-s/bitcoin-s-core/blob/master/doc/configuration.md `configuration.md`]]
|
* @see [[https://github.com/bitcoin-s/bitcoin-s-core/blob/master/doc/configuration.md `configuration.md`]]
|
||||||
* for more information.
|
* for more information.
|
||||||
*/
|
*/
|
||||||
abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
abstract class AppConfig extends StartStopAsync[Unit] with BitcoinSLogger {
|
||||||
|
|
||||||
private val logger = BitcoinSLogger.logger
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts this project.
|
* Starts this project.
|
||||||
|
@ -73,7 +70,7 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
||||||
|
|
||||||
val numOverrides = configs.length + 1
|
val numOverrides = configs.length + 1
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.logger.isDebugEnabled()) {
|
||||||
// force lazy evaluation before we print
|
// force lazy evaluation before we print
|
||||||
// our lines
|
// our lines
|
||||||
val oldConfStr = this.config.asReadableJson
|
val oldConfStr = this.config.asReadableJson
|
||||||
|
@ -84,7 +81,7 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
||||||
}
|
}
|
||||||
|
|
||||||
val configOverrides = firstOverride +: configs
|
val configOverrides = firstOverride +: configs
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.logger.isTraceEnabled()) {
|
||||||
configOverrides.zipWithIndex.foreach {
|
configOverrides.zipWithIndex.foreach {
|
||||||
case (c, idx) => logger.trace(s"Override no. $idx: ${c.asReadableJson}")
|
case (c, idx) => logger.trace(s"Override no. $idx: ${c.asReadableJson}")
|
||||||
}
|
}
|
||||||
|
@ -102,7 +99,7 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
||||||
}
|
}
|
||||||
|
|
||||||
// to avoid non-necessary lazy load
|
// to avoid non-necessary lazy load
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.logger.isDebugEnabled()) {
|
||||||
// force lazy load before we print
|
// force lazy load before we print
|
||||||
val newConfStr = newConf.config.asReadableJson
|
val newConfStr = newConf.config.asReadableJson
|
||||||
|
|
||||||
|
@ -158,76 +155,6 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
||||||
baseDatadir.resolve(lastDirname)
|
baseDatadir.resolve(lastDirname)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val logLocation: Path = {
|
|
||||||
val path = datadir
|
|
||||||
// Set property for loggers
|
|
||||||
System.setProperty("bitcoins.log.location", path.toAbsolutePath.toString)
|
|
||||||
path
|
|
||||||
}
|
|
||||||
|
|
||||||
private def stringToLogLevel(str: String): Option[Level] =
|
|
||||||
str.toLowerCase() match {
|
|
||||||
case "trace" => Some(Level.TRACE)
|
|
||||||
case "debug" => Some(Level.DEBUG)
|
|
||||||
case "info" => Some(Level.INFO)
|
|
||||||
case "warn" => Some(Level.WARN)
|
|
||||||
case "error" => Some(Level.ERROR)
|
|
||||||
case "off" => Some(Level.OFF)
|
|
||||||
case _: String => None
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The default logging level */
|
|
||||||
lazy val logLevel: Level = {
|
|
||||||
val levelString = config.getString("logging.level")
|
|
||||||
stringToLogLevel(levelString).getOrElse(
|
|
||||||
throw new ConfigException.WrongType(
|
|
||||||
config.origin(),
|
|
||||||
s"logging.level ($levelString) is not a valid logging level"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Whether or not we should log to file */
|
|
||||||
lazy val disableFileLogging = config.getBoolean("logging.disable-file")
|
|
||||||
|
|
||||||
/** Whether or not we should log to stdout */
|
|
||||||
lazy val disableConsoleLogging = config.getBoolean("logging.disable-console")
|
|
||||||
|
|
||||||
private def levelOrDefault(key: String): Level =
|
|
||||||
config
|
|
||||||
.getStringOrNone(key) match {
|
|
||||||
case None => logLevel
|
|
||||||
case Some(levelStr) =>
|
|
||||||
stringToLogLevel(levelStr).getOrElse {
|
|
||||||
throw new ConfigException.WrongType(
|
|
||||||
config.origin(),
|
|
||||||
s"$key ($levelStr) is not a valid logging level")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The logging level for our P2P logger */
|
|
||||||
override lazy val p2pLogLevel: Level = levelOrDefault("logging.p2p")
|
|
||||||
|
|
||||||
/** The logging level for our chain verification logger */
|
|
||||||
override lazy val verificationLogLevel: Level =
|
|
||||||
levelOrDefault("logging.chain-verification")
|
|
||||||
|
|
||||||
/** The logging level for our key handling logger */
|
|
||||||
override lazy val keyHandlingLogLevel: Level =
|
|
||||||
levelOrDefault("logging.key-handling")
|
|
||||||
|
|
||||||
/** Logging level for wallet */
|
|
||||||
override lazy val walletLogLevel: Level =
|
|
||||||
levelOrDefault("logging.wallet")
|
|
||||||
|
|
||||||
/** Logging level for HTTP RPC server */
|
|
||||||
override lazy val httpLogLevel: Level = levelOrDefault("logging.http")
|
|
||||||
|
|
||||||
/** Logging level for database interactions */
|
|
||||||
override lazy val databaseLogLevel: Level = levelOrDefault("logging.database")
|
|
||||||
|
|
||||||
/** Use logback config instead */
|
|
||||||
override val useLogbackConf: Boolean =
|
|
||||||
config.getBooleanOrElse("logging.logback", default = false)
|
|
||||||
|
|
||||||
lazy val slickDbConfig: DatabaseConfig[JdbcProfile] = {
|
lazy val slickDbConfig: DatabaseConfig[JdbcProfile] = {
|
||||||
Try {
|
Try {
|
||||||
DatabaseConfig.forConfig[JdbcProfile](path = moduleName, config = config)
|
DatabaseConfig.forConfig[JdbcProfile](path = moduleName, config = config)
|
||||||
|
|
|
@ -91,44 +91,6 @@ bitcoin-s {
|
||||||
datadir = ${HOME}/.bitcoin-s
|
datadir = ${HOME}/.bitcoin-s
|
||||||
network = regtest # regtest, testnet3, mainnet
|
network = regtest # regtest, testnet3, mainnet
|
||||||
|
|
||||||
logging {
|
|
||||||
# Ignore bitcoin-s logging config and use a logback config
|
|
||||||
logback = false
|
|
||||||
|
|
||||||
level = WARN # trace, debug, info, warn, error, off
|
|
||||||
|
|
||||||
# You can also tune specific module loggers.
|
|
||||||
# They each take the same levels as above.
|
|
||||||
# If they are commented out (as they are
|
|
||||||
# by default), `logging.level` gets used
|
|
||||||
# instead.
|
|
||||||
# The available loggers are:
|
|
||||||
|
|
||||||
# incoming and outgoing P2P messages
|
|
||||||
# p2p = info
|
|
||||||
|
|
||||||
# verification of block headers, merkle trees
|
|
||||||
# chain-verification = info
|
|
||||||
|
|
||||||
# generation of addresses, signing of TXs
|
|
||||||
# key-handling = info
|
|
||||||
|
|
||||||
# wallet operations not related to key management
|
|
||||||
# wallet = info
|
|
||||||
|
|
||||||
# HTTP RPC server
|
|
||||||
# http = info
|
|
||||||
|
|
||||||
# Database interactions
|
|
||||||
# database = info
|
|
||||||
|
|
||||||
# whether or not to write to the log file
|
|
||||||
disable-file = false
|
|
||||||
|
|
||||||
# whether or not to log to stdout
|
|
||||||
disable-console = false
|
|
||||||
}
|
|
||||||
|
|
||||||
node {
|
node {
|
||||||
mode = neutrino # neutrino, spv
|
mode = neutrino # neutrino, spv
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
package org.bitcoins.keymanager
|
package org.bitcoins.keymanager
|
||||||
|
|
||||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
import grizzled.slf4j.Logging
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
/** Exposes access to the key manager logger */
|
/** Exposes access to the key manager logger */
|
||||||
private[bitcoins] trait KeyManagerLogger {
|
private[bitcoins] trait KeyManagerLogger extends Logging
|
||||||
|
|
||||||
protected[bitcoins] def logger(implicit config: LoggerConfig): Logger = {
|
|
||||||
KeyManagerLoggerImpl(config).getLogger
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private[keymanager] case class KeyManagerLoggerImpl(
|
|
||||||
override val conf: LoggerConfig)
|
|
||||||
extends AppLoggers {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the generic Key Manager logger (i.e. everything related to secret keys)
|
|
||||||
*/
|
|
||||||
def getLogger: Logger =
|
|
||||||
getLoggerImpl(LoggerKind.KeyHandling)
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.bitcoins.core.config.TestNet3
|
||||||
import com.typesafe.config.ConfigFactory
|
import com.typesafe.config.ConfigFactory
|
||||||
import org.bitcoins.core.config.RegTest
|
import org.bitcoins.core.config.RegTest
|
||||||
import org.bitcoins.core.config.MainNet
|
import org.bitcoins.core.config.MainNet
|
||||||
import ch.qos.logback.classic.Level
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
import scala.concurrent.Await
|
import scala.concurrent.Await
|
||||||
|
@ -64,8 +63,6 @@ class NodeAppConfigTest extends BitcoinSAsyncTest {
|
||||||
|
|
||||||
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
||||||
assert(appConfig.network == TestNet3)
|
assert(appConfig.network == TestNet3)
|
||||||
assert(appConfig.logLevel == Level.OFF)
|
|
||||||
assert(appConfig.p2pLogLevel == Level.WARN)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def afterAll(): Unit = {
|
override def afterAll(): Unit = {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package org.bitcoins.node
|
package org.bitcoins.node
|
||||||
|
|
||||||
|
import grizzled.slf4j.Logger
|
||||||
import org.bitcoins.core.api.{Callback, Callback2, CallbackHandler}
|
import org.bitcoins.core.api.{Callback, Callback2, CallbackHandler}
|
||||||
import org.bitcoins.core.gcs.GolombFilter
|
import org.bitcoins.core.gcs.GolombFilter
|
||||||
import org.bitcoins.core.protocol.blockchain.{Block, BlockHeader, MerkleBlock}
|
import org.bitcoins.core.protocol.blockchain.{Block, BlockHeader, MerkleBlock}
|
||||||
import org.bitcoins.core.protocol.transaction.Transaction
|
import org.bitcoins.core.protocol.transaction.Transaction
|
||||||
import org.bitcoins.crypto.DoubleSha256Digest
|
import org.bitcoins.crypto.DoubleSha256Digest
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
import scala.concurrent.{ExecutionContext, Future}
|
import scala.concurrent.{ExecutionContext, Future}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
package org.bitcoins.node
|
package org.bitcoins.node
|
||||||
|
|
||||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
import grizzled.slf4j.Logging
|
||||||
import org.bitcoins.node.config.NodeAppConfig
|
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
/** Exposes access to the P2P submodule logger */
|
/** Exposes access to the P2P submodule logger */
|
||||||
private[bitcoins] trait P2PLogger {
|
private[bitcoins] trait P2PLogger extends Logging
|
||||||
|
|
||||||
protected def logger(implicit config: NodeAppConfig): Logger = {
|
|
||||||
P2PLoggerImpl(config).getLogger
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private[node] case class P2PLoggerImpl(override val conf: LoggerConfig)
|
|
||||||
extends AppLoggers {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the peer-to-peer submobule logger
|
|
||||||
*/
|
|
||||||
def getLogger: Logger =
|
|
||||||
getLoggerImpl(LoggerKind.P2P)
|
|
||||||
}
|
|
||||||
|
|
|
@ -79,8 +79,7 @@ case class SpvNode(
|
||||||
peerMsgSender <- peerMsgSenderF
|
peerMsgSender <- peerMsgSenderF
|
||||||
_ <- peerMsgSender.sendFilterLoadMessage(bloomFilter)
|
_ <- peerMsgSender.sendFilterLoadMessage(bloomFilter)
|
||||||
} yield {
|
} yield {
|
||||||
logger(nodeAppConfig).info(
|
logger.info(s"Sending bloomfilter=${bloomFilter.hex} to $peer")
|
||||||
s"Sending bloomfilter=${bloomFilter.hex} to $peer")
|
|
||||||
logger.info(s"Sending bloomfilter=${bloomFilter.hex} to $peer")
|
logger.info(s"Sending bloomfilter=${bloomFilter.hex} to $peer")
|
||||||
node
|
node
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,8 +354,8 @@ object P2PClient extends P2PLogger {
|
||||||
* @param bytes the bytes that need to be parsed into individual messages
|
* @param bytes the bytes that need to be parsed into individual messages
|
||||||
* @return the parsed [[NetworkMessage]]'s and the unaligned bytes that did not parse to a message
|
* @return the parsed [[NetworkMessage]]'s and the unaligned bytes that did not parse to a message
|
||||||
*/
|
*/
|
||||||
private[bitcoins] def parseIndividualMessages(bytes: ByteVector)(implicit
|
private[bitcoins] def parseIndividualMessages(
|
||||||
conf: NodeAppConfig): (List[NetworkMessage], ByteVector) = {
|
bytes: ByteVector): (List[NetworkMessage], ByteVector) = {
|
||||||
@tailrec
|
@tailrec
|
||||||
def loop(
|
def loop(
|
||||||
remainingBytes: ByteVector,
|
remainingBytes: ByteVector,
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package org.bitcoins.node.networking.peer
|
package org.bitcoins.node.networking.peer
|
||||||
|
|
||||||
|
import org.bitcoins.core.protocol.blockchain.MerkleBlock
|
||||||
|
import org.bitcoins.core.protocol.transaction.Transaction
|
||||||
import org.bitcoins.node.{NodeCallbacks, P2PLogger}
|
import org.bitcoins.node.{NodeCallbacks, P2PLogger}
|
||||||
|
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import org.bitcoins.core.protocol.blockchain.MerkleBlock
|
|
||||||
import org.bitcoins.core.protocol.transaction.Transaction
|
|
||||||
import org.bitcoins.node.config.NodeAppConfig
|
|
||||||
|
|
||||||
import scala.concurrent.{ExecutionContext, Future}
|
import scala.concurrent.{ExecutionContext, Future}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +26,7 @@ private[peer] object MerkleBuffers extends P2PLogger {
|
||||||
private val underlyingMap: MerkleBlocksWithTransactions = mutable.Map.empty
|
private val underlyingMap: MerkleBlocksWithTransactions = mutable.Map.empty
|
||||||
|
|
||||||
/** Adds the given merkleblock to the buffer */
|
/** Adds the given merkleblock to the buffer */
|
||||||
def putMerkle(merkle: MerkleBlock)(implicit config: NodeAppConfig): Unit = {
|
def putMerkle(merkle: MerkleBlock): Unit = {
|
||||||
val tree = merkle.partialMerkleTree
|
val tree = merkle.partialMerkleTree
|
||||||
val matches = tree.extractMatches
|
val matches = tree.extractMatches
|
||||||
|
|
||||||
|
@ -60,8 +58,7 @@ private[peer] object MerkleBuffers extends P2PLogger {
|
||||||
* Otherwise, false.
|
* Otherwise, false.
|
||||||
*/
|
*/
|
||||||
def putTx(tx: Transaction, callbacks: NodeCallbacks)(implicit
|
def putTx(tx: Transaction, callbacks: NodeCallbacks)(implicit
|
||||||
ec: ExecutionContext,
|
ec: ExecutionContext): Future[Boolean] = {
|
||||||
config: NodeAppConfig): Future[Boolean] = {
|
|
||||||
val blocksInBuffer = underlyingMap.keys.toList
|
val blocksInBuffer = underlyingMap.keys.toList
|
||||||
logger.trace(s"Looking for transaction=${tx.txIdBE} in merkleblock buffer")
|
logger.trace(s"Looking for transaction=${tx.txIdBE} in merkleblock buffer")
|
||||||
logger.trace(s"Merkleblocks in buffer: ${blocksInBuffer.length}")
|
logger.trace(s"Merkleblocks in buffer: ${blocksInBuffer.length}")
|
||||||
|
@ -87,8 +84,7 @@ private[peer] object MerkleBuffers extends P2PLogger {
|
||||||
transaction: Transaction,
|
transaction: Transaction,
|
||||||
merkleBlock: MerkleBlock,
|
merkleBlock: MerkleBlock,
|
||||||
callbacks: NodeCallbacks)(implicit
|
callbacks: NodeCallbacks)(implicit
|
||||||
ec: ExecutionContext,
|
ec: ExecutionContext): Future[Boolean] = {
|
||||||
config: NodeAppConfig): Future[Boolean] = {
|
|
||||||
val merkleBlockMatches = merkleBlock.partialMerkleTree.extractMatches
|
val merkleBlockMatches = merkleBlock.partialMerkleTree.extractMatches
|
||||||
val merkleHash = merkleBlock.blockHeader.hashBE
|
val merkleHash = merkleBlock.blockHeader.hashBE
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ object Deps {
|
||||||
object V {
|
object V {
|
||||||
val bouncyCastle = "1.66"
|
val bouncyCastle = "1.66"
|
||||||
val logback = "1.2.3"
|
val logback = "1.2.3"
|
||||||
|
val grizzledSlf4j = "1.3.4"
|
||||||
val scalacheck = "1.14.3"
|
val scalacheck = "1.14.3"
|
||||||
val scalaTest = "3.2.2"
|
val scalaTest = "3.2.2"
|
||||||
|
|
||||||
|
@ -129,6 +130,10 @@ object Deps {
|
||||||
|
|
||||||
val logback =
|
val logback =
|
||||||
"ch.qos.logback" % "logback-classic" % V.logback withSources () withJavadoc ()
|
"ch.qos.logback" % "logback-classic" % V.logback withSources () withJavadoc ()
|
||||||
|
|
||||||
|
val grizzledSlf4j =
|
||||||
|
"org.clapper" %% "grizzled-slf4j" % V.grizzledSlf4j withSources () withJavadoc ()
|
||||||
|
|
||||||
val codehaus = "org.codehaus.janino" % "janino" % V.codehausV
|
val codehaus = "org.codehaus.janino" % "janino" % V.codehausV
|
||||||
|
|
||||||
//for loading secp256k1 natively
|
//for loading secp256k1 natively
|
||||||
|
@ -177,6 +182,7 @@ object Deps {
|
||||||
val junitInterface =
|
val junitInterface =
|
||||||
"com.novocode" % "junit-interface" % V.junitV % "test" withSources () withJavadoc ()
|
"com.novocode" % "junit-interface" % V.junitV % "test" withSources () withJavadoc ()
|
||||||
val logback = Compile.logback % "test"
|
val logback = Compile.logback % "test"
|
||||||
|
val grizzledSlf4j = Compile.grizzledSlf4j % "test"
|
||||||
val scalacheck = Compile.scalacheck % "test"
|
val scalacheck = Compile.scalacheck % "test"
|
||||||
val scalaTest = Compile.scalaTest % "test"
|
val scalaTest = Compile.scalaTest % "test"
|
||||||
val scalaMock = "org.scalamock" %% "scalamock" % V.scalamockV
|
val scalaMock = "org.scalamock" %% "scalamock" % V.scalamockV
|
||||||
|
@ -219,7 +225,8 @@ object Deps {
|
||||||
val core = List(
|
val core = List(
|
||||||
Compile.bouncycastle,
|
Compile.bouncycastle,
|
||||||
Compile.scodec,
|
Compile.scodec,
|
||||||
Compile.slf4j
|
Compile.slf4j,
|
||||||
|
Compile.grizzledSlf4j
|
||||||
)
|
)
|
||||||
|
|
||||||
val crypto = List(
|
val crypto = List(
|
||||||
|
|
|
@ -103,5 +103,9 @@
|
||||||
|
|
||||||
<!-- get rid of "Slf4jLogger started" messages -->
|
<!-- get rid of "Slf4jLogger started" messages -->
|
||||||
<logger name="akka.event.slf4j.Slf4jLogger" level="OFF"/>
|
<logger name="akka.event.slf4j.Slf4jLogger" level="OFF"/>
|
||||||
|
<logger name="akka.event.event.EventStream" level="OFF"/>
|
||||||
|
|
||||||
|
<!-- get rid of "Setting level of logger" messages -->
|
||||||
|
<logger name="ch.qos.logback" level="OFF"/>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
|
@ -2,44 +2,6 @@ bitcoin-s {
|
||||||
datadir = ${HOME}/.bitcoin-s
|
datadir = ${HOME}/.bitcoin-s
|
||||||
network = regtest # regtest, testnet3, mainnet
|
network = regtest # regtest, testnet3, mainnet
|
||||||
|
|
||||||
logging {
|
|
||||||
# Ignore bitcoin-s logging config and use a logback config
|
|
||||||
logback = true
|
|
||||||
|
|
||||||
level = OFF # trace, debug, info, warn, error, off
|
|
||||||
|
|
||||||
# You can also tune specific module loggers.
|
|
||||||
# They each take the same levels as above.
|
|
||||||
# If they are commented out (as they are
|
|
||||||
# by default), `logging.level` gets used
|
|
||||||
# instead.
|
|
||||||
# The available loggers are:
|
|
||||||
|
|
||||||
# incoming and outgoing P2P messages
|
|
||||||
# p2p = info
|
|
||||||
|
|
||||||
# verification of block headers, merkle trees
|
|
||||||
# chain-verification = info
|
|
||||||
|
|
||||||
# generation of addresses, signing of TXs
|
|
||||||
# key-handling = info
|
|
||||||
|
|
||||||
# wallet operations not related to key management
|
|
||||||
# wallet = info
|
|
||||||
|
|
||||||
# HTTP RPC server
|
|
||||||
# http = info
|
|
||||||
|
|
||||||
# Database interactions
|
|
||||||
# database = info
|
|
||||||
|
|
||||||
# whether or not to write to the log file
|
|
||||||
disable-file = false
|
|
||||||
|
|
||||||
# whether or not to log to stdout
|
|
||||||
disable-console = false
|
|
||||||
}
|
|
||||||
|
|
||||||
node {
|
node {
|
||||||
mode = neutrino # neutrino, spv
|
mode = neutrino # neutrino, spv
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ import scala.concurrent.{ExecutionContext, Future}
|
||||||
trait ChainUnitTest
|
trait ChainUnitTest
|
||||||
extends BitcoinSFixture
|
extends BitcoinSFixture
|
||||||
with ChainFixtureHelper
|
with ChainFixtureHelper
|
||||||
with ChainVerificationLogger
|
|
||||||
with CachedChainAppConfig {
|
with CachedChainAppConfig {
|
||||||
|
|
||||||
implicit lazy val appConfig: ChainAppConfig =
|
implicit lazy val appConfig: ChainAppConfig =
|
||||||
|
@ -639,9 +638,7 @@ object ChainUnitTest extends ChainVerificationLogger {
|
||||||
|
|
||||||
/** Syncs the given chain handler to the given bitcoind */
|
/** Syncs the given chain handler to the given bitcoind */
|
||||||
def syncFromBitcoind(bitcoind: BitcoindRpcClient, chainHandler: ChainHandler)(
|
def syncFromBitcoind(bitcoind: BitcoindRpcClient, chainHandler: ChainHandler)(
|
||||||
implicit
|
implicit ec: ExecutionContext): Future[ChainApi] = {
|
||||||
ec: ExecutionContext,
|
|
||||||
chainAppConfig: ChainAppConfig): Future[ChainApi] = {
|
|
||||||
//sync headers
|
//sync headers
|
||||||
//first we need to implement the 'getBestBlockHashFunc' and 'getBlockHeaderFunc' functions
|
//first we need to implement the 'getBestBlockHashFunc' and 'getBlockHeaderFunc' functions
|
||||||
val getBestBlockHashFunc = { () =>
|
val getBestBlockHashFunc = { () =>
|
||||||
|
|
|
@ -39,7 +39,6 @@ trait TestDbManagement extends DbManagement {
|
||||||
|
|
||||||
case class TestAppConfig(
|
case class TestAppConfig(
|
||||||
private val directory: Path,
|
private val directory: Path,
|
||||||
override val useLogbackConf: Boolean,
|
|
||||||
private val conf: Config*)(implicit override val ec: ExecutionContext)
|
private val conf: Config*)(implicit override val ec: ExecutionContext)
|
||||||
extends AppConfig
|
extends AppConfig
|
||||||
with TestDbManagement
|
with TestDbManagement
|
||||||
|
@ -52,7 +51,7 @@ case class TestAppConfig(
|
||||||
|
|
||||||
override protected[bitcoins] def newConfigOfType(
|
override protected[bitcoins] def newConfigOfType(
|
||||||
configs: Seq[Config]): TestAppConfig =
|
configs: Seq[Config]): TestAppConfig =
|
||||||
TestAppConfig(directory, useLogbackConf, configs: _*)
|
TestAppConfig(directory, configs: _*)
|
||||||
|
|
||||||
protected[bitcoins] def baseDatadir: Path = directory
|
protected[bitcoins] def baseDatadir: Path = directory
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ sealed trait TestDAOFixture
|
||||||
|
|
||||||
implicit private val testConfig: TestAppConfig = TestAppConfig(
|
implicit private val testConfig: TestAppConfig = TestAppConfig(
|
||||||
BitcoinSTestAppConfig.tmpDir(),
|
BitcoinSTestAppConfig.tmpDir(),
|
||||||
useLogbackConf = true,
|
|
||||||
BitcoinSTestAppConfig.configWithEmbeddedDb(Some(ProjectType.Test), pgUrl))
|
BitcoinSTestAppConfig.configWithEmbeddedDb(Some(ProjectType.Test), pgUrl))
|
||||||
|
|
||||||
override def beforeAll(): Unit = {
|
override def beforeAll(): Unit = {
|
||||||
|
|
|
@ -363,8 +363,7 @@ object NodeUnitTest extends P2PLogger {
|
||||||
nodeConnectedWithBitcoind: NodeConnectedWithBitcoind)(implicit
|
nodeConnectedWithBitcoind: NodeConnectedWithBitcoind)(implicit
|
||||||
system: ActorSystem,
|
system: ActorSystem,
|
||||||
appConfig: BitcoinSAppConfig): Future[Unit] = {
|
appConfig: BitcoinSAppConfig): Future[Unit] = {
|
||||||
logger(appConfig.nodeConf)
|
logger.debug(s"Beginning tear down of node connected with bitcoind")
|
||||||
.debug(s"Beggining tear down of node connected with bitcoind")
|
|
||||||
import system.dispatcher
|
import system.dispatcher
|
||||||
val node = nodeConnectedWithBitcoind.node
|
val node = nodeConnectedWithBitcoind.node
|
||||||
val bitcoind = nodeConnectedWithBitcoind.bitcoind
|
val bitcoind = nodeConnectedWithBitcoind.bitcoind
|
||||||
|
@ -372,8 +371,7 @@ object NodeUnitTest extends P2PLogger {
|
||||||
_ <- destroyNode(node)
|
_ <- destroyNode(node)
|
||||||
_ <- ChainUnitTest.destroyBitcoind(bitcoind)
|
_ <- ChainUnitTest.destroyBitcoind(bitcoind)
|
||||||
} yield {
|
} yield {
|
||||||
logger(appConfig.nodeConf)
|
logger.debug(s"Done with teardown of node connected with bitcoind!")
|
||||||
.debug(s"Done with teardown of node connected with bitcoind!")
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,7 @@ import org.scalatest._
|
||||||
import scala.concurrent._
|
import scala.concurrent._
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
trait BitcoinSWalletTest
|
trait BitcoinSWalletTest extends BitcoinSFixture with EmbeddedPg {
|
||||||
extends BitcoinSFixture
|
|
||||||
with WalletLogger
|
|
||||||
with EmbeddedPg {
|
|
||||||
import BitcoinSWalletTest._
|
import BitcoinSWalletTest._
|
||||||
|
|
||||||
/** Wallet config with data directory set to user temp directory */
|
/** Wallet config with data directory set to user temp directory */
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.wallet
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
import ch.qos.logback.classic.Level
|
|
||||||
import com.typesafe.config.ConfigFactory
|
import com.typesafe.config.ConfigFactory
|
||||||
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
||||||
import org.bitcoins.core.hd.HDPurposes
|
import org.bitcoins.core.hd.HDPurposes
|
||||||
|
@ -96,7 +95,5 @@ class WalletAppConfigTest extends BitcoinSAsyncTest {
|
||||||
|
|
||||||
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
||||||
assert(appConfig.network == TestNet3)
|
assert(appConfig.network == TestNet3)
|
||||||
assert(appConfig.logLevel == Level.OFF)
|
|
||||||
assert(appConfig.p2pLogLevel == Level.WARN)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -630,9 +630,7 @@ object Wallet extends WalletLogger {
|
||||||
|
|
||||||
/** Creates the level 0 account for the given HD purpose, if the root account exists do nothing */
|
/** Creates the level 0 account for the given HD purpose, if the root account exists do nothing */
|
||||||
private def createRootAccount(wallet: Wallet, keyManager: BIP39KeyManager)(
|
private def createRootAccount(wallet: Wallet, keyManager: BIP39KeyManager)(
|
||||||
implicit
|
implicit ec: ExecutionContext): Future[AccountDb] = {
|
||||||
walletAppConfig: WalletAppConfig,
|
|
||||||
ec: ExecutionContext): Future[AccountDb] = {
|
|
||||||
val coinType = HDUtil.getCoinType(keyManager.kmParams.network)
|
val coinType = HDUtil.getCoinType(keyManager.kmParams.network)
|
||||||
val coin =
|
val coin =
|
||||||
HDCoin(purpose = keyManager.kmParams.purpose, coinType = coinType)
|
HDCoin(purpose = keyManager.kmParams.purpose, coinType = coinType)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.bitcoins.wallet
|
package org.bitcoins.wallet
|
||||||
|
|
||||||
|
import grizzled.slf4j.Logger
|
||||||
import org.bitcoins.core.api.wallet.db.SpendingInfoDb
|
import org.bitcoins.core.api.wallet.db.SpendingInfoDb
|
||||||
import org.bitcoins.core.api.{Callback, CallbackHandler}
|
import org.bitcoins.core.api.{Callback, CallbackHandler}
|
||||||
import org.bitcoins.core.protocol.BitcoinAddress
|
import org.bitcoins.core.protocol.BitcoinAddress
|
||||||
import org.bitcoins.core.protocol.transaction.Transaction
|
import org.bitcoins.core.protocol.transaction.Transaction
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
import scala.concurrent.{ExecutionContext, Future}
|
import scala.concurrent.{ExecutionContext, Future}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,6 @@
|
||||||
package org.bitcoins.wallet
|
package org.bitcoins.wallet
|
||||||
|
|
||||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
import grizzled.slf4j.Logging
|
||||||
import org.slf4j.Logger
|
|
||||||
|
|
||||||
/** Exposes acccess to the wallet logger */
|
/** Exposes acccess to the wallet logger */
|
||||||
private[bitcoins] trait WalletLogger {
|
private[bitcoins] trait WalletLogger extends Logging
|
||||||
|
|
||||||
protected[bitcoins] def logger(implicit config: LoggerConfig): Logger = {
|
|
||||||
WalletLoggerImpl(config).getLogger
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private[wallet] case class WalletLoggerImpl(override val conf: LoggerConfig)
|
|
||||||
extends AppLoggers {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the generic wallet logger (i.e. everything not related to key handling)
|
|
||||||
*/
|
|
||||||
def getLogger: Logger =
|
|
||||||
getLoggerImpl(LoggerKind.Wallet)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue