PaymentChannelServer.smali
.class public Lorg/bitcoinj/protocols/channels/PaymentChannelServer;
.super Ljava/lang/Object;
.source "PaymentChannelServer.java"
# static fields
.field public static final DEFAULT_MAX_TIME_WINDOW:J = 0x93a80L
.field public static final DEFAULT_MIN_TIME_WINDOW:J = 0x3840L
.field public static final HARD_MIN_TIME_WINDOW:J = 0x1c20L
.field public static final SERVER_VERSIONS:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map",
"<",
"Ljava/lang/Integer;",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field private static final log:Lorg/slf4j/Logger;
# instance fields
.field private final broadcaster:Lorg/bitcoinj/core/TransactionBroadcaster;
.field private channelSettling:Z
.field private final conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
.field private connectionOpen:Z
.field private expireTime:J
.field protected final lock:Ljava/util/concurrent/locks/ReentrantLock;
.field private majorVersion:I
.field protected final maxTimeWindow:J
.field private final minAcceptedChannelSize:Lorg/bitcoinj/core/Coin;
.field protected final minTimeWindow:J
.field private myKey:Lorg/bitcoinj/core/ECKey;
.field private state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
.field private step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
.field private final wallet:Lorg/bitcoinj/wallet/Wallet;
# direct methods
.method static constructor <clinit>()V
.registers 4
.prologue
const/4 v3, 0x0
.line 51
const-class v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;
invoke-static {v0}, Lorg/slf4j/LoggerFactory;->getLogger(Ljava/lang/Class;)Lorg/slf4j/Logger;
move-result-object v0
sput-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
.line 59
const/4 v0, 0x1
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
const/4 v2, 0x2
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
invoke-static {v0, v1, v2, v3}, Lcom/google/common/collect/ImmutableMap;->of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableMap;
move-result-object v0
sput-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->SERVER_VERSIONS:Ljava/util/Map;
return-void
.end method
.method public constructor <init>(Lorg/bitcoinj/core/TransactionBroadcaster;Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/Coin;JJLorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;)V
.registers 11
.prologue
const/4 v1, 0x0
.line 202
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 53
const-string v0, "channelserver"
invoke-static {v0}, Lorg/bitcoinj/utils/Threading;->lock(Ljava/lang/String;)Ljava/util/concurrent/locks/ReentrantLock;
move-result-object v0
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
.line 70
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_CLIENT_VERSION:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
.line 127
iput-boolean v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->connectionOpen:Z
.line 129
iput-boolean v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->channelSettling:Z
.line 203
cmp-long v0, p4, p6
if-lez v0, :cond_20
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "minTimeWindow must be less or equal to maxTimeWindow"
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 204
:cond_20
const-wide/16 v0, 0x1c20
cmp-long v0, p4, v0
if-gez v0, :cond_2e
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "minTimeWindow must be larger than7200 seconds"
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 205
:cond_2e
invoke-static {p1}, Lcom/google/common/base/n;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/bitcoinj/core/TransactionBroadcaster;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->broadcaster:Lorg/bitcoinj/core/TransactionBroadcaster;
.line 206
invoke-static {p2}, Lcom/google/common/base/n;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/bitcoinj/wallet/Wallet;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
.line 207
invoke-static {p3}, Lcom/google/common/base/n;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/bitcoinj/core/Coin;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minAcceptedChannelSize:Lorg/bitcoinj/core/Coin;
.line 208
invoke-static {p8}, Lcom/google/common/base/n;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
.line 209
iput-wide p4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minTimeWindow:J
.line 210
iput-wide p6, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->maxTimeWindow:J
.line 211
return-void
.end method
.method public constructor <init>(Lorg/bitcoinj/core/TransactionBroadcaster;Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/Coin;Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;)V
.registers 14
.prologue
.line 181
const-wide/16 v4, 0x3840
const-wide/32 v6, 0x93a80
move-object v0, p0
move-object v1, p1
move-object v2, p2
move-object v3, p3
move-object v8, p4
invoke-direct/range {v0 .. v8}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;-><init>(Lorg/bitcoinj/core/TransactionBroadcaster;Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/Coin;JJLorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;)V
.line 182
return-void
.end method
.method static synthetic access$000(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Lorg/bitcoin/paymentchannel/Protos$ProvideContract;Lorg/bitcoinj/core/Sha256Hash;)V
.registers 3
.prologue
.line 49
invoke-direct {p0, p1, p2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->multisigContractPropogated(Lorg/bitcoin/paymentchannel/Protos$ProvideContract;Lorg/bitcoinj/core/Sha256Hash;)V
return-void
.end method
.method static synthetic access$100(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;)Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
.registers 2
.prologue
.line 49
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
return-object v0
.end method
.method static synthetic access$200()Lorg/slf4j/Logger;
.registers 1
.prologue
.line 49
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
return-object v0
.end method
.method static synthetic access$300(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.registers 4
.prologue
.line 49
invoke-direct {p0, p1, p2, p3}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
return-void
.end method
.method private error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.registers 7
.prologue
.line 495
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
invoke-interface {v0, p1}, Lorg/slf4j/Logger;->error(Ljava/lang/String;)V
.line 497
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$Error;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$Error$Builder;
move-result-object v0
.line 498
invoke-virtual {v0, p2}, Lorg/bitcoin/paymentchannel/Protos$Error$Builder;->setCode(Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;)Lorg/bitcoin/paymentchannel/Protos$Error$Builder;
move-result-object v0
.line 499
invoke-virtual {v0, p1}, Lorg/bitcoin/paymentchannel/Protos$Error$Builder;->setExplanation(Ljava/lang/String;)Lorg/bitcoin/paymentchannel/Protos$Error$Builder;
move-result-object v0
.line 500
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v2
.line 501
invoke-virtual {v2, v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setError(Lorg/bitcoin/paymentchannel/Protos$Error$Builder;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
sget-object v2, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->ERROR:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
.line 502
invoke-virtual {v0, v2}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
.line 503
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v0
.line 500
invoke-interface {v1, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.line 504
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-interface {v0, p3}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->destroyConnection(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.line 505
return-void
.end method
.method private multisigContractPropogated(Lorg/bitcoin/paymentchannel/Protos$ProvideContract;Lorg/bitcoinj/core/Sha256Hash;)V
.registers 6
.prologue
.line 338
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->lock()V
.line 340
:try_start_5
iget-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->connectionOpen:Z
if-eqz v0, :cond_d
iget-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->channelSettling:Z
:try_end_b
.catchall {:try_start_5 .. :try_end_b} :catchall_8d
if-eqz v0, :cond_13
.line 366
:cond_d
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
.line 367
:goto_12
return-void
.line 342
:cond_13
:try_start_13
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v0, p0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->storeChannelInWallet(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;)V
:try_end_18
.catchall {:try_start_13 .. :try_end_18} :catchall_8d
.line 344
:try_start_18
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$ProvideContract;->getInitialPayment()Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;
move-result-object v0
const/4 v1, 0x0
invoke-direct {p0, v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->receiveUpdatePaymentMessage(Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;Z)V
:try_end_20
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_18 .. :try_end_20} :catch_42
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_18 .. :try_end_20} :catch_5b
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_18 .. :try_end_20} :catch_74
.catchall {:try_start_18 .. :try_end_20} :catchall_8d
.line 360
:try_start_20
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v1
sget-object v2, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->CHANNEL_OPEN:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
.line 361
invoke-virtual {v1, v2}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v1
.line 362
invoke-virtual {v1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v1
.line 360
invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.line 363
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->CHANNEL_OPEN:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
.line 364
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-interface {v0, p2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->channelOpen(Lorg/bitcoinj/core/Sha256Hash;)V
:try_end_3c
.catchall {:try_start_20 .. :try_end_3c} :catchall_8d
.line 366
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_12
.line 345
:catch_42
move-exception v0
.line 346
:try_start_43
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Initial payment failed to verify"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 347
invoke-virtual {v0}, Lorg/bitcoinj/core/VerificationException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->BAD_TRANSACTION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_55
.catchall {:try_start_43 .. :try_end_55} :catchall_8d
.line 366
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_12
.line 349
:catch_5b
move-exception v0
.line 350
:try_start_5c
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Initial payment value was out of range"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 351
invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->BAD_TRANSACTION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_6e
.catchall {:try_start_5c .. :try_end_6e} :catchall_8d
.line 366
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_12
.line 353
:catch_74
move-exception v0
.line 356
:try_start_75
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Tried to settle channel and could not afford the fees whilst updating payment"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 357
invoke-virtual {v0}, Lorg/bitcoinj/core/InsufficientMoneyException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->BAD_TRANSACTION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_87
.catchall {:try_start_75 .. :try_end_87} :catchall_8d
.line 366
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_12
:catchall_8d
move-exception v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v1}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
throw v0
.end method
.method private receiveCloseMessage()V
.registers 3
.prologue
.line 509
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "Got CLOSE message, closing channel"
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 510
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
if-eqz v0, :cond_11
.line 511
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->CLIENT_REQUESTED_CLOSE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->settlePayment(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.line 515
:goto_10
return-void
.line 513
:cond_11
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->CLIENT_REQUESTED_CLOSE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->destroyConnection(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
goto :goto_10
.end method
.method private receiveContractMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.registers 9
.prologue
const/4 v4, 0x2
const/4 v1, 0x0
const/4 v2, 0x1
.line 372
iget v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
if-eq v0, v2, :cond_b
iget v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
if-ne v0, v4, :cond_7f
:cond_b
move v0, v2
:goto_c
invoke-static {v0}, Lcom/google/common/base/n;->checkState(Z)V
.line 373
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
sget-object v3, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_CONTRACT:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
if-ne v0, v3, :cond_81
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->hasProvideContract()Z
move-result v0
if-eqz v0, :cond_81
:goto_1b
invoke-static {v2}, Lcom/google/common/base/n;->checkState(Z)V
.line 374
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "Got contract, broadcasting and responding with CHANNEL_OPEN"
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 375
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getProvideContract()Lorg/bitcoin/paymentchannel/Protos$ProvideContract;
move-result-object v6
.line 377
iget v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
if-ne v0, v4, :cond_54
.line 378
new-instance v0, Lorg/bitcoinj/protocols/channels/PaymentChannelV2ServerState;
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->broadcaster:Lorg/bitcoinj/core/TransactionBroadcaster;
iget-object v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
iget-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->myKey:Lorg/bitcoinj/core/ECKey;
iget-wide v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->expireTime:J
invoke-direct/range {v0 .. v5}, Lorg/bitcoinj/protocols/channels/PaymentChannelV2ServerState;-><init>(Lorg/bitcoinj/core/TransactionBroadcaster;Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;J)V
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
.line 379
invoke-virtual {v6}, Lorg/bitcoin/paymentchannel/Protos$ProvideContract;->hasClientKey()Z
move-result v0
const-string v1, "ProvideContract didn\'t have a client key in protocol v2"
invoke-static {v0, v1}, Lcom/google/common/base/n;->checkState(ZLjava/lang/Object;)V
.line 380
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
check-cast v0, Lorg/bitcoinj/protocols/channels/PaymentChannelV2ServerState;
invoke-virtual {v6}, Lorg/bitcoin/paymentchannel/Protos$ProvideContract;->getClientKey()Lcom/google/protobuf/ByteString;
move-result-object v1
invoke-virtual {v1}, Lcom/google/protobuf/ByteString;->toByteArray()[B
move-result-object v1
invoke-virtual {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelV2ServerState;->provideClientKey([B)V
.line 384
:cond_54
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
invoke-virtual {v0}, Lorg/bitcoinj/wallet/Wallet;->getParams()Lorg/bitcoinj/core/NetworkParameters;
move-result-object v0
invoke-virtual {v0}, Lorg/bitcoinj/core/NetworkParameters;->getDefaultSerializer()Lorg/bitcoinj/core/MessageSerializer;
move-result-object v0
invoke-virtual {v6}, Lorg/bitcoin/paymentchannel/Protos$ProvideContract;->getTx()Lcom/google/protobuf/ByteString;
move-result-object v1
invoke-virtual {v1}, Lcom/google/protobuf/ByteString;->toByteArray()[B
move-result-object v1
invoke-virtual {v0, v1}, Lorg/bitcoinj/core/MessageSerializer;->makeTransaction([B)Lorg/bitcoinj/core/Transaction;
move-result-object v0
.line 385
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_MULTISIG_ACCEPTANCE:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
.line 386
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v1, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->provideContract(Lorg/bitcoinj/core/Transaction;)Lcom/google/common/util/concurrent/y;
move-result-object v1
new-instance v2, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$1;
invoke-direct {v2, p0, v6, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$1;-><init>(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Lorg/bitcoin/paymentchannel/Protos$ProvideContract;Lorg/bitcoinj/core/Transaction;)V
sget-object v0, Lorg/bitcoinj/utils/Threading;->SAME_THREAD:Ljava/util/concurrent/Executor;
.line 387
invoke-interface {v1, v2, v0}, Lcom/google/common/util/concurrent/y;->a(Ljava/lang/Runnable;Ljava/util/concurrent/Executor;)V
.line 393
return-void
:cond_7f
move v0, v1
.line 372
goto :goto_c
:cond_81
move v2, v1
.line 373
goto :goto_1b
.end method
.method private receiveRefundMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.registers 9
.prologue
const/4 v2, 0x0
const/4 v1, 0x1
.line 315
iget v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
if-ne v0, v1, :cond_81
move v0, v1
:goto_7
invoke-static {v0}, Lcom/google/common/base/n;->checkState(Z)V
.line 316
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
sget-object v3, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_UNSIGNED_REFUND:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
if-ne v0, v3, :cond_83
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->hasProvideRefund()Z
move-result v0
if-eqz v0, :cond_83
:goto_16
invoke-static {v1}, Lcom/google/common/base/n;->checkState(Z)V
.line 317
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "Got refund transaction, returning signature"
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 319
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getProvideRefund()Lorg/bitcoin/paymentchannel/Protos$ProvideRefund;
move-result-object v6
.line 320
new-instance v0, Lorg/bitcoinj/protocols/channels/PaymentChannelV1ServerState;
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->broadcaster:Lorg/bitcoinj/core/TransactionBroadcaster;
iget-object v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
iget-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->myKey:Lorg/bitcoinj/core/ECKey;
iget-wide v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->expireTime:J
invoke-direct/range {v0 .. v5}, Lorg/bitcoinj/protocols/channels/PaymentChannelV1ServerState;-><init>(Lorg/bitcoinj/core/TransactionBroadcaster;Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/ECKey;J)V
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
.line 322
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
check-cast v0, Lorg/bitcoinj/protocols/channels/PaymentChannelV1ServerState;
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
.line 323
invoke-virtual {v1}, Lorg/bitcoinj/wallet/Wallet;->getParams()Lorg/bitcoinj/core/NetworkParameters;
move-result-object v1
invoke-virtual {v1}, Lorg/bitcoinj/core/NetworkParameters;->getDefaultSerializer()Lorg/bitcoinj/core/MessageSerializer;
move-result-object v1
invoke-virtual {v6}, Lorg/bitcoin/paymentchannel/Protos$ProvideRefund;->getTx()Lcom/google/protobuf/ByteString;
move-result-object v2
invoke-virtual {v2}, Lcom/google/protobuf/ByteString;->toByteArray()[B
move-result-object v2
invoke-virtual {v1, v2}, Lorg/bitcoinj/core/MessageSerializer;->makeTransaction([B)Lorg/bitcoinj/core/Transaction;
move-result-object v1
.line 324
invoke-virtual {v6}, Lorg/bitcoin/paymentchannel/Protos$ProvideRefund;->getMultisigKey()Lcom/google/protobuf/ByteString;
move-result-object v2
invoke-virtual {v2}, Lcom/google/protobuf/ByteString;->toByteArray()[B
move-result-object v2
.line 323
invoke-virtual {v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelV1ServerState;->provideRefundTransaction(Lorg/bitcoinj/core/Transaction;[B)[B
move-result-object v0
.line 326
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_CONTRACT:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
.line 328
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$ReturnRefund;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$ReturnRefund$Builder;
move-result-object v1
.line 329
invoke-static {v0}, Lcom/google/protobuf/ByteString;->copyFrom([B)Lcom/google/protobuf/ByteString;
move-result-object v0
invoke-virtual {v1, v0}, Lorg/bitcoin/paymentchannel/Protos$ReturnRefund$Builder;->setSignature(Lcom/google/protobuf/ByteString;)Lorg/bitcoin/paymentchannel/Protos$ReturnRefund$Builder;
move-result-object v0
.line 331
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v2
.line 332
invoke-virtual {v2, v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setReturnRefund(Lorg/bitcoin/paymentchannel/Protos$ReturnRefund$Builder;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
sget-object v2, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->RETURN_REFUND:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
.line 333
invoke-virtual {v0, v2}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
.line 334
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v0
.line 331
invoke-interface {v1, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.line 335
return-void
:cond_81
move v0, v2
.line 315
goto :goto_7
:cond_83
move v1, v2
.line 316
goto :goto_16
.end method
.method private receiveUpdatePaymentMessage(Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;Z)V
.registers 8
.prologue
const/4 v0, 0x0
.line 397
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Got a payment update"
invoke-interface {v1, v2}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 399
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->getBestValueToMe()Lorg/bitcoinj/core/Coin;
move-result-object v1
.line 400
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;->getClientChangeValue()J
move-result-wide v2
invoke-static {v2, v3}, Lorg/bitcoinj/core/Coin;->valueOf(J)Lorg/bitcoinj/core/Coin;
move-result-object v2
.line 401
iget-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;->getSignature()Lcom/google/protobuf/ByteString;
move-result-object v4
invoke-virtual {v4}, Lcom/google/protobuf/ByteString;->toByteArray()[B
move-result-object v4
invoke-virtual {v3, v2, v4}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->incrementPayment(Lorg/bitcoinj/core/Coin;[B)Z
move-result v2
.line 402
iget-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v3}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->getBestValueToMe()Lorg/bitcoinj/core/Coin;
move-result-object v3
invoke-virtual {v3, v1}, Lorg/bitcoinj/core/Coin;->subtract(Lorg/bitcoinj/core/Coin;)Lorg/bitcoinj/core/Coin;
move-result-object v1
.line 405
invoke-virtual {v1}, Lorg/bitcoinj/core/Coin;->signum()I
move-result v3
if-lez v3, :cond_4a
.line 406
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;->hasInfo()Z
move-result v3
if-eqz v3, :cond_3e
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;->getInfo()Lcom/google/protobuf/ByteString;
move-result-object v0
.line 407
:cond_3e
iget-object v3, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
iget-object v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v4}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->getBestValueToMe()Lorg/bitcoinj/core/Coin;
move-result-object v4
invoke-interface {v3, v1, v4, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->paymentIncrease(Lorg/bitcoinj/core/Coin;Lorg/bitcoinj/core/Coin;Lcom/google/protobuf/ByteString;)Lcom/google/common/util/concurrent/y;
move-result-object v0
.line 410
:cond_4a
if-eqz p2, :cond_60
.line 411
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v1
.line 412
sget-object v3, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->PAYMENT_ACK:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
invoke-virtual {v1, v3}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
.line 413
if-nez v0, :cond_6f
.line 414
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-virtual {v1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v1
invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.line 432
:cond_60
:goto_60
if-nez v2, :cond_6e
.line 433
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "Channel is now fully exhausted, closing/initiating settlement"
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 434
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->CHANNEL_EXHAUSTED:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->settlePayment(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.line 436
:cond_6e
return-void
.line 416
:cond_6f
new-instance v3, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$2;
invoke-direct {v3, p0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$2;-><init>(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;)V
invoke-static {v0, v3}, Lcom/google/common/util/concurrent/r;->a(Lcom/google/common/util/concurrent/y;Lcom/google/common/util/concurrent/q;)V
goto :goto_60
.end method
.method private receiveVersionMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.registers 9
.prologue
const/4 v1, 0x1
const/4 v2, 0x0
.line 224
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
sget-object v3, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_CLIENT_VERSION:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
if-ne v0, v3, :cond_53
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->hasClientVersion()Z
move-result v0
if-eqz v0, :cond_53
move v0, v1
:goto_f
invoke-static {v0}, Lcom/google/common/base/n;->checkState(Z)V
.line 225
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getClientVersion()Lorg/bitcoin/paymentchannel/Protos$ClientVersion;
move-result-object v3
.line 226
invoke-virtual {v3}, Lorg/bitcoin/paymentchannel/Protos$ClientVersion;->getMajor()I
move-result v0
iput v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
.line 227
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->SERVER_VERSIONS:Ljava/util/Map;
iget v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
invoke-interface {v0, v4}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_55
.line 228
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "This server needs one of protocol versions "
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->SERVER_VERSIONS:Ljava/util/Map;
invoke-interface {v1}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, " , client offered "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->NO_ACCEPTABLE_VERSION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->NO_ACCEPTABLE_VERSION:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.line 299
:goto_52
return-void
:cond_53
move v0, v2
.line 224
goto :goto_f
.line 233
:cond_55
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$ServerVersion;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$ServerVersion$Builder;
move-result-object v0
iget v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
.line 234
invoke-virtual {v0, v4}, Lorg/bitcoin/paymentchannel/Protos$ServerVersion$Builder;->setMajor(I)Lorg/bitcoin/paymentchannel/Protos$ServerVersion$Builder;
move-result-object v4
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->SERVER_VERSIONS:Ljava/util/Map;
iget v5, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
invoke-interface {v0, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Integer;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v0
invoke-virtual {v4, v0}, Lorg/bitcoin/paymentchannel/Protos$ServerVersion$Builder;->setMinor(I)Lorg/bitcoin/paymentchannel/Protos$ServerVersion$Builder;
move-result-object v0
.line 235
iget-object v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v5
sget-object v6, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->SERVER_VERSION:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
.line 236
invoke-virtual {v5, v6}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v5
.line 237
invoke-virtual {v5, v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setServerVersion(Lorg/bitcoin/paymentchannel/Protos$ServerVersion$Builder;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
.line 238
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v0
.line 235
invoke-interface {v4, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.line 239
invoke-virtual {v3}, Lorg/bitcoin/paymentchannel/Protos$ClientVersion;->getPreviousChannelContractHash()Lcom/google/protobuf/ByteString;
move-result-object v0
.line 240
if-eqz v0, :cond_108
invoke-virtual {v0}, Lcom/google/protobuf/ByteString;->size()I
move-result v4
const/16 v5, 0x20
if-ne v4, v5, :cond_108
.line 241
invoke-virtual {v0}, Lcom/google/protobuf/ByteString;->toByteArray()[B
move-result-object v0
invoke-static {v0}, Lorg/bitcoinj/core/Sha256Hash;->wrap([B)Lorg/bitcoinj/core/Sha256Hash;
move-result-object v4
.line 242
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v5, "New client that wants to resume {}"
invoke-interface {v0, v5, v4}, Lorg/slf4j/Logger;->info(Ljava/lang/String;Ljava/lang/Object;)V
.line 243
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
.line 244
invoke-virtual {v0}, Lorg/bitcoinj/wallet/Wallet;->getExtensions()Ljava/util/Map;
move-result-object v0
sget-object v5, Lorg/bitcoinj/protocols/channels/StoredPaymentChannelServerStates;->EXTENSION_ID:Ljava/lang/String;
invoke-interface {v0, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/bitcoinj/protocols/channels/StoredPaymentChannelServerStates;
.line 245
if-eqz v0, :cond_196
.line 246
invoke-virtual {v0, v4}, Lorg/bitcoinj/protocols/channels/StoredPaymentChannelServerStates;->getChannel(Lorg/bitcoinj/core/Sha256Hash;)Lorg/bitcoinj/protocols/channels/StoredServerChannel;
move-result-object v0
.line 247
if-eqz v0, :cond_101
.line 248
invoke-virtual {v0, p0, v2}, Lorg/bitcoinj/protocols/channels/StoredServerChannel;->setConnectedHandler(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Z)Lorg/bitcoinj/protocols/channels/PaymentChannelServer;
move-result-object v2
.line 249
if-eq v2, p0, :cond_d2
.line 250
sget-object v3, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v5, " ... and that channel is already in use, disconnecting other user."
invoke-interface {v3, v5}, Lorg/slf4j/Logger;->warn(Ljava/lang/String;)V
.line 251
invoke-virtual {v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->close()V
.line 252
invoke-virtual {v0, p0, v1}, Lorg/bitcoinj/protocols/channels/StoredServerChannel;->setConnectedHandler(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Z)Lorg/bitcoinj/protocols/channels/PaymentChannelServer;
.line 255
:cond_d2
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Got resume version message, responding with VERSIONS and CHANNEL_OPEN"
invoke-interface {v1, v2}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 256
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
iget-object v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->broadcaster:Lorg/bitcoinj/core/TransactionBroadcaster;
invoke-virtual {v0, v1, v2}, Lorg/bitcoinj/protocols/channels/StoredServerChannel;->getOrCreateState(Lorg/bitcoinj/wallet/Wallet;Lorg/bitcoinj/core/TransactionBroadcaster;)Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
move-result-object v0
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
.line 257
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->CHANNEL_OPEN:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
.line 258
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v1
sget-object v2, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->CHANNEL_OPEN:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
.line 259
invoke-virtual {v1, v2}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v1
.line 260
invoke-virtual {v1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v1
.line 258
invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.line 261
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-interface {v0, v4}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->channelOpen(Lorg/bitcoinj/core/Sha256Hash;)V
goto/16 :goto_52
.line 264
:cond_101
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, " ... but we do not have any record of that contract! Resume failed."
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->error(Ljava/lang/String;)V
.line 270
:cond_108
:goto_108
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "Got initial version message, responding with VERSIONS and INITIATE: min value={}"
iget-object v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minAcceptedChannelSize:Lorg/bitcoinj/core/Coin;
iget-wide v4, v2, Lorg/bitcoinj/core/Coin;->value:J
.line 271
invoke-static {v4, v5}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v2
.line 270
invoke-interface {v0, v1, v2}, Lorg/slf4j/Logger;->info(Ljava/lang/String;Ljava/lang/Object;)V
.line 273
new-instance v0, Lorg/bitcoinj/core/ECKey;
invoke-direct {v0}, Lorg/bitcoinj/core/ECKey;-><init>()V
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->myKey:Lorg/bitcoinj/core/ECKey;
.line 274
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
invoke-virtual {v0}, Lorg/bitcoinj/wallet/Wallet;->freshReceiveKey()Lorg/bitcoinj/crypto/DeterministicKey;
.line 276
invoke-static {}, Lorg/bitcoinj/core/Utils;->currentTimeSeconds()J
move-result-wide v0
invoke-virtual {v3}, Lorg/bitcoin/paymentchannel/Protos$ClientVersion;->getTimeWindowSecs()J
move-result-wide v2
invoke-direct {p0, v2, v3}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->truncateTimeWindow(J)J
move-result-wide v2
add-long/2addr v0, v2
iput-wide v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->expireTime:J
.line 277
iget v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
packed-switch v0, :pswitch_data_1aa
.line 285
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "Protocol version "
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->majorVersion:I
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, " not supported"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->NO_ACCEPTABLE_VERSION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->NO_ACCEPTABLE_VERSION:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.line 289
:goto_155
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$Initiate;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;
move-result-object v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->myKey:Lorg/bitcoinj/core/ECKey;
.line 290
invoke-virtual {v1}, Lorg/bitcoinj/core/ECKey;->getPubKey()[B
move-result-object v1
invoke-static {v1}, Lcom/google/protobuf/ByteString;->copyFrom([B)Lcom/google/protobuf/ByteString;
move-result-object v1
invoke-virtual {v0, v1}, Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;->setMultisigKey(Lcom/google/protobuf/ByteString;)Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;
move-result-object v0
iget-wide v2, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->expireTime:J
.line 291
invoke-virtual {v0, v2, v3}, Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;->setExpireTimeSecs(J)Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;
move-result-object v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minAcceptedChannelSize:Lorg/bitcoinj/core/Coin;
iget-wide v2, v1, Lorg/bitcoinj/core/Coin;->value:J
.line 292
invoke-virtual {v0, v2, v3}, Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;->setMinAcceptedChannelSize(J)Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;
move-result-object v0
sget-object v1, Lorg/bitcoinj/core/Transaction;->REFERENCE_DEFAULT_MIN_TX_FEE:Lorg/bitcoinj/core/Coin;
iget-wide v2, v1, Lorg/bitcoinj/core/Coin;->value:J
.line 293
invoke-virtual {v0, v2, v3}, Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;->setMinPayment(J)Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;
move-result-object v0
.line 295
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v2
.line 296
invoke-virtual {v2, v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setInitiate(Lorg/bitcoin/paymentchannel/Protos$Initiate$Builder;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
sget-object v2, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->INITIATE:Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
.line 297
invoke-virtual {v0, v2}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->setType(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;)Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
.line 298
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;->build()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;
move-result-object v0
.line 295
invoke-interface {v1, v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->sendToClient(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
goto/16 :goto_52
.line 267
:cond_196
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, " ... but we do not have any stored channels! Resume failed."
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->error(Ljava/lang/String;)V
goto/16 :goto_108
.line 279
:pswitch_19f
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_UNSIGNED_REFUND:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
goto :goto_155
.line 282
:pswitch_1a4
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->WAITING_ON_CONTRACT:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
iput-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
goto :goto_155
.line 277
nop
:pswitch_data_1aa
.packed-switch 0x1
:pswitch_19f
:pswitch_1a4
.end packed-switch
.end method
.method private settlePayment(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
.registers 4
.prologue
.line 522
const/4 v0, 0x1
iput-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->channelSettling:Z
.line 523
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->close()Lcom/google/common/util/concurrent/y;
move-result-object v0
new-instance v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;
invoke-direct {v1, p0, p1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$3;-><init>(Lorg/bitcoinj/protocols/channels/PaymentChannelServer;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
invoke-static {v0, v1}, Lcom/google/common/util/concurrent/r;->a(Lcom/google/common/util/concurrent/y;Lcom/google/common/util/concurrent/q;)V
.line 547
return-void
.end method
.method private truncateTimeWindow(J)J
.registers 10
.prologue
.line 302
iget-wide v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minTimeWindow:J
cmp-long v0, p1, v0
if-gez v0, :cond_1a
.line 303
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "client requested time window {} s to short, offering {} s"
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v2
iget-wide v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minTimeWindow:J
invoke-static {v4, v5}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v3
invoke-interface {v0, v1, v2, v3}, Lorg/slf4j/Logger;->info(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
.line 304
iget-wide p1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minTimeWindow:J
.line 310
:cond_19
:goto_19
return-wide p1
.line 306
:cond_1a
iget-wide v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->maxTimeWindow:J
cmp-long v0, p1, v0
if-lez v0, :cond_19
.line 307
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "client requested time window {} s to long, offering {} s"
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v2
iget-wide v4, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->minTimeWindow:J
invoke-static {v4, v5}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v3
invoke-interface {v0, v1, v2, v3}, Lorg/slf4j/Logger;->info(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
.line 308
iget-wide p1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->maxTimeWindow:J
goto :goto_19
.end method
# virtual methods
.method public close()V
.registers 3
.prologue
.line 604
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->lock()V
.line 606
:try_start_5
iget-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->connectionOpen:Z
if-eqz v0, :cond_26
iget-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->channelSettling:Z
if-nez v0, :cond_26
.line 607
invoke-static {}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->newBuilder()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$Builder;
move-result-object v0
.line 608
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 609
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
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 610
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->SERVER_REQUESTED_CLOSE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->destroyConnection(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_26
.catchall {:try_start_5 .. :try_end_26} :catchall_2c
.line 613
:cond_26
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
.line 614
return-void
.line 613
:catchall_2c
move-exception v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v1}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
throw v0
.end method
.method public connectionClosed()V
.registers 3
.prologue
.line 558
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->lock()V
.line 560
:try_start_5
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "Server channel closed."
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 561
const/4 v0, 0x0
iput-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->connectionOpen:Z
:try_end_f
.catchall {:try_start_5 .. :try_end_f} :catchall_44
.line 564
:try_start_f
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
if-eqz v0, :cond_3e
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->getContract()Lorg/bitcoinj/core/Transaction;
move-result-object v0
if-eqz v0, :cond_3e
.line 565
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->wallet:Lorg/bitcoinj/wallet/Wallet;
.line 566
invoke-virtual {v0}, Lorg/bitcoinj/wallet/Wallet;->getExtensions()Ljava/util/Map;
move-result-object v0
sget-object v1, Lorg/bitcoinj/protocols/channels/StoredPaymentChannelServerStates;->EXTENSION_ID:Ljava/lang/String;
invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/bitcoinj/protocols/channels/StoredPaymentChannelServerStates;
.line 567
if-eqz v0, :cond_3e
.line 568
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
invoke-virtual {v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;->getContract()Lorg/bitcoinj/core/Transaction;
move-result-object v1
invoke-virtual {v1}, Lorg/bitcoinj/core/Transaction;->getHash()Lorg/bitcoinj/core/Sha256Hash;
move-result-object v1
invoke-virtual {v0, v1}, Lorg/bitcoinj/protocols/channels/StoredPaymentChannelServerStates;->getChannel(Lorg/bitcoinj/core/Sha256Hash;)Lorg/bitcoinj/protocols/channels/StoredServerChannel;
move-result-object v0
.line 569
if-eqz v0, :cond_3e
.line 570
invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/StoredServerChannel;->clearConnectedHandler()V
:try_end_3e
.catch Ljava/lang/IllegalStateException; {:try_start_f .. :try_end_3e} :catch_4b
.catchall {:try_start_f .. :try_end_3e} :catchall_44
.line 578
:cond_3e
:goto_3e
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
.line 579
return-void
.line 578
:catchall_44
move-exception v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v1}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
throw v0
:catch_4b
move-exception v0
goto :goto_3e
.end method
.method public connectionOpen()V
.registers 3
.prologue
.line 586
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->lock()V
.line 588
:try_start_5
sget-object v0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v1, "New server channel active."
invoke-interface {v0, v1}, Lorg/slf4j/Logger;->info(Ljava/lang/String;)V
.line 589
const/4 v0, 0x1
iput-boolean v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->connectionOpen:Z
:try_end_f
.catchall {:try_start_5 .. :try_end_f} :catchall_15
.line 591
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
.line 592
return-void
.line 591
:catchall_15
move-exception v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v1}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
throw v0
.end method
.method public receiveMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
.registers 6
.prologue
const/4 v0, 0x1
.line 443
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v1}, Ljava/util/concurrent/locks/ReentrantLock;->lock()V
.line 445
:try_start_6
iget-boolean v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->connectionOpen:Z
invoke-static {v1}, Lcom/google/common/base/n;->checkState(Z)V
.line 446
iget-boolean v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->channelSettling:Z
:try_end_d
.catchall {:try_start_6 .. :try_end_d} :catchall_c8
if-eqz v1, :cond_15
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
.line 491
:goto_14
return-void
.line 449
:cond_15
:try_start_15
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$4;->$SwitchMap$org$bitcoin$paymentchannel$Protos$TwoWayChannelMessage$MessageType:[I
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getType()Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;
move-result-object v2
invoke-virtual {v2}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage$MessageType;->ordinal()I
move-result v2
aget v1, v1, v2
packed-switch v1, :pswitch_data_10e
.line 474
const-string v0, "Got unknown message type or type that doesn\'t apply to servers."
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->SYNTAX_ERROR:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_2d
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_15 .. :try_end_2d} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_15 .. :try_end_2d} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_15 .. :try_end_2d} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_15 .. :try_end_2d} :catch_f9
.catchall {:try_start_15 .. :try_end_2d} :catchall_c8
.line 490
:goto_2d
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_14
.line 451
:pswitch_33
:try_start_33
invoke-direct {p0, p1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->receiveVersionMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
:try_end_36
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_33 .. :try_end_36} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_33 .. :try_end_36} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_33 .. :try_end_36} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_33 .. :try_end_36} :catch_f9
.catchall {:try_start_33 .. :try_end_36} :catchall_c8
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_14
.line 454
:pswitch_3c
:try_start_3c
invoke-direct {p0, p1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->receiveRefundMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
:try_end_3f
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_3c .. :try_end_3f} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_3c .. :try_end_3f} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_3c .. :try_end_3f} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_3c .. :try_end_3f} :catch_f9
.catchall {:try_start_3c .. :try_end_3f} :catchall_c8
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_14
.line 457
:pswitch_45
:try_start_45
invoke-direct {p0, p1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->receiveContractMessage(Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;)V
:try_end_48
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_45 .. :try_end_48} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_45 .. :try_end_48} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_45 .. :try_end_48} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_45 .. :try_end_48} :catch_f9
.catchall {:try_start_45 .. :try_end_48} :catchall_c8
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_14
.line 460
:pswitch_4e
:try_start_4e
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->step:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;->CHANNEL_OPEN:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$InitStep;
if-ne v1, v2, :cond_6b
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->hasUpdatePayment()Z
move-result v1
if-eqz v1, :cond_6b
:goto_5a
invoke-static {v0}, Lcom/google/common/base/n;->checkState(Z)V
.line 461
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getUpdatePayment()Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;
move-result-object v0
const/4 v1, 0x1
invoke-direct {p0, v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->receiveUpdatePaymentMessage(Lorg/bitcoin/paymentchannel/Protos$UpdatePayment;Z)V
:try_end_65
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_4e .. :try_end_65} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_4e .. :try_end_65} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_4e .. :try_end_65} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_4e .. :try_end_65} :catch_f9
.catchall {:try_start_4e .. :try_end_65} :catchall_c8
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_14
.line 460
:cond_6b
const/4 v0, 0x0
goto :goto_5a
.line 464
:pswitch_6d
:try_start_6d
invoke-direct {p0}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->receiveCloseMessage()V
:try_end_70
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_6d .. :try_end_70} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_6d .. :try_end_70} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_6d .. :try_end_70} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_6d .. :try_end_70} :catch_f9
.catchall {:try_start_6d .. :try_end_70} :catchall_c8
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto :goto_14
.line 467
:pswitch_76
:try_start_76
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->hasError()Z
move-result v0
invoke-static {v0}, Lcom/google/common/base/n;->checkState(Z)V
.line 468
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Client sent ERROR {} with explanation {}"
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getError()Lorg/bitcoin/paymentchannel/Protos$Error;
move-result-object v0
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$Error;->getCode()Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
move-result-object v0
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->name()Ljava/lang/String;
move-result-object v3
.line 469
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getError()Lorg/bitcoin/paymentchannel/Protos$Error;
move-result-object v0
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$Error;->hasExplanation()Z
move-result v0
if-eqz v0, :cond_b0
invoke-virtual {p1}, Lorg/bitcoin/paymentchannel/Protos$TwoWayChannelMessage;->getError()Lorg/bitcoin/paymentchannel/Protos$Error;
move-result-object v0
invoke-virtual {v0}, Lorg/bitcoin/paymentchannel/Protos$Error;->getExplanation()Ljava/lang/String;
move-result-object v0
.line 468
:goto_9f
invoke-interface {v1, v2, v3, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
.line 470
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->conn:Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_ERROR:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-interface {v0, v1}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer$ServerConnection;->destroyConnection(Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_a9
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_76 .. :try_end_a9} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_76 .. :try_end_a9} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_76 .. :try_end_a9} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_76 .. :try_end_a9} :catch_f9
.catchall {:try_start_76 .. :try_end_a9} :catchall_c8
.line 490
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v0}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
goto/16 :goto_14
.line 469
:cond_b0
:try_start_b0
const-string v0, ""
:try_end_b2
.catch Lorg/bitcoinj/core/VerificationException; {:try_start_b0 .. :try_end_b2} :catch_b3
.catch Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException; {:try_start_b0 .. :try_end_b2} :catch_cf
.catch Lorg/bitcoinj/core/InsufficientMoneyException; {:try_start_b0 .. :try_end_b2} :catch_e4
.catch Ljava/lang/IllegalStateException; {:try_start_b0 .. :try_end_b2} :catch_f9
.catchall {:try_start_b0 .. :try_end_b2} :catchall_c8
goto :goto_9f
.line 476
:catch_b3
move-exception v0
.line 477
:try_start_b4
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Caught verification exception handling message from client"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 478
invoke-virtual {v0}, Lorg/bitcoinj/core/VerificationException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->BAD_TRANSACTION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_c6
.catchall {:try_start_b4 .. :try_end_c6} :catchall_c8
goto/16 :goto_2d
.line 490
:catchall_c8
move-exception v0
iget-object v1, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->lock:Ljava/util/concurrent/locks/ReentrantLock;
invoke-virtual {v1}, Ljava/util/concurrent/locks/ReentrantLock;->unlock()V
throw v0
.line 479
:catch_cf
move-exception v0
.line 480
:try_start_d0
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Caught value out of range exception handling message from client"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 481
invoke-virtual {v0}, Lorg/bitcoinj/protocols/channels/ValueOutOfRangeException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->BAD_TRANSACTION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
goto/16 :goto_2d
.line 482
:catch_e4
move-exception v0
.line 483
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Caught insufficient money exception handling message from client"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 484
invoke-virtual {v0}, Lorg/bitcoinj/core/InsufficientMoneyException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->BAD_TRANSACTION:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
goto/16 :goto_2d
.line 485
:catch_f9
move-exception v0
.line 486
sget-object v1, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->log:Lorg/slf4j/Logger;
const-string v2, "Caught illegal state exception handling message from client"
invoke-interface {v1, v2, v0}, Lorg/slf4j/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 487
invoke-virtual {v0}, Ljava/lang/IllegalStateException;->getMessage()Ljava/lang/String;
move-result-object v0
sget-object v1, Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;->SYNTAX_ERROR:Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;
sget-object v2, Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;->REMOTE_SENT_INVALID_MESSAGE:Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;
invoke-direct {p0, v0, v1, v2}, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->error(Ljava/lang/String;Lorg/bitcoin/paymentchannel/Protos$Error$ErrorCode;Lorg/bitcoinj/protocols/channels/PaymentChannelCloseException$CloseReason;)V
:try_end_10c
.catchall {:try_start_d0 .. :try_end_10c} :catchall_c8
goto/16 :goto_2d
.line 449
:pswitch_data_10e
.packed-switch 0x1
:pswitch_33
:pswitch_3c
:pswitch_45
:pswitch_4e
:pswitch_6d
:pswitch_76
.end packed-switch
.end method
.method public state()Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
.registers 2
.prologue
.line 219
iget-object v0, p0, Lorg/bitcoinj/protocols/channels/PaymentChannelServer;->state:Lorg/bitcoinj/protocols/channels/PaymentChannelServerState;
return-object v0
.end method