P2pClient

class P2pClient(val chainSelector: ChainSelector, val name: String, val port: Int, val logName: String, val coCtxt: CoroutineContext)

Constructors

Link copied to clipboard
constructor(chainSelector: ChainSelector, name: String, port: Int, logName: String, coCtxt: CoroutineContext)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val atomicWriter: iGate
Link copied to clipboard

When we first attempted to connect to this peer

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val exclusiveHeaders: iGate
Link copied to clipboard
Link copied to clipboard
var inp: ByteReadChannel?
Link copied to clipboard
Link copied to clipboard

When we last heard from this peer

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

keep track of how often we got a message drop. If its too many times, drop the node

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var out: ByteWriteChannel?
Link copied to clipboard
Link copied to clipboard
val port: Int
Link copied to clipboard
Link copied to clipboard
var selectorManager: SelectorManager
Link copied to clipboard
Link copied to clipboard
var sock: Socket?
Link copied to clipboard
var sockBuilder: TcpSocketBuilder
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val txValidation: MutableMap<Long, suspend (String) -> Unit>
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

If you issue a getHeaders() but then give up waiting, call this function

Link copied to clipboard
fun clear()

clears all incoming messages

Link copied to clipboard
fun close()
Link copied to clipboard
fun connect(timeout: Int = CONNECT_TIMEOUT): P2pClient
Link copied to clipboard
suspend fun coProcessForever()
Link copied to clipboard
Link copied to clipboard

Get block headers. This function only allows one outstanding getheaders per node due to protocol issues. Call @cleanupExclusiveHeaders() if you stop waiting (if cb is never called). Its Ok to unnecessarily call cleanupExclusiveHeaders

Link copied to clipboard
Link copied to clipboard
fun misbehavingBadMessage(howBad: Int = 1)

Provide feedback that this node is not responding to our requests

Link copied to clipboard
fun misbehavingQuiet(howBad: Int = 1)

Provide feedback that this node is not responding to our requests

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Tell the peer we want headers not INVs for new blocks

Link copied to clipboard
Link copied to clipboard
fun send(command: ByteArray, msg: ByteArray)
fun send(command: ByteArray, msg: BCHserialized)
fun send(command: NetMsgType, msg: BCHserialized = BCHserialized(SerializationType.NETWORK))
Link copied to clipboard
fun sendBloomFilter(filter: ByteArray, inBloomCount: Int = -1)
Link copied to clipboard

Send a GETADDR request message

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun sendInv(invs: MutableList<Inv>)
Link copied to clipboard
fun sendPing()
Link copied to clipboard
fun sendTx(tx: ByteArray)
Link copied to clipboard
fun sendTxVal(tx: iTransaction, nonce: Long? = null, handler: suspend (String) -> Unit)
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard