lnrpc.Route.scala Maven / Gradle / Ivy
The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package lnrpc
import org.bitcoins.lnd.rpc.LndUtils._
/**
* A path through the channel graph which runs over one or more channels in
* succession. This struct carries all the information required to craft the
* Sphinx onion packet, and send the payment along the first hop in the path. A
* route is only selected as valid if all the channels have sufficient capacity to
* carry the initial payment amount after fees are accounted for.
*
* @param totalTimeLock
*
* The cumulative (final) time lock across the entire route. This is the CLTV
* value that should be extended to the first hop in the route. All other hops
* will decrement the time-lock as advertised, leaving enough time for all
* hops to wait for or present the payment preimage to complete the payment.
* @param totalFees
*
* The sum of the fees paid at each hop within the final route. In the case
* of a one-hop payment, this value will be zero as we don't need to pay a fee
* to ourselves.
* @param totalAmt
*
* The total amount of funds required to complete a payment over this route.
* This value includes the cumulative fees at each hop. As a result, the HTLC
* extended to the first-hop in the route will need to have at least this many
* satoshis, otherwise the route will fail at an intermediate node due to an
* insufficient amount of fees.
* @param hops
*
* Contains details concerning the specific forwarding details at each hop.
* @param totalFeesMsat
*
* The total fees in millisatoshis.
* @param totalAmtMsat
*
* The total amount in millisatoshis.
*/
@SerialVersionUID(0L)
final case class Route(
totalTimeLock: org.bitcoins.core.number.UInt32 = lnrpc.Route._typemapper_totalTimeLock.toCustom(0),
@scala.deprecated(message="Marked as deprecated in proto file", "") totalFees: _root_.scala.Long = 0L,
@scala.deprecated(message="Marked as deprecated in proto file", "") totalAmt: _root_.scala.Long = 0L,
hops: _root_.scala.Seq[lnrpc.Hop] = _root_.scala.Seq.empty,
totalFeesMsat: _root_.scala.Long = 0L,
totalAmtMsat: _root_.scala.Long = 0L,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Route] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
{
val __value = lnrpc.Route._typemapper_totalTimeLock.toBase(totalTimeLock)
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(1, __value)
}
};
{
val __value = totalFees
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(2, __value)
}
};
{
val __value = totalAmt
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(3, __value)
}
};
hops.foreach { __item =>
val __value = __item
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
{
val __value = totalFeesMsat
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(5, __value)
}
};
{
val __value = totalAmtMsat
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(6, __value)
}
};
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
{
val __v = lnrpc.Route._typemapper_totalTimeLock.toBase(totalTimeLock)
if (__v != 0) {
_output__.writeUInt32(1, __v)
}
};
{
val __v = totalFees
if (__v != 0L) {
_output__.writeInt64(2, __v)
}
};
{
val __v = totalAmt
if (__v != 0L) {
_output__.writeInt64(3, __v)
}
};
hops.foreach { __v =>
val __m = __v
_output__.writeTag(4, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = totalFeesMsat
if (__v != 0L) {
_output__.writeInt64(5, __v)
}
};
{
val __v = totalAmtMsat
if (__v != 0L) {
_output__.writeInt64(6, __v)
}
};
unknownFields.writeTo(_output__)
}
def withTotalTimeLock(__v: org.bitcoins.core.number.UInt32): Route = copy(totalTimeLock = __v)
def withTotalFees(__v: _root_.scala.Long): Route = copy(totalFees = __v)
def withTotalAmt(__v: _root_.scala.Long): Route = copy(totalAmt = __v)
def clearHops = copy(hops = _root_.scala.Seq.empty)
def addHops(__vs: lnrpc.Hop *): Route = addAllHops(__vs)
def addAllHops(__vs: Iterable[lnrpc.Hop]): Route = copy(hops = hops ++ __vs)
def withHops(__v: _root_.scala.Seq[lnrpc.Hop]): Route = copy(hops = __v)
def withTotalFeesMsat(__v: _root_.scala.Long): Route = copy(totalFeesMsat = __v)
def withTotalAmtMsat(__v: _root_.scala.Long): Route = copy(totalAmtMsat = __v)
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => {
val __t = lnrpc.Route._typemapper_totalTimeLock.toBase(totalTimeLock)
if (__t != 0) __t else null
}
case 2 => {
val __t = totalFees
if (__t != 0L) __t else null
}
case 3 => {
val __t = totalAmt
if (__t != 0L) __t else null
}
case 4 => hops
case 5 => {
val __t = totalFeesMsat
if (__t != 0L) __t else null
}
case 6 => {
val __t = totalAmtMsat
if (__t != 0L) __t else null
}
}
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 1 => _root_.scalapb.descriptors.PInt(lnrpc.Route._typemapper_totalTimeLock.toBase(totalTimeLock))
case 2 => _root_.scalapb.descriptors.PLong(totalFees)
case 3 => _root_.scalapb.descriptors.PLong(totalAmt)
case 4 => _root_.scalapb.descriptors.PRepeated(hops.iterator.map(_.toPMessage).toVector)
case 5 => _root_.scalapb.descriptors.PLong(totalFeesMsat)
case 6 => _root_.scalapb.descriptors.PLong(totalAmtMsat)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: lnrpc.Route.type = lnrpc.Route
// @@protoc_insertion_point(GeneratedMessage[lnrpc.Route])
}
object Route extends scalapb.GeneratedMessageCompanion[lnrpc.Route] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.Route] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.Route = {
var __totalTimeLock: _root_.scala.Int = 0
var __totalFees: _root_.scala.Long = 0L
var __totalAmt: _root_.scala.Long = 0L
val __hops: _root_.scala.collection.immutable.VectorBuilder[lnrpc.Hop] = new _root_.scala.collection.immutable.VectorBuilder[lnrpc.Hop]
var __totalFeesMsat: _root_.scala.Long = 0L
var __totalAmtMsat: _root_.scala.Long = 0L
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 8 =>
__totalTimeLock = _input__.readUInt32()
case 16 =>
__totalFees = _input__.readInt64()
case 24 =>
__totalAmt = _input__.readInt64()
case 34 =>
__hops += _root_.scalapb.LiteParser.readMessage[lnrpc.Hop](_input__)
case 40 =>
__totalFeesMsat = _input__.readInt64()
case 48 =>
__totalAmtMsat = _input__.readInt64()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
lnrpc.Route(
totalTimeLock = lnrpc.Route._typemapper_totalTimeLock.toCustom(__totalTimeLock),
totalFees = __totalFees,
totalAmt = __totalAmt,
hops = __hops.result(),
totalFeesMsat = __totalFeesMsat,
totalAmtMsat = __totalAmtMsat,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.Route] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
lnrpc.Route(
totalTimeLock = lnrpc.Route._typemapper_totalTimeLock.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
totalFees = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
totalAmt = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
hops = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[lnrpc.Hop]]).getOrElse(_root_.scala.Seq.empty),
totalFeesMsat = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
totalAmtMsat = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Long]).getOrElse(0L)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(102)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(102)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 4 => __out = lnrpc.Hop
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = lnrpc.Route(
totalTimeLock = lnrpc.Route._typemapper_totalTimeLock.toCustom(0),
totalFees = 0L,
totalAmt = 0L,
hops = _root_.scala.Seq.empty,
totalFeesMsat = 0L,
totalAmtMsat = 0L
)
implicit class RouteLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.Route]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.Route](_l) {
def totalTimeLock: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.totalTimeLock)((c_, f_) => c_.copy(totalTimeLock = f_))
def totalFees: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.totalFees)((c_, f_) => c_.copy(totalFees = f_))
def totalAmt: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.totalAmt)((c_, f_) => c_.copy(totalAmt = f_))
def hops: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[lnrpc.Hop]] = field(_.hops)((c_, f_) => c_.copy(hops = f_))
def totalFeesMsat: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.totalFeesMsat)((c_, f_) => c_.copy(totalFeesMsat = f_))
def totalAmtMsat: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.totalAmtMsat)((c_, f_) => c_.copy(totalAmtMsat = f_))
}
final val TOTAL_TIME_LOCK_FIELD_NUMBER = 1
final val TOTAL_FEES_FIELD_NUMBER = 2
final val TOTAL_AMT_FIELD_NUMBER = 3
final val HOPS_FIELD_NUMBER = 4
final val TOTAL_FEES_MSAT_FIELD_NUMBER = 5
final val TOTAL_AMT_MSAT_FIELD_NUMBER = 6
@transient
private[lnrpc] val _typemapper_totalTimeLock: _root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32]]
def of(
totalTimeLock: org.bitcoins.core.number.UInt32,
totalFees: _root_.scala.Long,
totalAmt: _root_.scala.Long,
hops: _root_.scala.Seq[lnrpc.Hop],
totalFeesMsat: _root_.scala.Long,
totalAmtMsat: _root_.scala.Long
): _root_.lnrpc.Route = _root_.lnrpc.Route(
totalTimeLock,
totalFees,
totalAmt,
hops,
totalFeesMsat,
totalAmtMsat
)
// @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.Route])
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy