PaymentChannelClientConnection.smali

.class public Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;
.super Ljava/lang/Object;
.source "PaymentChannelClientConnection.java"


# instance fields
.field private final channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

.field private final channelOpenFuture:Lcom/google/common/util/concurrent/ao;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/google/common/util/concurrent/ao",
            "<",
            "Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;",
            ">;"
        }
    .end annotation
.end field

.field private final wireParser:Lorg/bitcoinj/net/ProtobufConnection;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lorg/bitcoinj/net/ProtobufConnection",
            "<",
            "Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;)V
    .registers 15

    .prologue
    .line 71
    sget-object v7, Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;->VERSION_2_ALLOW_1:Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;

    move-object v0, p0

    move-object v1, p1

    move v2, p2

    move-object v3, p3

    move-object v4, p4

    move-object v5, p5

    move-object v6, p6

    invoke-direct/range {v0 .. v7}, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;-><init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;)V

    .line 73
    return-void
.end method

.method public constructor <init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;JLorg/spongycastle/crypto/params/KeyParameter;)V
    .registers 23

    .prologue
    .line 130
    sget-object v11, Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;->VERSION_2_ALLOW_1:Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;

    move-object v1, p0

    move-object v2, p1

    move v3, p2

    move-object/from16 v4, p3

    move-object/from16 v5, p4

    move-object/from16 v6, p5

    move-object/from16 v7, p6

    move-wide/from16 v8, p7

    move-object/from16 v10, p9

    invoke-direct/range {v1 .. v11}, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;-><init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;JLorg/spongycastle/crypto/params/KeyParameter;Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;)V

    .line 132
    return-void
.end method

.method public constructor <init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;JLorg/spongycastle/crypto/params/KeyParameter;Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;)V
    .registers 24

    .prologue
    .line 165
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 44
    invoke-static {}, Lcom/google/common/util/concurrent/ao;->yj()Lcom/google/common/util/concurrent/ao;

    move-result-object v2

    iput-object v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelOpenFuture:Lcom/google/common/util/concurrent/ao;

    .line 168
    new-instance v3, Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    invoke-virtual/range {p6 .. p6}, Ljava/lang/String;->getBytes()[B

    move-result-object v2

    invoke-static {v2}, Lorg/bitcoinj/core/Sha256Hash;->of([B)Lorg/bitcoinj/core/Sha256Hash;

    move-result-object v7

    new-instance v11, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection$1;

    move-wide/from16 v0, p7

    invoke-direct {v11, p0, v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection$1;-><init>(Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;J)V

    move-object/from16 v4, p3

    move-object/from16 v5, p4

    move-object/from16 v6, p5

    move-wide/from16 v8, p7

    move-object/from16 v10, p9

    move-object/from16 v12, p10

    invoke-direct/range {v3 .. v12}, Lorg/bitcoinj/protocols/channels/PaymentChannelClient;-><init>(Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Lorg/bitcoinj/core/Sha256Hash;JLorg/spongycastle/crypto/params/KeyParameter;Lorg/bitcoinj/protocols/channels/IPaymentChannelClient$ClientConnection;Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;)V

    iput-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    .line 195
    new-instance v2, Lorg/bitcoinj/net/ProtobufConnection;

    new-instance v3, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection$2;

    invoke-direct {v3, p0}, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection$2;-><init>(Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;)V

    .line 217
    invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getDefaultInstance()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;

    move-result-object v4

    const/16 v5, 0x7fff

    mul-int/lit16 v6, p2, 0x3e8

    invoke-direct {v2, v3, v4, v5, v6}, Lorg/bitcoinj/net/ProtobufConnection;-><init>(Lorg/bitcoinj/net/ProtobufConnection$Listener;Lcom/google/protobuf/MessageLite;II)V

    iput-object v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->wireParser:Lorg/bitcoinj/net/ProtobufConnection;

    .line 221
    new-instance v2, Lorg/bitcoinj/net/NioClient;

    iget-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->wireParser:Lorg/bitcoinj/net/ProtobufConnection;

    mul-int/lit16 v4, p2, 0x3e8

    invoke-direct {v2, p1, v3, v4}, Lorg/bitcoinj/net/NioClient;-><init>(Ljava/net/SocketAddress;Lorg/bitcoinj/net/StreamConnection;I)V

    .line 222
    return-void
.end method

.method public constructor <init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;)V
    .registers 20

    .prologue
    .line 101
    const-wide/32 v8, 0x15144

    const/4 v10, 0x0

    move-object v1, p0

    move-object v2, p1

    move v3, p2

    move-object v4, p3

    move-object/from16 v5, p4

    move-object/from16 v6, p5

    move-object/from16 v7, p6

    move-object/from16 v11, p7

    invoke-direct/range {v1 .. v11}, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;-><init>(Ljava/net/InetSocketAddress;ILorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;Lorg/bitcoinj/core/Coin;Ljava/lang/String;JLorg/spongycastle/crypto/params/KeyParameter;Lorg/bitcoinj/protocols/channels/PaymentChannelClient$VersionSelector;)V

    .line 103
    return-void
.end method

.method static synthetic access$000(Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;)Lorg/bitcoinj/net/ProtobufConnection;
    .registers 2

    .prologue
    .line 42
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->wireParser:Lorg/bitcoinj/net/ProtobufConnection;

    return-object v0
.end method

.method static synthetic access$100(Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;)Lcom/google/common/util/concurrent/ao;
    .registers 2

    .prologue
    .line 42
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelOpenFuture:Lcom/google/common/util/concurrent/ao;

    return-object v0
.end method

.method static synthetic access$200(Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;)Lorg/bitcoinj/protocols/channels/PaymentChannelClient;
    .registers 2

    .prologue
    .line 42
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    return-object v0
.end method


# virtual methods
.method public disconnectWithoutSettlement()V
    .registers 2

    .prologue
    .line 319
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->wireParser:Lorg/bitcoinj/net/ProtobufConnection;

    invoke-virtual {v0}, Lorg/bitcoinj/net/ProtobufConnection;->closeConnection()V

    .line 320
    return-void
.end method

.method public getChannelOpenFuture()Lcom/google/common/util/concurrent/y;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Lcom/google/common/util/concurrent/y",
            "<",
            "Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;",
            ">;"
        }
    .end annotation

    .prologue
    .line 234
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelOpenFuture:Lcom/google/common/util/concurrent/ao;

    return-object v0
.end method

.method public incrementPayment(Lorg/bitcoinj/core/Coin;)Lcom/google/common/util/concurrent/y;
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lorg/bitcoinj/core/Coin;",
            ")",
            "Lcom/google/common/util/concurrent/y",
            "<",
            "Lorg/bitcoinj/protocols/channels/PaymentIncrementAck;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v1, 0x0

    .line 247
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    invoke-virtual {v0, p1, v1, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelClient;->incrementPayment(Lorg/bitcoinj/core/Coin;Lcom/google/protobuf/ByteString;Lorg/spongycastle/crypto/params/KeyParameter;)Lcom/google/common/util/concurrent/y;

    move-result-object v0

    return-object v0
.end method

.method public incrementPayment(Lorg/bitcoinj/core/Coin;Lcom/google/protobuf/ByteString;Lorg/spongycastle/crypto/params/KeyParameter;)Lcom/google/common/util/concurrent/y;
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lorg/bitcoinj/core/Coin;",
            "Lcom/google/protobuf/ByteString;",
            "Lorg/spongycastle/crypto/params/KeyParameter;",
            ")",
            "Lcom/google/common/util/concurrent/y",
            "<",
            "Lorg/bitcoinj/protocols/channels/PaymentIncrementAck;",
            ">;"
        }
    .end annotation

    .prologue
    .line 280
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    invoke-virtual {v0, p1, p2, p3}, Lorg/bitcoinj/protocols/channels/PaymentChannelClient;->incrementPayment(Lorg/bitcoinj/core/Coin;Lcom/google/protobuf/ByteString;Lorg/spongycastle/crypto/params/KeyParameter;)Lcom/google/common/util/concurrent/y;

    move-result-object v0

    return-object v0
.end method

.method public settle()V
    .registers 2

    .prologue
    .line 308
    :try_start_0
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelClient;->settle()V
    :try_end_5
    .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_5} :catch_6

    .line 312
    :goto_5
    return-void

    :catch_6
    move-exception v0

    goto :goto_5
.end method

.method public state()Lorg/bitcoinj/protocols/channels/PaymentChannelClientState;
    .registers 2

    .prologue
    .line 291
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelClientConnection;->channelClient:Lorg/bitcoinj/protocols/channels/PaymentChannelClient;

    invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelClient;->state()Lorg/bitcoinj/protocols/channels/PaymentChannelClientState;

    move-result-object v0

    return-object v0
.end method