mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-23 22:56:52 +01:00
Added tests for getPeerInfo, getAddedNodeInfo, setBan, listBanned, and clearBanned
This commit is contained in:
parent
88779365d3
commit
e7ad9500da
2 changed files with 50 additions and 0 deletions
|
@ -398,3 +398,35 @@ case class NetTarget(
|
|||
bytes_left_in_cycle: Int,
|
||||
time_left_in_cycle: UInt32)
|
||||
extends NetworkResult
|
||||
|
||||
case class Peer(
|
||||
id: Int,
|
||||
networkInfo: PeerNetworkInfo,
|
||||
version: Int,
|
||||
subver: String,
|
||||
inbound: Boolean,
|
||||
addnode: Boolean,
|
||||
startingheight: Int,
|
||||
banscore: Int,
|
||||
synced_headers: Int,
|
||||
synced_blocks: Int,
|
||||
inflight: Vector[Int],
|
||||
whitelisted: Boolean,
|
||||
bytessent_per_msg: Map[String, Int],
|
||||
bytesrecv_per_msg: Map[String, Int]) extends NetworkResult
|
||||
|
||||
case class PeerNetworkInfo(
|
||||
addr: URI,
|
||||
addrbind: URI,
|
||||
addrlocal: Option[URI],
|
||||
services: String,
|
||||
relaytxes: Boolean,
|
||||
lastsend: UInt32,
|
||||
lastrecv: UInt32,
|
||||
bytessent: Int,
|
||||
bytesrecv: Int,
|
||||
conntime: UInt32,
|
||||
timeoffset: UInt32,
|
||||
pingtime: Option[BigDecimal],
|
||||
minping: Option[BigDecimal],
|
||||
pingwait: Option[BigDecimal]) extends NetworkResult
|
|
@ -205,6 +205,24 @@ object JsonSerializers {
|
|||
implicit val getNetTotalsResultReads: Reads[GetNetTotalsResult] =
|
||||
Json.reads[GetNetTotalsResult]
|
||||
|
||||
implicit val peerNetworkInfoReads: Reads[PeerNetworkInfo] = Json.reads[PeerNetworkInfo]
|
||||
implicit val peerReads: Reads[Peer] = (
|
||||
(__ \ "id").read[Int] and
|
||||
__.read[PeerNetworkInfo] and
|
||||
(__ \ "version").read[Int] and
|
||||
(__ \ "subver").read[String] and
|
||||
(__ \ "inbound").read[Boolean] and
|
||||
(__ \ "addnode").read[Boolean] and
|
||||
(__ \ "startingheight").read[Int] and
|
||||
(__ \ "banscore").read[Int] and
|
||||
(__ \ "synced_headers").read[Int] and
|
||||
(__ \ "synced_blocks").read[Int] and
|
||||
(__ \ "inflight").read[Vector[Int]] and
|
||||
(__ \ "whitelisted").read[Boolean] and
|
||||
(__ \ "bytessent_per_msg").read[Map[String, Int]] and
|
||||
(__ \ "bytesrecv_per_msg").read[Map[String, Int]]
|
||||
) (Peer)
|
||||
|
||||
// Mining Models
|
||||
implicit val miningInfoReads: Reads[GetMiningInfoResult] =
|
||||
Json.reads[GetMiningInfoResult]
|
||||
|
|
Loading…
Add table
Reference in a new issue