mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Refactor Node.chainApiFromDb()
to return ChainApi
(#5484)
* Refactor Node.chainApiFromDb() to return ChainApi * Adjust log level for ignoring p2p messages to DEBUG
This commit is contained in:
parent
3cfe700fad
commit
47c7680d8c
@ -1,7 +1,7 @@
|
||||
package org.bitcoins.node
|
||||
|
||||
import org.apache.pekko.actor.ActorSystem
|
||||
import org.bitcoins.chain.blockchain.ChainHandlerCached
|
||||
import org.bitcoins.chain.blockchain.{ChainHandler}
|
||||
import org.bitcoins.chain.config.ChainAppConfig
|
||||
import org.bitcoins.chain.models.{
|
||||
BlockHeaderDAO,
|
||||
@ -48,11 +48,12 @@ trait Node
|
||||
* our [[org.bitcoins.chain.blockchain.Blockchain Blockchain]]
|
||||
*/
|
||||
def chainApiFromDb()(implicit
|
||||
executionContext: ExecutionContext): Future[ChainHandlerCached] = {
|
||||
ChainHandlerCached.fromDatabase(BlockHeaderDAO(),
|
||||
CompactFilterHeaderDAO(),
|
||||
CompactFilterDAO(),
|
||||
ChainStateDescriptorDAO())
|
||||
executionContext: ExecutionContext): Future[ChainApi] = {
|
||||
val c = ChainHandler.fromDatabase(BlockHeaderDAO(),
|
||||
CompactFilterHeaderDAO(),
|
||||
CompactFilterDAO(),
|
||||
ChainStateDescriptorDAO())
|
||||
Future.successful(c)
|
||||
}
|
||||
|
||||
/** Starts our node */
|
||||
|
@ -608,7 +608,7 @@ case class PeerManager(
|
||||
.map(_._2)
|
||||
peerDataOpt match {
|
||||
case None =>
|
||||
logger.warn(
|
||||
logger.debug(
|
||||
s"Ignoring received msg=${payload.commandName} from peer=$peer because it was disconnected, peers=$peers state=${state}")
|
||||
Future.successful(state)
|
||||
case Some(peerData) =>
|
||||
|
@ -58,7 +58,7 @@ case class DataMessageHandler(
|
||||
val isQueryTimedOut = state.isQueryTimedOut(appConfig.queryWaitTime)
|
||||
if (peerData.peer != syncPeer && !isQueryTimedOut) {
|
||||
//ignore message from peers that we aren't syncing with during IBD
|
||||
logger.info(
|
||||
logger.debug(
|
||||
s"Ignoring message ${payload.commandName} from peer=${peerData.peer} in state=$state because we are syncing with this peer currently. syncPeer=$syncPeer")
|
||||
Future.successful(this)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user