PaymentChannelServer$3.smali

.class Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;
.super Ljava/lang/Object;
.source "PaymentChannelServer.java"

# interfaces
.implements Lcom/google/common/util/concurrent/q;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->settlePayment(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/google/common/util/concurrent/q",
        "<",
        "Lorg/bitcoinj/core/Transaction;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServer;

.field final synthetic val$clientRequestedClose:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;


# direct methods
.method constructor <init>(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
    .registers 3

    .prologue
    .line 523
    iput-object p1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServer;

    iput-object p2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->val$clientRequestedClose:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;

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

    return-void
.end method


# virtual methods
.method public onFailure(Ljava/lang/Throwable;)V
    .registers 4

    .prologue
    .line 543
    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
    invoke-static {}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->access$200()Lorg/slf4j/Logger;

    move-result-object v0

    const-string v1, "Failed to broadcast settlement tx"

    invoke-interface {v0, v1, p1}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 544
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServer;

    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
    invoke-static {v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->access$100(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;)Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;

    move-result-object v0

    iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->val$clientRequestedClose:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;

    invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->destroyConnection(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V

    .line 545
    return-void
.end method

.method public bridge synthetic onSuccess(Ljava/lang/Object;)V
    .registers 2

    .prologue
    .line 523
    check-cast p1, Lorg/bitcoinj/core/Transaction;

    invoke-virtual {p0, p1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->onSuccess(Lorg/bitcoinj/core/Transaction;)V

    return-void
.end method

.method public onSuccess(Lorg/bitcoinj/core/Transaction;)V
    .registers 5

    .prologue
    .line 527
    invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;

    move-result-object v0

    .line 528
    sget-object v1, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->CLOSE:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;

    invoke-virtual {v0, v1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;

    .line 529
    if-eqz p1, :cond_3c

    .line 532
    invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->getSettlementBuilder()Lorg/bitcoin/paymentchannel/Protos$Settlement$Builder;

    move-result-object v1

    invoke-virtual {p1}, Lorg/bitcoinj/core/Transaction;->unsafeBitcoinSerialize()[B

    move-result-object v2

    invoke-static {v2}, Lcom/google/protobuf/ByteString;->copyFrom([B)Lcom/google/protobuf/ByteString;

    move-result-object v2

    invoke-virtual {v1, v2}, Lorg/bitcoin/paymentchannel/Protos$Settlement$Builder;->setTx(Lcom/google/protobuf/ByteString;)Lorg/bitcoin/paymentchannel/Protos$Settlement$Builder;

    .line 533
    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
    invoke-static {}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->access$200()Lorg/slf4j/Logger;

    move-result-object v1

    const-string v2, "Sending CLOSE back with broadcast settlement tx."

    invoke-interface {v1, v2}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V

    .line 537
    :goto_23
    iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServer;

    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
    invoke-static {v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->access$100(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;)Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;

    move-result-object v1

    invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;

    move-result-object v0

    invoke-interface {v1, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V

    .line 538
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServer;

    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
    invoke-static {v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->access$100(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;)Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;

    move-result-object v0

    iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;->val$clientRequestedClose:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;

    invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->destroyConnection(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V

    .line 539
    return-void

    .line 535
    :cond_3c
    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
    invoke-static {}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->access$200()Lorg/slf4j/Logger;

    move-result-object v1

    const-string v2, "Sending CLOSE back without broadcast settlement tx."

    invoke-interface {v1, v2}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V

    goto :goto_23
.end method