mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 02:39:18 +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>
|
||||
<!-- 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"/>
|
||||
|
||||
<configuration scan="true" scanPeriod="15 seconds" >
|
||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<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="FILE"/>
|
||||
</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>
|
|
@ -1,22 +1,6 @@
|
|||
package org.bitcoins.server
|
||||
|
||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
||||
import org.slf4j.Logger
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
/** Exposes access to the HTTP RPC server logger */
|
||||
private[bitcoins] trait HttpLogger {
|
||||
|
||||
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)
|
||||
}
|
||||
private[bitcoins] trait HttpLogger extends Logging
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.bitcoins.chain.models.{
|
|||
import org.bitcoins.core.Core
|
||||
import org.bitcoins.core.api.chain.ChainApi
|
||||
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.feeprovider.BitcoinerLiveFeeRateProvider
|
||||
import org.bitcoins.node._
|
||||
|
@ -28,7 +28,7 @@ import org.bitcoins.wallet.config.WalletAppConfig
|
|||
import scala.concurrent.{ExecutionContext, Future, Promise}
|
||||
import scala.util.Properties
|
||||
|
||||
object Main extends App with BitcoinSLogger {
|
||||
object Main extends App with HttpLogger {
|
||||
|
||||
def runMain(args: Vector[String]): Future[Unit] = {
|
||||
val argsWithIndex = args.zipWithIndex
|
||||
|
@ -105,8 +105,6 @@ object Main extends App with BitcoinSLogger {
|
|||
val forceChainWorkRecalc: Boolean =
|
||||
args.exists(_.toLowerCase == "--force-recalc-chainwork")
|
||||
|
||||
val logger = HttpLoggerImpl(conf.nodeConf).getLogger
|
||||
|
||||
implicit val walletConf: WalletAppConfig = conf.walletConf
|
||||
implicit val nodeConf: NodeAppConfig = conf.nodeConf
|
||||
implicit val chainConf: ChainAppConfig = conf.chainConf
|
||||
|
|
|
@ -18,7 +18,6 @@ case class Server(
|
|||
handlers: Seq[ServerRoute],
|
||||
rpcport: Int = 9999)(implicit system: ActorSystem)
|
||||
extends HttpLogger {
|
||||
implicit private val config: AppConfig = conf
|
||||
|
||||
import system.dispatcher
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.chain.config
|
|||
|
||||
import java.nio.file.Files
|
||||
|
||||
import ch.qos.logback.classic.Level
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
||||
import org.bitcoins.testkit.chain.ChainUnitTest
|
||||
|
@ -77,8 +76,6 @@ class ChainAppConfigTest extends ChainUnitTest {
|
|||
|
||||
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
||||
assert(appConfig.network == TestNet3)
|
||||
assert(appConfig.logLevel == Level.OFF)
|
||||
assert(appConfig.p2pLogLevel == Level.WARN)
|
||||
}
|
||||
|
||||
override def afterAll: Unit = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.chain
|
||||
|
||||
import grizzled.slf4j.Logger
|
||||
import org.bitcoins.core.api.{Callback2, CallbackHandler}
|
||||
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
||||
import org.slf4j.Logger
|
||||
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
package org.bitcoins.chain
|
||||
|
||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
||||
import org.slf4j.Logger
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
/** Exposes access to the chain verification logger */
|
||||
private[bitcoins] trait ChainVerificationLogger {
|
||||
|
||||
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)
|
||||
}
|
||||
private[bitcoins] trait ChainVerificationLogger extends Logging
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.chain.blockchain.sync
|
|||
|
||||
import org.bitcoins.chain.ChainVerificationLogger
|
||||
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.db.BlockHeaderDb
|
||||
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
||||
|
@ -25,8 +24,7 @@ abstract class ChainSync extends ChainVerificationLogger {
|
|||
chainHandler: ChainHandler,
|
||||
getBlockHeaderFunc: DoubleSha256DigestBE => Future[BlockHeader],
|
||||
getBestBlockHashFunc: () => Future[DoubleSha256DigestBE])(implicit
|
||||
ec: ExecutionContext,
|
||||
conf: ChainAppConfig): Future[ChainApi] = {
|
||||
ec: ExecutionContext): Future[ChainApi] = {
|
||||
val currentTipsF: Future[Vector[BlockHeaderDb]] = {
|
||||
chainHandler.blockHeaderDAO.chainTips
|
||||
}
|
||||
|
@ -69,8 +67,7 @@ abstract class ChainSync extends ChainVerificationLogger {
|
|||
tips: Vector[BlockHeaderDb],
|
||||
bestBlockHash: DoubleSha256DigestBE,
|
||||
getBlockHeaderFunc: DoubleSha256DigestBE => Future[BlockHeader])(implicit
|
||||
ec: ExecutionContext,
|
||||
conf: ChainAppConfig): Future[ChainApi] = {
|
||||
ec: ExecutionContext): Future[ChainApi] = {
|
||||
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
|
||||
|
|
|
@ -133,8 +133,7 @@ abstract class FilterSync extends ChainVerificationLogger {
|
|||
missingHeaders: Vector[BlockHeaderDb],
|
||||
ourBestFilterHeaderOpt: Option[CompactFilterHeaderDb],
|
||||
getFilterFunc: BlockHeader => Future[FilterWithHeaderHash])(implicit
|
||||
ec: ExecutionContext,
|
||||
chainAppConfig: ChainAppConfig): Future[ChainApi] = {
|
||||
ec: ExecutionContext): Future[ChainApi] = {
|
||||
//now that we have headers that are missing filters, let's fetch the filters
|
||||
|
||||
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
|
||||
*/
|
||||
def chainTipsByHeight: Future[Vector[BlockHeaderDb]] = {
|
||||
logger.debug(s"Getting chain tips from: ${dbConfig.config}")
|
||||
logger.debug(s"Getting chain tips from database")
|
||||
val aggregate = {
|
||||
maxHeightQuery.flatMap { height =>
|
||||
logger.debug(s"Max block height: $height")
|
||||
|
@ -302,7 +302,7 @@ case class BlockHeaderDAO()(implicit
|
|||
}
|
||||
|
||||
def chainTips: Future[Vector[BlockHeaderDb]] = {
|
||||
logger.debug(s"Getting chain tips from: ${dbConfig.config}")
|
||||
logger.debug(s"Getting chain tips from database")
|
||||
val aggregate = {
|
||||
maxWorkQuery.flatMap { 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]] */
|
||||
private def logTipResult(
|
||||
connectTipResult: TipUpdateResult,
|
||||
currentTip: BlockHeaderDb)(implicit conf: ChainAppConfig): Unit = {
|
||||
currentTip: BlockHeaderDb): Unit = {
|
||||
connectTipResult match {
|
||||
case TipUpdateResult.Success(tipDb) =>
|
||||
logger.trace(
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.scalacheck.{Prop, Properties}
|
|||
* Created by chris on 7/25/16.
|
||||
*/
|
||||
class TransactionSignatureCreatorSpec
|
||||
extends Properties("TransactionSignatureCreatorSpec") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
extends Properties("TransactionSignatureCreatorSpec")
|
||||
with BitcoinSLogger {
|
||||
|
||||
property("Must generate a valid signature for a p2pk transaction") =
|
||||
Prop.forAll(TransactionGenerators.signedP2PKTransaction) {
|
||||
|
|
|
@ -9,8 +9,7 @@ import scala.util.Try
|
|||
/**
|
||||
* Created by chris on 6/16/16.
|
||||
*/
|
||||
class UInt32Spec extends Properties("UInt32") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
class UInt32Spec extends Properties("UInt32") with BitcoinSLogger {
|
||||
|
||||
property("serialization symmetry") = {
|
||||
Prop.forAll(NumberGenerator.uInt32s) { uInt32: UInt32 =>
|
||||
|
|
|
@ -6,8 +6,8 @@ import org.scalacheck.{Gen, Prop, Properties}
|
|||
|
||||
import scala.util.Try
|
||||
|
||||
class UInt8Spec extends Properties("UInt8Spec") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
class UInt8Spec extends Properties("UInt8Spec") with BitcoinSLogger {
|
||||
|
||||
property("convert uint8 -> byte -> uint8") = {
|
||||
Prop.forAll(NumberGenerator.uInt8) {
|
||||
case u8: UInt8 =>
|
||||
|
|
|
@ -7,8 +7,9 @@ import org.scalacheck.{Prop, Properties}
|
|||
/**
|
||||
* Created by chris on 6/22/16.
|
||||
*/
|
||||
class P2PKScriptSignatureSpec extends Properties("P2PKSpec") {
|
||||
private def logger = BitcoinSLogger.logger
|
||||
class P2PKScriptSignatureSpec
|
||||
extends Properties("P2PKSpec")
|
||||
with BitcoinSLogger {
|
||||
|
||||
property("Serialization symmetry") =
|
||||
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.scalacheck.{Prop, Properties}
|
||||
|
||||
class ScriptWitnessSpec extends Properties("ScriptWitnessSpec") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
class ScriptWitnessSpec
|
||||
extends Properties("ScriptWitnessSpec")
|
||||
with BitcoinSLogger {
|
||||
|
||||
property("serialization symmetry") = {
|
||||
Prop.forAll(WitnessGenerators.scriptWitness) { scriptWit =>
|
||||
val x = ScriptWitness(scriptWit.stack)
|
||||
|
|
|
@ -7,8 +7,10 @@ import org.scalacheck.{Prop, Properties}
|
|||
/**
|
||||
* Created by chris on 6/24/16.
|
||||
*/
|
||||
class TransactionInputSpec extends Properties("TranactionInputSpec") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
class TransactionInputSpec
|
||||
extends Properties("TranactionInputSpec")
|
||||
with BitcoinSLogger {
|
||||
|
||||
property("Serialization symmetry") = {
|
||||
Prop.forAllNoShrink(TransactionGenerators.input) { 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.scalacheck.{Prop, Properties}
|
||||
|
||||
class HashTypeSpec extends Properties("HashTypeSpec") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
class HashTypeSpec extends Properties("HashTypeSpec") with BitcoinSLogger {
|
||||
|
||||
property("serialization symmetry") = {
|
||||
Prop.forAll(NumberGenerator.int32s) { i32 =>
|
||||
val hashType = HashType.fromBytes(i32.bytes)
|
||||
|
|
|
@ -7,8 +7,7 @@ import org.scalacheck.{Prop, Properties}
|
|||
/**
|
||||
* Created by chris on 6/20/16.
|
||||
*/
|
||||
class NumberUtilSpec extends Properties("NumberUtilSpec") {
|
||||
private val logger = BitcoinSLogger.logger
|
||||
class NumberUtilSpec extends Properties("NumberUtilSpec") with BitcoinSLogger {
|
||||
|
||||
property("Serialization symmetry for BigInt") =
|
||||
Prop.forAll(NumberGenerator.bigInts) { bigInt: BigInt =>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.api
|
||||
|
||||
import grizzled.slf4j.Logger
|
||||
import org.bitcoins.core.util.{FutureUtil, SeqWrapper}
|
||||
import org.slf4j.Logger
|
||||
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
import scala.util.control.NonFatal
|
||||
|
|
|
@ -21,9 +21,7 @@ import scodec.bits.ByteVector
|
|||
* bitcoinj version of this
|
||||
* [[https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Transaction.java#L924-L1008]]
|
||||
*/
|
||||
sealed abstract class TransactionSignatureSerializer {
|
||||
|
||||
private val logger = BitcoinSLogger.logger
|
||||
sealed abstract class TransactionSignatureSerializer extends BitcoinSLogger {
|
||||
|
||||
/**
|
||||
* 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.script.control.OP_RETURN
|
||||
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.fee.FeeUnit
|
||||
import org.bitcoins.core.wallet.signer.BitcoinSigner
|
||||
|
@ -17,7 +17,7 @@ import scala.annotation.tailrec
|
|||
import scala.concurrent.{Await, ExecutionContext, Future}
|
||||
import scala.util.{Failure, Success, Try}
|
||||
|
||||
object TxUtil {
|
||||
object TxUtil extends BitcoinSLogger {
|
||||
|
||||
private def computeNextLockTime(
|
||||
currentLockTimeOpt: Option[UInt32],
|
||||
|
|
|
@ -19,8 +19,7 @@ import scala.annotation.tailrec
|
|||
/**
|
||||
* Created by chris on 1/25/16.
|
||||
*/
|
||||
sealed abstract class ArithmeticInterpreter {
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class ArithmeticInterpreter extends BitcoinSLogger {
|
||||
|
||||
/** a is added to b. */
|
||||
def opAdd(program: ExecutionInProgressScriptProgram): StartedScriptProgram = {
|
||||
|
|
|
@ -16,8 +16,7 @@ import org.bitcoins.core.util.BitcoinSLogger
|
|||
/**
|
||||
* Created by chris on 1/6/16.
|
||||
*/
|
||||
sealed abstract class BitwiseInterpreter {
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class BitwiseInterpreter extends BitcoinSLogger {
|
||||
|
||||
/** Returns 1 if the inputs are exactly equal, 0 otherwise. */
|
||||
def opEqual(
|
||||
|
|
|
@ -13,8 +13,7 @@ import scala.annotation.tailrec
|
|||
/**
|
||||
* Created by chris on 1/24/16.
|
||||
*/
|
||||
sealed abstract class ConstantInterpreter {
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class ConstantInterpreter extends BitcoinSLogger {
|
||||
|
||||
/** The next byte contains the number of bytes to be pushed onto the stack. */
|
||||
def opPushData1(
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package org.bitcoins.core.script.control
|
||||
|
||||
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.{
|
||||
ExecutionInProgressScriptProgram,
|
||||
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._
|
||||
|
||||
/**
|
||||
* Created by chris on 1/6/16.
|
||||
*/
|
||||
sealed abstract class ControlOperationsInterpreter {
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class ControlOperationsInterpreter extends BitcoinSLogger {
|
||||
|
||||
/** Factors out the similarities between OP_IF and OP_NOTIF */
|
||||
private def opConditional(conditional: ConditionalOperation)(
|
||||
|
|
|
@ -22,9 +22,7 @@ import scodec.bits.ByteVector
|
|||
/**
|
||||
* Created by chris on 1/6/16.
|
||||
*/
|
||||
sealed abstract class CryptoInterpreter {
|
||||
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class CryptoInterpreter extends BitcoinSLogger {
|
||||
|
||||
/** The input is hashed twice: first with SHA-256 and then with RIPEMD-160. */
|
||||
def opHash160(
|
||||
|
|
|
@ -20,9 +20,7 @@ import scala.annotation.tailrec
|
|||
/**
|
||||
* Created by chris on 2/8/16.
|
||||
*/
|
||||
sealed abstract class LockTimeInterpreter {
|
||||
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class LockTimeInterpreter extends BitcoinSLogger {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
sealed abstract class SpliceInterpreter {
|
||||
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class SpliceInterpreter extends BitcoinSLogger {
|
||||
|
||||
/** Pushes the string length of the top element of the stack (without popping it). */
|
||||
def opSize(
|
||||
|
|
|
@ -16,8 +16,7 @@ import scala.util.{Failure, Success, Try}
|
|||
* Stack operations implemented in the script programming language
|
||||
* https://en.bitcoin.it/wiki/Script#Stack
|
||||
*/
|
||||
sealed abstract class StackInterpreter {
|
||||
private def logger = BitcoinSLogger.logger
|
||||
sealed abstract class StackInterpreter extends BitcoinSLogger {
|
||||
|
||||
/**
|
||||
* Duplicates the element on top of the stack
|
||||
|
|
|
@ -1,45 +1,5 @@
|
|||
bitcoin-s {
|
||||
datadir = ${HOME}/.bitcoin-s
|
||||
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 {
|
||||
peers = ["localhost"] # a list of peer addresses in form "hostname:portnumber"
|
||||
# (e.g. "neutrino.testnet3.suredbits.com:18333")
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.db
|
|||
|
||||
import java.nio.file.{Files, Path, Paths}
|
||||
|
||||
import ch.qos.logback.classic.Level
|
||||
import com.typesafe.config._
|
||||
import org.bitcoins.core.config._
|
||||
import org.bitcoins.core.protocol.blockchain.ChainParams
|
||||
|
@ -10,7 +9,7 @@ import org.bitcoins.core.util.{BitcoinSLogger, StartStopAsync}
|
|||
import slick.basic.DatabaseConfig
|
||||
import slick.jdbc.JdbcProfile
|
||||
|
||||
import scala.concurrent.{Future}
|
||||
import scala.concurrent.Future
|
||||
import scala.util.matching.Regex
|
||||
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`]]
|
||||
* for more information.
|
||||
*/
|
||||
abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
||||
|
||||
private val logger = BitcoinSLogger.logger
|
||||
abstract class AppConfig extends StartStopAsync[Unit] with BitcoinSLogger {
|
||||
|
||||
/**
|
||||
* Starts this project.
|
||||
|
@ -73,7 +70,7 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
|||
|
||||
val numOverrides = configs.length + 1
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (logger.logger.isDebugEnabled()) {
|
||||
// force lazy evaluation before we print
|
||||
// our lines
|
||||
val oldConfStr = this.config.asReadableJson
|
||||
|
@ -84,7 +81,7 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
|||
}
|
||||
|
||||
val configOverrides = firstOverride +: configs
|
||||
if (logger.isTraceEnabled()) {
|
||||
if (logger.logger.isTraceEnabled()) {
|
||||
configOverrides.zipWithIndex.foreach {
|
||||
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
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (logger.logger.isDebugEnabled()) {
|
||||
// force lazy load before we print
|
||||
val newConfStr = newConf.config.asReadableJson
|
||||
|
||||
|
@ -158,76 +155,6 @@ abstract class AppConfig extends LoggerConfig with StartStopAsync[Unit] {
|
|||
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] = {
|
||||
Try {
|
||||
DatabaseConfig.forConfig[JdbcProfile](path = moduleName, config = config)
|
||||
|
|
|
@ -91,44 +91,6 @@ bitcoin-s {
|
|||
datadir = ${HOME}/.bitcoin-s
|
||||
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 {
|
||||
mode = neutrino # neutrino, spv
|
||||
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
package org.bitcoins.keymanager
|
||||
|
||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
||||
import org.slf4j.Logger
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
/** Exposes access to the key manager logger */
|
||||
private[bitcoins] trait KeyManagerLogger {
|
||||
|
||||
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)
|
||||
}
|
||||
private[bitcoins] trait KeyManagerLogger extends Logging
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.bitcoins.core.config.TestNet3
|
|||
import com.typesafe.config.ConfigFactory
|
||||
import org.bitcoins.core.config.RegTest
|
||||
import org.bitcoins.core.config.MainNet
|
||||
import ch.qos.logback.classic.Level
|
||||
import java.nio.file.Files
|
||||
|
||||
import scala.concurrent.Await
|
||||
|
@ -64,8 +63,6 @@ class NodeAppConfigTest extends BitcoinSAsyncTest {
|
|||
|
||||
assert(appConfig.datadir == tempDir.resolve("testnet3"))
|
||||
assert(appConfig.network == TestNet3)
|
||||
assert(appConfig.logLevel == Level.OFF)
|
||||
assert(appConfig.p2pLogLevel == Level.WARN)
|
||||
}
|
||||
|
||||
override def afterAll(): Unit = {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.bitcoins.node
|
||||
|
||||
import grizzled.slf4j.Logger
|
||||
import org.bitcoins.core.api.{Callback, Callback2, CallbackHandler}
|
||||
import org.bitcoins.core.gcs.GolombFilter
|
||||
import org.bitcoins.core.protocol.blockchain.{Block, BlockHeader, MerkleBlock}
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.slf4j.Logger
|
||||
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
package org.bitcoins.node
|
||||
|
||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
||||
import org.bitcoins.node.config.NodeAppConfig
|
||||
import org.slf4j.Logger
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
/** Exposes access to the P2P submodule logger */
|
||||
private[bitcoins] trait P2PLogger {
|
||||
|
||||
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)
|
||||
}
|
||||
private[bitcoins] trait P2PLogger extends Logging
|
||||
|
|
|
@ -79,8 +79,7 @@ case class SpvNode(
|
|||
peerMsgSender <- peerMsgSenderF
|
||||
_ <- peerMsgSender.sendFilterLoadMessage(bloomFilter)
|
||||
} yield {
|
||||
logger(nodeAppConfig).info(
|
||||
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
|
||||
}
|
||||
|
|
|
@ -354,8 +354,8 @@ object P2PClient extends P2PLogger {
|
|||
* @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
|
||||
*/
|
||||
private[bitcoins] def parseIndividualMessages(bytes: ByteVector)(implicit
|
||||
conf: NodeAppConfig): (List[NetworkMessage], ByteVector) = {
|
||||
private[bitcoins] def parseIndividualMessages(
|
||||
bytes: ByteVector): (List[NetworkMessage], ByteVector) = {
|
||||
@tailrec
|
||||
def loop(
|
||||
remainingBytes: ByteVector,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
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 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}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +26,7 @@ private[peer] object MerkleBuffers extends P2PLogger {
|
|||
private val underlyingMap: MerkleBlocksWithTransactions = mutable.Map.empty
|
||||
|
||||
/** 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 matches = tree.extractMatches
|
||||
|
||||
|
@ -60,8 +58,7 @@ private[peer] object MerkleBuffers extends P2PLogger {
|
|||
* Otherwise, false.
|
||||
*/
|
||||
def putTx(tx: Transaction, callbacks: NodeCallbacks)(implicit
|
||||
ec: ExecutionContext,
|
||||
config: NodeAppConfig): Future[Boolean] = {
|
||||
ec: ExecutionContext): Future[Boolean] = {
|
||||
val blocksInBuffer = underlyingMap.keys.toList
|
||||
logger.trace(s"Looking for transaction=${tx.txIdBE} in merkleblock buffer")
|
||||
logger.trace(s"Merkleblocks in buffer: ${blocksInBuffer.length}")
|
||||
|
@ -87,8 +84,7 @@ private[peer] object MerkleBuffers extends P2PLogger {
|
|||
transaction: Transaction,
|
||||
merkleBlock: MerkleBlock,
|
||||
callbacks: NodeCallbacks)(implicit
|
||||
ec: ExecutionContext,
|
||||
config: NodeAppConfig): Future[Boolean] = {
|
||||
ec: ExecutionContext): Future[Boolean] = {
|
||||
val merkleBlockMatches = merkleBlock.partialMerkleTree.extractMatches
|
||||
val merkleHash = merkleBlock.blockHeader.hashBE
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ object Deps {
|
|||
object V {
|
||||
val bouncyCastle = "1.66"
|
||||
val logback = "1.2.3"
|
||||
val grizzledSlf4j = "1.3.4"
|
||||
val scalacheck = "1.14.3"
|
||||
val scalaTest = "3.2.2"
|
||||
|
||||
|
@ -129,6 +130,10 @@ object Deps {
|
|||
|
||||
val logback =
|
||||
"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
|
||||
|
||||
//for loading secp256k1 natively
|
||||
|
@ -177,6 +182,7 @@ object Deps {
|
|||
val junitInterface =
|
||||
"com.novocode" % "junit-interface" % V.junitV % "test" withSources () withJavadoc ()
|
||||
val logback = Compile.logback % "test"
|
||||
val grizzledSlf4j = Compile.grizzledSlf4j % "test"
|
||||
val scalacheck = Compile.scalacheck % "test"
|
||||
val scalaTest = Compile.scalaTest % "test"
|
||||
val scalaMock = "org.scalamock" %% "scalamock" % V.scalamockV
|
||||
|
@ -219,7 +225,8 @@ object Deps {
|
|||
val core = List(
|
||||
Compile.bouncycastle,
|
||||
Compile.scodec,
|
||||
Compile.slf4j
|
||||
Compile.slf4j,
|
||||
Compile.grizzledSlf4j
|
||||
)
|
||||
|
||||
val crypto = List(
|
||||
|
|
|
@ -103,5 +103,9 @@
|
|||
|
||||
<!-- get rid of "Slf4jLogger started" messages -->
|
||||
<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>
|
|
@ -2,44 +2,6 @@ bitcoin-s {
|
|||
datadir = ${HOME}/.bitcoin-s
|
||||
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 {
|
||||
mode = neutrino # neutrino, spv
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ import scala.concurrent.{ExecutionContext, Future}
|
|||
trait ChainUnitTest
|
||||
extends BitcoinSFixture
|
||||
with ChainFixtureHelper
|
||||
with ChainVerificationLogger
|
||||
with CachedChainAppConfig {
|
||||
|
||||
implicit lazy val appConfig: ChainAppConfig =
|
||||
|
@ -639,9 +638,7 @@ object ChainUnitTest extends ChainVerificationLogger {
|
|||
|
||||
/** Syncs the given chain handler to the given bitcoind */
|
||||
def syncFromBitcoind(bitcoind: BitcoindRpcClient, chainHandler: ChainHandler)(
|
||||
implicit
|
||||
ec: ExecutionContext,
|
||||
chainAppConfig: ChainAppConfig): Future[ChainApi] = {
|
||||
implicit ec: ExecutionContext): Future[ChainApi] = {
|
||||
//sync headers
|
||||
//first we need to implement the 'getBestBlockHashFunc' and 'getBlockHeaderFunc' functions
|
||||
val getBestBlockHashFunc = { () =>
|
||||
|
|
|
@ -39,7 +39,6 @@ trait TestDbManagement extends DbManagement {
|
|||
|
||||
case class TestAppConfig(
|
||||
private val directory: Path,
|
||||
override val useLogbackConf: Boolean,
|
||||
private val conf: Config*)(implicit override val ec: ExecutionContext)
|
||||
extends AppConfig
|
||||
with TestDbManagement
|
||||
|
@ -52,7 +51,7 @@ case class TestAppConfig(
|
|||
|
||||
override protected[bitcoins] def newConfigOfType(
|
||||
configs: Seq[Config]): TestAppConfig =
|
||||
TestAppConfig(directory, useLogbackConf, configs: _*)
|
||||
TestAppConfig(directory, configs: _*)
|
||||
|
||||
protected[bitcoins] def baseDatadir: Path = directory
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ sealed trait TestDAOFixture
|
|||
|
||||
implicit private val testConfig: TestAppConfig = TestAppConfig(
|
||||
BitcoinSTestAppConfig.tmpDir(),
|
||||
useLogbackConf = true,
|
||||
BitcoinSTestAppConfig.configWithEmbeddedDb(Some(ProjectType.Test), pgUrl))
|
||||
|
||||
override def beforeAll(): Unit = {
|
||||
|
|
|
@ -363,8 +363,7 @@ object NodeUnitTest extends P2PLogger {
|
|||
nodeConnectedWithBitcoind: NodeConnectedWithBitcoind)(implicit
|
||||
system: ActorSystem,
|
||||
appConfig: BitcoinSAppConfig): Future[Unit] = {
|
||||
logger(appConfig.nodeConf)
|
||||
.debug(s"Beggining tear down of node connected with bitcoind")
|
||||
logger.debug(s"Beginning tear down of node connected with bitcoind")
|
||||
import system.dispatcher
|
||||
val node = nodeConnectedWithBitcoind.node
|
||||
val bitcoind = nodeConnectedWithBitcoind.bitcoind
|
||||
|
@ -372,8 +371,7 @@ object NodeUnitTest extends P2PLogger {
|
|||
_ <- destroyNode(node)
|
||||
_ <- ChainUnitTest.destroyBitcoind(bitcoind)
|
||||
} yield {
|
||||
logger(appConfig.nodeConf)
|
||||
.debug(s"Done with teardown of node connected with bitcoind!")
|
||||
logger.debug(s"Done with teardown of node connected with bitcoind!")
|
||||
()
|
||||
}
|
||||
|
||||
|
|
|
@ -34,10 +34,7 @@ import org.scalatest._
|
|||
import scala.concurrent._
|
||||
import scala.concurrent.duration._
|
||||
|
||||
trait BitcoinSWalletTest
|
||||
extends BitcoinSFixture
|
||||
with WalletLogger
|
||||
with EmbeddedPg {
|
||||
trait BitcoinSWalletTest extends BitcoinSFixture with EmbeddedPg {
|
||||
import BitcoinSWalletTest._
|
||||
|
||||
/** Wallet config with data directory set to user temp directory */
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.wallet
|
|||
|
||||
import java.nio.file.Files
|
||||
|
||||
import ch.qos.logback.classic.Level
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
||||
import org.bitcoins.core.hd.HDPurposes
|
||||
|
@ -96,7 +95,5 @@ class WalletAppConfigTest extends BitcoinSAsyncTest {
|
|||
|
||||
assert(appConfig.datadir == tempDir.resolve("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 */
|
||||
private def createRootAccount(wallet: Wallet, keyManager: BIP39KeyManager)(
|
||||
implicit
|
||||
walletAppConfig: WalletAppConfig,
|
||||
ec: ExecutionContext): Future[AccountDb] = {
|
||||
implicit ec: ExecutionContext): Future[AccountDb] = {
|
||||
val coinType = HDUtil.getCoinType(keyManager.kmParams.network)
|
||||
val coin =
|
||||
HDCoin(purpose = keyManager.kmParams.purpose, coinType = coinType)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.bitcoins.wallet
|
||||
|
||||
import grizzled.slf4j.Logger
|
||||
import org.bitcoins.core.api.wallet.db.SpendingInfoDb
|
||||
import org.bitcoins.core.api.{Callback, CallbackHandler}
|
||||
import org.bitcoins.core.protocol.BitcoinAddress
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.slf4j.Logger
|
||||
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
|
|
|
@ -1,22 +1,6 @@
|
|||
package org.bitcoins.wallet
|
||||
|
||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
||||
import org.slf4j.Logger
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
/** Exposes acccess to the wallet logger */
|
||||
private[bitcoins] trait WalletLogger {
|
||||
|
||||
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)
|
||||
}
|
||||
private[bitcoins] trait WalletLogger extends Logging
|
||||
|
|
Loading…
Add table
Reference in a new issue