PaymentChannelServerState$1.smali

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

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


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->provideContract(Lorg/bitcoinj/core/Transaction;)Lcom/google/common/util/concurrent/y;
.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/PaymentChannelServerState;

.field final synthetic val$contract:Lorg/bitcoinj/core/Transaction;

.field final synthetic val$future:Lcom/google/common/util/concurrent/ao;


# direct methods
.method constructor <init>(Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;Lorg/bitcoinj/core/Transaction;Lcom/google/common/util/concurrent/ao;)V
    .registers 4

    .prologue
    .line 194
    iput-object p1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;

    iput-object p2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->val$contract:Lorg/bitcoinj/core/Transaction;

    iput-object p3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->val$future:Lcom/google/common/util/concurrent/ao;

    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 210
    # getter for: Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->log:Lorg/slf4j/Logger;
    invoke-static {}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->access$000()Lorg/slf4j/Logger;

    move-result-object v0

    const-string v1, "Failed to broadcast contract"

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

    .line 211
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;

    iget-object v0, v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->stateMachine:Lorg/bitcoinj/protocols/channels/StateMachine;

    sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$State;->ERROR:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$State;

    invoke-virtual {v0, v1}, Lorg/bitcoinj/protocols/channels/StateMachine;->transition(Ljava/lang/Enum;)V

    .line 212
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->val$future:Lcom/google/common/util/concurrent/ao;

    invoke-virtual {v0, p1}, Lcom/google/common/util/concurrent/ao;->setException(Ljava/lang/Throwable;)Z

    .line 213
    return-void
.end method

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

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

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

    return-void
.end method

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

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

    move-result-object v0

    const-string v1, "Successfully broadcast multisig contract {}. Channel now open."

    invoke-virtual {p1}, Lorg/bitcoinj/core/Transaction;->getHashAsString()Ljava/lang/String;

    move-result-object v2

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

    .line 200
    :try_start_d
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;

    iget-object v0, v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->wallet:Lorg/bitcoinj/wallet/Wallet;

    iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->val$contract:Lorg/bitcoinj/core/Transaction;

    const/4 v2, 0x0

    const/4 v3, 0x1

    invoke-virtual {v0, v1, v2, v3}, Lorg/bitcoinj/wallet/Wallet;->receivePending(Lorg/bitcoinj/core/Transaction;Ljava/util/List;Z)V
    :try_end_18
    .catch Lorg/bitcoinj/core/VerificationException; {:try_start_d .. :try_end_18} :catch_29

    .line 204
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;

    iget-object v0, v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->stateMachine:Lorg/bitcoinj/protocols/channels/StateMachine;

    sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$State;->READY:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$State;

    invoke-virtual {v0, v1}, Lorg/bitcoinj/protocols/channels/StateMachine;->transition(Ljava/lang/Enum;)V

    .line 205
    iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->val$future:Lcom/google/common/util/concurrent/ao;

    iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState$1;->this$0:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;

    invoke-virtual {v0, v1}, Lcom/google/common/util/concurrent/ao;->set(Ljava/lang/Object;)Z

    .line 206
    return-void

    .line 201
    :catch_29
    move-exception v0

    .line 202
    new-instance v1, Ljava/lang/RuntimeException;

    invoke-direct {v1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V

    throw v1
.end method