mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Remove PeerManager.{getPeerMessageSender(), getPeerConnection()}, use NodeState.{getPeerMessageSender(), getPeerConnection()} (#5400)
This commit is contained in:
parent
e4fbfe73e6
commit
f5087c5e3f
@ -72,7 +72,7 @@ case class PeerManager(
|
||||
nodeState: SyncNodeState)(implicit
|
||||
chainAppConfig: ChainAppConfig): Future[Unit] = {
|
||||
val syncPeer = nodeState.syncPeer
|
||||
val peerMsgSender = getPeerMsgSender(syncPeer) match {
|
||||
val peerMsgSender = nodeState.getPeerMsgSender(syncPeer) match {
|
||||
case Some(p) => p
|
||||
case None =>
|
||||
sys.error(s"Could not find peer=$syncPeer")
|
||||
@ -108,18 +108,6 @@ case class PeerManager(
|
||||
}
|
||||
}
|
||||
|
||||
private def getPeerConnection(peer: Peer): Option[PeerConnection] = {
|
||||
_peerDataMap.find(_._1 == peer).map(_._2.peerConnection) match {
|
||||
case Some(peerConnection) => Some(peerConnection)
|
||||
case None => None
|
||||
}
|
||||
}
|
||||
|
||||
private def getPeerMsgSender(peer: Peer): Option[PeerMessageSender] = {
|
||||
val randomPeerOpt = getPeerConnection(peer)
|
||||
randomPeerOpt.map(PeerMessageSender(_))
|
||||
}
|
||||
|
||||
private def createInDb(
|
||||
peer: Peer,
|
||||
serviceIdentifier: ServiceIdentifier): Future[PeerDb] = {
|
||||
@ -1032,7 +1020,7 @@ case class PeerManager(
|
||||
nodeState match {
|
||||
case fhs: FilterHeaderSync =>
|
||||
val peerMsgSender =
|
||||
getPeerMsgSender(fhs.syncPeer).get //check this .get
|
||||
nodeState.getPeerMsgSender(fhs.syncPeer).get
|
||||
PeerManager
|
||||
.sendFirstGetCompactFilterHeadersCommand(
|
||||
peerMessageSenderApi = peerMsgSender,
|
||||
|
Loading…
Reference in New Issue
Block a user