diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
new file mode 100644
index 00000000000..9f7a1f135d7
--- /dev/null
+++ b/.github/CONTRIBUTING.md
@@ -0,0 +1,7 @@
+# Contributing Guidelines
+
+We love pull requests from everyone! Bug reports are also welcome.
+
+However if you've got a question or would like to start a discussion, please post to the
+[bitcoinj google group](https://groups.google.com/forum/#!forum/bitcoinj) or the
+[Bitcoin stack exchange](https://bitcoin.stackexchange.com/questions/tagged/bitcoinj).
diff --git a/.gitignore b/.gitignore
index 7a2b0042e96..2c21d5cc6d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,15 @@
target
+build
+.gradle
+gradlew
+gradlew.bat
+gradle/wrapper
.project
.classpath
.settings
+bin/
.idea
*.iml
+out/
*.chain
*.spvchain
diff --git a/.travis.yml b/.travis.yml
index 2ead96e7fed..8ed5d348396 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,15 @@
# configuration for https://travis-ci.org/bitcoinj/bitcoinj
sudo: false
+dist: xenial
language: java
-jdk: oraclejdk8
-install: true # remove default
+jdk:
+ - openjdk8
+ - openjdk11
+install: true
+before_script:
+ - gradle wrapper --gradle-version=4.10.3
script:
- - mvn -q clean install -Pno-network
- - jdk_switcher use openjdk6
- - cd orchid
- - mvn -q clean package
- - cd ../core
- - mvn -q clean package -Pno-network
-
-after_success:
- - cd ../core
- - mvn jacoco:report coveralls:report
+ - ./gradlew clean build
notifications:
irc:
diff --git a/AUTHORS b/AUTHORS
index 96ec32613df..8e0c740e720 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,36 +4,55 @@ Aaron Voisine
Adam Mackler
Alexander Lolis
Alex Taylor
+Alex Voloshko
+Alok Menghrajani
Alon Muroch
Amichai Rothman
Andreas Schildbach
andrewtoth
+Bas van Schaik
Bennett Hoffman
+BigAdam2005
+Bo-Ye
Carlos Lopez-Camey
Carsten Otto
+Chang Ming
Chris
cyberzac
+Daniel James
Dave Collins
+David Kingsbury
+David Wilson (dcw312)
dexX7
Diego Basch
elbandi
eleetas
En-Ran Zhou
+Eric Winer
Erik Tierney
Fireduck
freak
Gary Rowe
Giannis Dzegoutanis
+Gitju
+Giuseppe Raveduto
Glenn Marien
GreenAddress
+Greg Laun
gubatron
Harald Hoyer
Jakob Stuber
Jameson Lopp
+Jan Vornberger
Jarl Fransson
+Jean-Pierre Rupp
Jim Burton
Jiri Peinlich
Johnathan
+John L. Jegutanis
+Johny George
+Jonathan Cross
+Jon Griffiths
Jonny Heggheim
Justas Dobiliauskas
Kalpesh Parmar
@@ -50,6 +69,8 @@ Martin Zachrison
matija.mazi@gmail.com
Matt Bogosian
Matt Corallo
+Matthew Leon
+Matthew Shaylor
Michael Bell
Michael Bumann
Mike Hearn
@@ -58,6 +79,8 @@ Miron Cuperman
monk
Mora Zyx
mruddy
+Nelson Melina
+Nicola Atzei
ollekullberg
Oscar Guindzberg
Pavol Rusnak
@@ -65,15 +88,21 @@ peacekeeper
Peter Dettman
Peter Stockli
Peter Todd
+Philip Whitehouse
Piotr Włodarek
-Richard Green
+Richard Green (ragmondo)
Robin Owens
+Ronald Hoffman (ScripterRon)
Ross Nicoll
+Saulius Beinorius
Sean Gilligan
Sebastian Ortega
Simon de la Rouviere
Simon Vermeersch
+Stephan Oeste
Stephen Reed
+Thomas König
+Tomasz Ludek
troggy
Tyler Houlihan
Willem Noort
@@ -81,3 +110,4 @@ Will Shackleton
Wojciech Langiewicz
Xiaofeng Guo
Ximo Guanter
+zkejid
diff --git a/README.md b/README.md
index 76b95d1be30..cc4beff025d 100644
--- a/README.md
+++ b/README.md
@@ -8,51 +8,49 @@ The bitcoinj library is a Java implementation of the Bitcoin protocol, which all
### Technologies
-* Java 6 for the core modules, Java 8 for everything else
-* [Maven 3+](http://maven.apache.org) - for building the project
-* [Orchid](https://github.com/subgraph/Orchid) - for secure communications over [TOR](https://www.torproject.org)
-* [Google Protocol Buffers](https://code.google.com/p/protobuf/) - for use with serialization and hardware communications
+* Java 7+ and Gradle 3.4+ for the `core` module
+* Java 8+ and Gradle 3.4+ for `tools` and `examples`
+* Java 11+ and Gradle 4.10+ for the JavaFX-based `wallettemplate`
+* [Gradle](https://gradle.org/) - for building the project
+* [Google Protocol Buffers](https://github.com/google/protobuf) - for use with serialization and hardware communications
### Getting started
-To get started, it is best to have the latest JDK and Maven installed. The HEAD of the `master` branch contains the latest development code and various production releases are provided on feature branches.
+To get started, it is best to have the latest JDK and Gradle installed. The HEAD of the `master` branch contains the latest development code and various production releases are provided on feature branches.
#### Building from the command line
-To perform a full build use
+Official builds are currently using with JDK 8, even though the `core` module is compatible with JDK 7 and later.
+
+To perform a full build (*including* JavaDocs and unit/integration *tests*) use JDK 8+
```
-mvn clean package
+gradle clean build
```
-You can also run
+If you are running JDK 11 or later and Gradle 4.10 or later, the build will automatically include the JavaFX-based `wallettemplate` module. The outputs are under the `build` directory.
+
+To perform a full build *without* unit/integration *tests* use:
```
-mvn site:site
+gradle clean assemble
```
-to generate a website with useful information like JavaDocs.
-
-The outputs are under the `target` directory.
#### Building from an IDE
-Alternatively, just import the project using your IDE. [IntelliJ](http://www.jetbrains.com/idea/download/) has Maven integration built-in and has a free Community Edition. Simply use `File | Import Project` and locate the `pom.xml` in the root of the cloned project source tree.
+Alternatively, just import the project using your IDE. [IntelliJ](http://www.jetbrains.com/idea/download/) has Gradle integration built-in and has a free Community Edition. Simply use `File | New | Project from Existing Sources` and locate the `build.gradle` in the root of the cloned project source tree.
### Example applications
These are found in the `examples` module.
-#### Forwarding service
+### Where next?
-This will download the block chain and eventually print a Bitcoin address that it has generated.
+Now you are ready to [follow the tutorial](https://bitcoinj.github.io/getting-started).
-If you send coins to that address, it will forward them on to the address you specified.
+### Testing a SNAPSHOT build
-```
- cd examples
- mvn exec:java -Dexec.mainClass=org.bitcoinj.examples.ForwardingService -Dexec.args="required string ip_address = 1;
*/
@@ -224,12 +213,8 @@ public int getServices() {
return services_;
}
- private void initFields() {
- ipAddress_ = "";
- port_ = 0;
- services_ = 0;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -251,11 +236,11 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeBytes(1, getIpAddressBytes());
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ipAddress_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeUInt32(2, port_);
@@ -263,18 +248,17 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeUInt32(3, services_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(1, getIpAddressBytes());
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, ipAddress_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
@@ -284,18 +268,76 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, services_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.crawler.PeerSeedProtos.PeerSeedData)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.crawler.PeerSeedProtos.PeerSeedData other = (org.bitcoin.crawler.PeerSeedProtos.PeerSeedData) obj;
+
+ boolean result = true;
+ result = result && (hasIpAddress() == other.hasIpAddress());
+ if (hasIpAddress()) {
+ result = result && getIpAddress()
+ .equals(other.getIpAddress());
+ }
+ result = result && (hasPort() == other.hasPort());
+ if (hasPort()) {
+ result = result && (getPort()
+ == other.getPort());
+ }
+ result = result && (hasServices() == other.hasServices());
+ if (hasServices()) {
+ result = result && (getServices()
+ == other.getServices());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
}
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasIpAddress()) {
+ hash = (37 * hash) + IP_ADDRESS_FIELD_NUMBER;
+ hash = (53 * hash) + getIpAddress().hashCode();
+ }
+ if (hasPort()) {
+ hash = (37 * hash) + PORT_FIELD_NUMBER;
+ hash = (53 * hash) + getPort();
+ }
+ if (hasServices()) {
+ hash = (37 * hash) + SERVICES_FIELD_NUMBER;
+ hash = (53 * hash) + getServices();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -319,46 +361,59 @@ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.crawler.PeerSeedProtos.PeerSeedData prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@@ -366,7 +421,7 @@ protected Builder newBuilderForType(
* Protobuf type {@code org.bitcoin.crawler.PeerSeedData}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
boolean hasTimestamp();
/**
- * required uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
long getTimestamp();
@@ -726,37 +854,34 @@ org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder getSeedOrBuilder(
/**
* Protobuf type {@code org.bitcoin.crawler.PeerSeeds}
*/
- public static final class PeerSeeds extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class PeerSeeds extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:org.bitcoin.crawler.PeerSeeds)
PeerSeedsOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use PeerSeeds.newBuilder() to construct.
- private PeerSeeds(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private PeerSeeds(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private PeerSeeds(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final PeerSeeds defaultInstance;
- public static PeerSeeds getDefaultInstance() {
- return defaultInstance;
}
-
- public PeerSeeds getDefaultInstanceForType() {
- return defaultInstance;
+ private PeerSeeds() {
+ seed_ = java.util.Collections.emptyList();
+ timestamp_ = 0L;
+ net_ = "";
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private PeerSeeds(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -768,19 +893,13 @@ private PeerSeeds(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
seed_ = new java.util.ArrayListrequired uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
public boolean hasTimestamp() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
public long getTimestamp() {
return timestamp_;
}
public static final int NET_FIELD_NUMBER = 3;
- private java.lang.Object net_;
+ private volatile java.lang.Object net_;
/**
* required string net = 3;
*/
@@ -937,12 +1049,8 @@ public java.lang.String getNet() {
}
}
- private void initFields() {
- seed_ = java.util.Collections.emptyList();
- timestamp_ = 0L;
- net_ = "";
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -966,9 +1074,9 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
for (int i = 0; i < seed_.size(); i++) {
output.writeMessage(1, seed_.get(i));
}
@@ -976,14 +1084,14 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
output.writeUInt64(2, timestamp_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeBytes(3, getNetBytes());
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 3, net_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -996,21 +1104,76 @@ public int getSerializedSize() {
.computeUInt64Size(2, timestamp_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
- size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(3, getNetBytes());
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, net_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.crawler.PeerSeedProtos.PeerSeeds)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.crawler.PeerSeedProtos.PeerSeeds other = (org.bitcoin.crawler.PeerSeedProtos.PeerSeeds) obj;
+
+ boolean result = true;
+ result = result && getSeedList()
+ .equals(other.getSeedList());
+ result = result && (hasTimestamp() == other.hasTimestamp());
+ if (hasTimestamp()) {
+ result = result && (getTimestamp()
+ == other.getTimestamp());
+ }
+ result = result && (hasNet() == other.hasNet());
+ if (hasNet()) {
+ result = result && getNet()
+ .equals(other.getNet());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (getSeedCount() > 0) {
+ hash = (37 * hash) + SEED_FIELD_NUMBER;
+ hash = (53 * hash) + getSeedList().hashCode();
+ }
+ if (hasTimestamp()) {
+ hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getTimestamp());
+ }
+ if (hasNet()) {
+ hash = (37 * hash) + NET_FIELD_NUMBER;
+ hash = (53 * hash) + getNet().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -1034,46 +1197,59 @@ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.crawler.PeerSeedProtos.PeerSeeds prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@@ -1081,7 +1257,7 @@ protected Builder newBuilderForType(
* Protobuf type {@code org.bitcoin.crawler.PeerSeeds}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
public boolean hasTimestamp() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
public long getTimestamp() {
return timestamp_;
}
/**
- * required uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
public Builder setTimestamp(long value) {
bitField0_ |= 0x00000002;
@@ -1538,11 +1746,11 @@ public Builder setTimestamp(long value) {
return this;
}
/**
- * required uint64 timestamp = 2;
- *
*
* seconds since UNIX epoch
*
+ *
+ * required uint64 timestamp = 2;
*/
public Builder clearTimestamp() {
bitField0_ = (bitField0_ & ~0x00000002);
@@ -1626,16 +1834,57 @@ public Builder setNetBytes(
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:org.bitcoin.crawler.PeerSeeds)
}
+ // @@protoc_insertion_point(class_scope:org.bitcoin.crawler.PeerSeeds)
+ private static final org.bitcoin.crawler.PeerSeedProtos.PeerSeeds DEFAULT_INSTANCE;
static {
- defaultInstance = new PeerSeeds(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.crawler.PeerSeedProtos.PeerSeeds();
+ }
+
+ public static org.bitcoin.crawler.PeerSeedProtos.PeerSeeds getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parserrequired .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
boolean hasType();
/**
- * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType getType();
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
boolean hasClientVersion();
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
org.bitcoin.paymentchannel.Protos.ClientVersion getClientVersion();
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder getClientVersionOrBuilder();
@@ -176,45 +182,40 @@ public interface TwoWayChannelMessageOrBuilder extends
org.bitcoin.paymentchannel.Protos.ErrorOrBuilder getErrorOrBuilder();
}
/**
- * Protobuf type {@code paymentchannels.TwoWayChannelMessage}
- *
*
* This message is designed to be either sent raw over the network (e.g. length prefixed) or embedded inside another
* protocol that is being extended to support micropayments. In this file "primary" typically can be read as "client"
* and "secondary" as "server".
*
+ *
+ * Protobuf type {@code paymentchannels.TwoWayChannelMessage}
*/
- public static final class TwoWayChannelMessage extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class TwoWayChannelMessage extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.TwoWayChannelMessage)
TwoWayChannelMessageOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use TwoWayChannelMessage.newBuilder() to construct.
- private TwoWayChannelMessage(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private TwoWayChannelMessage(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private TwoWayChannelMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final TwoWayChannelMessage defaultInstance;
- public static TwoWayChannelMessage getDefaultInstance() {
- return defaultInstance;
}
-
- public TwoWayChannelMessage getDefaultInstanceForType() {
- return defaultInstance;
+ private TwoWayChannelMessage() {
+ type_ = 1;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private TwoWayChannelMessage(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -226,21 +227,15 @@ private TwoWayChannelMessage(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 8: {
int rawValue = input.readEnum();
+ @SuppressWarnings("deprecation")
org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType value = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.valueOf(rawValue);
if (value == null) {
unknownFields.mergeVarintField(1, rawValue);
} else {
bitField0_ |= 0x00000001;
- type_ = value;
+ type_ = rawValue;
}
break;
}
@@ -374,13 +369,20 @@ private TwoWayChannelMessage(
bitField0_ |= 0x00000100;
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -391,28 +393,14 @@ private TwoWayChannelMessage(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_TwoWayChannelMessage_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_TwoWayChannelMessage_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.class, org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.Builder.class);
}
- public static com.google.protobuf.ParserCLIENT_VERSION = 1;
*/
- CLIENT_VERSION(0, 1),
+ CLIENT_VERSION(1),
/**
* SERVER_VERSION = 2;
*/
- SERVER_VERSION(1, 2),
+ SERVER_VERSION(2),
/**
* INITIATE = 3;
*/
- INITIATE(2, 3),
+ INITIATE(3),
/**
* PROVIDE_REFUND = 4;
*/
- PROVIDE_REFUND(3, 4),
+ PROVIDE_REFUND(4),
/**
* RETURN_REFUND = 5;
*/
- RETURN_REFUND(4, 5),
+ RETURN_REFUND(5),
/**
* PROVIDE_CONTRACT = 6;
*/
- PROVIDE_CONTRACT(5, 6),
+ PROVIDE_CONTRACT(6),
/**
- * CHANNEL_OPEN = 7;
- *
*
* Note that there are no optional fields set for CHANNEL_OPEN, it is sent from the
* secondary to the primary to indicate that the provided contract was received,
@@ -454,23 +440,23 @@ public enum MessageType
* reopen the channel by setting the contract transaction hash in its CLIENT_VERSION
* message.
*
+ *
+ * CHANNEL_OPEN = 7;
*/
- CHANNEL_OPEN(6, 7),
+ CHANNEL_OPEN(7),
/**
* UPDATE_PAYMENT = 8;
*/
- UPDATE_PAYMENT(7, 8),
+ UPDATE_PAYMENT(8),
/**
- * PAYMENT_ACK = 11;
- *
*
* Sent by the server to the client after an UPDATE_PAYMENT message is successfully processed.
*
+ *
+ * PAYMENT_ACK = 11;
*/
- PAYMENT_ACK(8, 11),
+ PAYMENT_ACK(11),
/**
- * CLOSE = 9;
- *
*
* Either side can send this message. If the client sends it to the server, then the server
* takes the most recent signature it received in an UPDATE_PAYMENT and uses it to create a
@@ -483,19 +469,21 @@ public enum MessageType
* case this is just an equivalent to a TCP FIN packet. An explicit end-of-protocol markers can be
* useful when this protocol is embedded inside another.
*
+ *
+ * CLOSE = 9;
*/
- CLOSE(9, 9),
+ CLOSE(9),
/**
- * ERROR = 10;
- *
*
* Used to indicate an error condition.
* Both parties should make an effort to send either an ERROR or a CLOSE immediately
* before closing the socket (unless they just received an ERROR or a CLOSE). This is important
* because the protocol may not run over TCP.
*
+ *
+ * ERROR = 10;
*/
- ERROR(10, 10),
+ ERROR(10),
;
/**
@@ -523,8 +511,6 @@ public enum MessageType
*/
public static final int PROVIDE_CONTRACT_VALUE = 6;
/**
- * CHANNEL_OPEN = 7;
- *
*
* Note that there are no optional fields set for CHANNEL_OPEN, it is sent from the
* secondary to the primary to indicate that the provided contract was received,
@@ -534,6 +520,8 @@ public enum MessageType
* reopen the channel by setting the contract transaction hash in its CLIENT_VERSION
* message.
*
+ *
+ * CHANNEL_OPEN = 7;
*/
public static final int CHANNEL_OPEN_VALUE = 7;
/**
@@ -541,16 +529,14 @@ public enum MessageType
*/
public static final int UPDATE_PAYMENT_VALUE = 8;
/**
- * PAYMENT_ACK = 11;
- *
*
* Sent by the server to the client after an UPDATE_PAYMENT message is successfully processed.
*
+ *
+ * PAYMENT_ACK = 11;
*/
public static final int PAYMENT_ACK_VALUE = 11;
/**
- * CLOSE = 9;
- *
*
* Either side can send this message. If the client sends it to the server, then the server
* takes the most recent signature it received in an UPDATE_PAYMENT and uses it to create a
@@ -563,24 +549,36 @@ public enum MessageType
* case this is just an equivalent to a TCP FIN packet. An explicit end-of-protocol markers can be
* useful when this protocol is embedded inside another.
*
+ *
+ * CLOSE = 9;
*/
public static final int CLOSE_VALUE = 9;
/**
- * ERROR = 10;
- *
*
* Used to indicate an error condition.
* Both parties should make an effort to send either an ERROR or a CLOSE immediately
* before closing the socket (unless they just received an ERROR or a CLOSE). This is important
* because the protocol may not run over TCP.
*
+ *
+ * ERROR = 10;
*/
public static final int ERROR_VALUE = 10;
- public final int getNumber() { return value; }
+ public final int getNumber() {
+ return value;
+ }
+ /**
+ * @deprecated Use {@link #forNumber(int)} instead.
+ */
+ @java.lang.Deprecated
public static MessageType valueOf(int value) {
+ return forNumber(value);
+ }
+
+ public static MessageType forNumber(int value) {
switch (value) {
case 1: return CLIENT_VERSION;
case 2: return SERVER_VERSION;
@@ -601,17 +599,17 @@ public static MessageType valueOf(int value) {
internalGetValueMap() {
return internalValueMap;
}
- private static com.google.protobuf.Internal.EnumLiteMaprequired .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
public boolean hasType() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType getType() {
- return type_;
+ @SuppressWarnings("deprecation")
+ org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType result = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.valueOf(type_);
+ return result == null ? org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.CLIENT_VERSION : result;
}
public static final int CLIENT_VERSION_FIELD_NUMBER = 2;
private org.bitcoin.paymentchannel.Protos.ClientVersion clientVersion_;
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public boolean hasClientVersion() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public org.bitcoin.paymentchannel.Protos.ClientVersion getClientVersion() {
- return clientVersion_;
+ return clientVersion_ == null ? org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance() : clientVersion_;
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder getClientVersionOrBuilder() {
- return clientVersion_;
+ return clientVersion_ == null ? org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance() : clientVersion_;
}
public static final int SERVER_VERSION_FIELD_NUMBER = 3;
@@ -717,13 +715,13 @@ public boolean hasServerVersion() {
* optional .paymentchannels.ServerVersion server_version = 3;
*/
public org.bitcoin.paymentchannel.Protos.ServerVersion getServerVersion() {
- return serverVersion_;
+ return serverVersion_ == null ? org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance() : serverVersion_;
}
/**
* optional .paymentchannels.ServerVersion server_version = 3;
*/
public org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder getServerVersionOrBuilder() {
- return serverVersion_;
+ return serverVersion_ == null ? org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance() : serverVersion_;
}
public static final int INITIATE_FIELD_NUMBER = 4;
@@ -738,13 +736,13 @@ public boolean hasInitiate() {
* optional .paymentchannels.Initiate initiate = 4;
*/
public org.bitcoin.paymentchannel.Protos.Initiate getInitiate() {
- return initiate_;
+ return initiate_ == null ? org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance() : initiate_;
}
/**
* optional .paymentchannels.Initiate initiate = 4;
*/
public org.bitcoin.paymentchannel.Protos.InitiateOrBuilder getInitiateOrBuilder() {
- return initiate_;
+ return initiate_ == null ? org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance() : initiate_;
}
public static final int PROVIDE_REFUND_FIELD_NUMBER = 5;
@@ -759,13 +757,13 @@ public boolean hasProvideRefund() {
* optional .paymentchannels.ProvideRefund provide_refund = 5;
*/
public org.bitcoin.paymentchannel.Protos.ProvideRefund getProvideRefund() {
- return provideRefund_;
+ return provideRefund_ == null ? org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance() : provideRefund_;
}
/**
* optional .paymentchannels.ProvideRefund provide_refund = 5;
*/
public org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder getProvideRefundOrBuilder() {
- return provideRefund_;
+ return provideRefund_ == null ? org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance() : provideRefund_;
}
public static final int RETURN_REFUND_FIELD_NUMBER = 6;
@@ -780,13 +778,13 @@ public boolean hasReturnRefund() {
* optional .paymentchannels.ReturnRefund return_refund = 6;
*/
public org.bitcoin.paymentchannel.Protos.ReturnRefund getReturnRefund() {
- return returnRefund_;
+ return returnRefund_ == null ? org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance() : returnRefund_;
}
/**
* optional .paymentchannels.ReturnRefund return_refund = 6;
*/
public org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder getReturnRefundOrBuilder() {
- return returnRefund_;
+ return returnRefund_ == null ? org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance() : returnRefund_;
}
public static final int PROVIDE_CONTRACT_FIELD_NUMBER = 7;
@@ -801,13 +799,13 @@ public boolean hasProvideContract() {
* optional .paymentchannels.ProvideContract provide_contract = 7;
*/
public org.bitcoin.paymentchannel.Protos.ProvideContract getProvideContract() {
- return provideContract_;
+ return provideContract_ == null ? org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance() : provideContract_;
}
/**
* optional .paymentchannels.ProvideContract provide_contract = 7;
*/
public org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder getProvideContractOrBuilder() {
- return provideContract_;
+ return provideContract_ == null ? org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance() : provideContract_;
}
public static final int UPDATE_PAYMENT_FIELD_NUMBER = 8;
@@ -822,13 +820,13 @@ public boolean hasUpdatePayment() {
* optional .paymentchannels.UpdatePayment update_payment = 8;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePayment getUpdatePayment() {
- return updatePayment_;
+ return updatePayment_ == null ? org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : updatePayment_;
}
/**
* optional .paymentchannels.UpdatePayment update_payment = 8;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getUpdatePaymentOrBuilder() {
- return updatePayment_;
+ return updatePayment_ == null ? org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : updatePayment_;
}
public static final int PAYMENT_ACK_FIELD_NUMBER = 11;
@@ -843,13 +841,13 @@ public boolean hasPaymentAck() {
* optional .paymentchannels.PaymentAck payment_ack = 11;
*/
public org.bitcoin.paymentchannel.Protos.PaymentAck getPaymentAck() {
- return paymentAck_;
+ return paymentAck_ == null ? org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance() : paymentAck_;
}
/**
* optional .paymentchannels.PaymentAck payment_ack = 11;
*/
public org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder getPaymentAckOrBuilder() {
- return paymentAck_;
+ return paymentAck_ == null ? org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance() : paymentAck_;
}
public static final int SETTLEMENT_FIELD_NUMBER = 9;
@@ -864,13 +862,13 @@ public boolean hasSettlement() {
* optional .paymentchannels.Settlement settlement = 9;
*/
public org.bitcoin.paymentchannel.Protos.Settlement getSettlement() {
- return settlement_;
+ return settlement_ == null ? org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance() : settlement_;
}
/**
* optional .paymentchannels.Settlement settlement = 9;
*/
public org.bitcoin.paymentchannel.Protos.SettlementOrBuilder getSettlementOrBuilder() {
- return settlement_;
+ return settlement_ == null ? org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance() : settlement_;
}
public static final int ERROR_FIELD_NUMBER = 10;
@@ -885,29 +883,17 @@ public boolean hasError() {
* optional .paymentchannels.Error error = 10;
*/
public org.bitcoin.paymentchannel.Protos.Error getError() {
- return error_;
+ return error_ == null ? org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance() : error_;
}
/**
* optional .paymentchannels.Error error = 10;
*/
public org.bitcoin.paymentchannel.Protos.ErrorOrBuilder getErrorOrBuilder() {
- return error_;
- }
-
- private void initFields() {
- type_ = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.CLIENT_VERSION;
- clientVersion_ = org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance();
- serverVersion_ = org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance();
- initiate_ = org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance();
- provideRefund_ = org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance();
- returnRefund_ = org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance();
- provideContract_ = org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance();
- updatePayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance();
- paymentAck_ = org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance();
- settlement_ = org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance();
- error_ = org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance();
+ return error_ == null ? org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance() : error_;
}
+
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -969,107 +955,236 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeEnum(1, type_.getNumber());
+ output.writeEnum(1, type_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeMessage(2, clientVersion_);
+ output.writeMessage(2, getClientVersion());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
- output.writeMessage(3, serverVersion_);
+ output.writeMessage(3, getServerVersion());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
- output.writeMessage(4, initiate_);
+ output.writeMessage(4, getInitiate());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
- output.writeMessage(5, provideRefund_);
+ output.writeMessage(5, getProvideRefund());
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
- output.writeMessage(6, returnRefund_);
+ output.writeMessage(6, getReturnRefund());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
- output.writeMessage(7, provideContract_);
+ output.writeMessage(7, getProvideContract());
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
- output.writeMessage(8, updatePayment_);
+ output.writeMessage(8, getUpdatePayment());
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
- output.writeMessage(9, settlement_);
+ output.writeMessage(9, getSettlement());
}
if (((bitField0_ & 0x00000400) == 0x00000400)) {
- output.writeMessage(10, error_);
+ output.writeMessage(10, getError());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
- output.writeMessage(11, paymentAck_);
+ output.writeMessage(11, getPaymentAck());
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
- .computeEnumSize(1, type_.getNumber());
+ .computeEnumSize(1, type_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(2, clientVersion_);
+ .computeMessageSize(2, getClientVersion());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(3, serverVersion_);
+ .computeMessageSize(3, getServerVersion());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(4, initiate_);
+ .computeMessageSize(4, getInitiate());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(5, provideRefund_);
+ .computeMessageSize(5, getProvideRefund());
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(6, returnRefund_);
+ .computeMessageSize(6, getReturnRefund());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(7, provideContract_);
+ .computeMessageSize(7, getProvideContract());
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(8, updatePayment_);
+ .computeMessageSize(8, getUpdatePayment());
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(9, settlement_);
+ .computeMessageSize(9, getSettlement());
}
if (((bitField0_ & 0x00000400) == 0x00000400)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(10, error_);
+ .computeMessageSize(10, getError());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(11, paymentAck_);
+ .computeMessageSize(11, getPaymentAck());
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage other = (org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage) obj;
+
+ boolean result = true;
+ result = result && (hasType() == other.hasType());
+ if (hasType()) {
+ result = result && type_ == other.type_;
+ }
+ result = result && (hasClientVersion() == other.hasClientVersion());
+ if (hasClientVersion()) {
+ result = result && getClientVersion()
+ .equals(other.getClientVersion());
+ }
+ result = result && (hasServerVersion() == other.hasServerVersion());
+ if (hasServerVersion()) {
+ result = result && getServerVersion()
+ .equals(other.getServerVersion());
+ }
+ result = result && (hasInitiate() == other.hasInitiate());
+ if (hasInitiate()) {
+ result = result && getInitiate()
+ .equals(other.getInitiate());
+ }
+ result = result && (hasProvideRefund() == other.hasProvideRefund());
+ if (hasProvideRefund()) {
+ result = result && getProvideRefund()
+ .equals(other.getProvideRefund());
+ }
+ result = result && (hasReturnRefund() == other.hasReturnRefund());
+ if (hasReturnRefund()) {
+ result = result && getReturnRefund()
+ .equals(other.getReturnRefund());
+ }
+ result = result && (hasProvideContract() == other.hasProvideContract());
+ if (hasProvideContract()) {
+ result = result && getProvideContract()
+ .equals(other.getProvideContract());
+ }
+ result = result && (hasUpdatePayment() == other.hasUpdatePayment());
+ if (hasUpdatePayment()) {
+ result = result && getUpdatePayment()
+ .equals(other.getUpdatePayment());
+ }
+ result = result && (hasPaymentAck() == other.hasPaymentAck());
+ if (hasPaymentAck()) {
+ result = result && getPaymentAck()
+ .equals(other.getPaymentAck());
+ }
+ result = result && (hasSettlement() == other.hasSettlement());
+ if (hasSettlement()) {
+ result = result && getSettlement()
+ .equals(other.getSettlement());
+ }
+ result = result && (hasError() == other.hasError());
+ if (hasError()) {
+ result = result && getError()
+ .equals(other.getError());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasType()) {
+ hash = (37 * hash) + TYPE_FIELD_NUMBER;
+ hash = (53 * hash) + type_;
+ }
+ if (hasClientVersion()) {
+ hash = (37 * hash) + CLIENT_VERSION_FIELD_NUMBER;
+ hash = (53 * hash) + getClientVersion().hashCode();
+ }
+ if (hasServerVersion()) {
+ hash = (37 * hash) + SERVER_VERSION_FIELD_NUMBER;
+ hash = (53 * hash) + getServerVersion().hashCode();
+ }
+ if (hasInitiate()) {
+ hash = (37 * hash) + INITIATE_FIELD_NUMBER;
+ hash = (53 * hash) + getInitiate().hashCode();
+ }
+ if (hasProvideRefund()) {
+ hash = (37 * hash) + PROVIDE_REFUND_FIELD_NUMBER;
+ hash = (53 * hash) + getProvideRefund().hashCode();
+ }
+ if (hasReturnRefund()) {
+ hash = (37 * hash) + RETURN_REFUND_FIELD_NUMBER;
+ hash = (53 * hash) + getReturnRefund().hashCode();
+ }
+ if (hasProvideContract()) {
+ hash = (37 * hash) + PROVIDE_CONTRACT_FIELD_NUMBER;
+ hash = (53 * hash) + getProvideContract().hashCode();
+ }
+ if (hasUpdatePayment()) {
+ hash = (37 * hash) + UPDATE_PAYMENT_FIELD_NUMBER;
+ hash = (53 * hash) + getUpdatePayment().hashCode();
+ }
+ if (hasPaymentAck()) {
+ hash = (37 * hash) + PAYMENT_ACK_FIELD_NUMBER;
+ hash = (53 * hash) + getPaymentAck().hashCode();
+ }
+ if (hasSettlement()) {
+ hash = (37 * hash) + SETTLEMENT_FIELD_NUMBER;
+ hash = (53 * hash) + getSettlement().hashCode();
+ }
+ if (hasError()) {
+ hash = (37 * hash) + ERROR_FIELD_NUMBER;
+ hash = (53 * hash) + getError().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -1093,60 +1208,73 @@ public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.TwoWayChannelMessage}
- *
*
* This message is designed to be either sent raw over the network (e.g. length prefixed) or embedded inside another
* protocol that is being extended to support micropayments. In this file "primary" typically can be read as "client"
* and "secondary" as "server".
*
+ *
+ * Protobuf type {@code paymentchannels.TwoWayChannelMessage}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
public boolean hasType() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType getType() {
- return type_;
+ @SuppressWarnings("deprecation")
+ org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType result = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.valueOf(type_);
+ return result == null ? org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.CLIENT_VERSION : result;
}
/**
- * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
public Builder setType(org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
- type_ = value;
+ type_ = value.getNumber();
onChanged();
return this;
}
/**
- * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
- *
*
* This is required so if a new message type is added in future, old software aborts trying
* to read the message as early as possible. If the message doesn't parse, the socket should
* be closed.
*
+ *
+ * required .paymentchannels.TwoWayChannelMessage.MessageType type = 1;
*/
public Builder clearType() {
bitField0_ = (bitField0_ & ~0x00000001);
- type_ = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.CLIENT_VERSION;
+ type_ = 1;
onChanged();
return this;
}
- private org.bitcoin.paymentchannel.Protos.ClientVersion clientVersion_ = org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.ClientVersion clientVersion_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ClientVersion, org.bitcoin.paymentchannel.Protos.ClientVersion.Builder, org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder> clientVersionBuilder_;
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public boolean hasClientVersion() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public org.bitcoin.paymentchannel.Protos.ClientVersion getClientVersion() {
if (clientVersionBuilder_ == null) {
- return clientVersion_;
+ return clientVersion_ == null ? org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance() : clientVersion_;
} else {
return clientVersionBuilder_.getMessage();
}
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public Builder setClientVersion(org.bitcoin.paymentchannel.Protos.ClientVersion value) {
if (clientVersionBuilder_ == null) {
@@ -1600,11 +1756,11 @@ public Builder setClientVersion(org.bitcoin.paymentchannel.Protos.ClientVersion
return this;
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public Builder setClientVersion(
org.bitcoin.paymentchannel.Protos.ClientVersion.Builder builderForValue) {
@@ -1618,15 +1774,16 @@ public Builder setClientVersion(
return this;
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public Builder mergeClientVersion(org.bitcoin.paymentchannel.Protos.ClientVersion value) {
if (clientVersionBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
+ clientVersion_ != null &&
clientVersion_ != org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance()) {
clientVersion_ =
org.bitcoin.paymentchannel.Protos.ClientVersion.newBuilder(clientVersion_).mergeFrom(value).buildPartial();
@@ -1641,15 +1798,15 @@ public Builder mergeClientVersion(org.bitcoin.paymentchannel.Protos.ClientVersio
return this;
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public Builder clearClientVersion() {
if (clientVersionBuilder_ == null) {
- clientVersion_ = org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance();
+ clientVersion_ = null;
onChanged();
} else {
clientVersionBuilder_.clear();
@@ -1658,11 +1815,11 @@ public Builder clearClientVersion() {
return this;
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public org.bitcoin.paymentchannel.Protos.ClientVersion.Builder getClientVersionBuilder() {
bitField0_ |= 0x00000002;
@@ -1670,31 +1827,32 @@ public org.bitcoin.paymentchannel.Protos.ClientVersion.Builder getClientVersionB
return getClientVersionFieldBuilder().getBuilder();
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
public org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder getClientVersionOrBuilder() {
if (clientVersionBuilder_ != null) {
return clientVersionBuilder_.getMessageOrBuilder();
} else {
- return clientVersion_;
+ return clientVersion_ == null ?
+ org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance() : clientVersion_;
}
}
/**
- * optional .paymentchannels.ClientVersion client_version = 2;
- *
*
* Now one optional field for each message. Only the field specified by type should be read.
*
+ *
+ * optional .paymentchannels.ClientVersion client_version = 2;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ClientVersion, org.bitcoin.paymentchannel.Protos.ClientVersion.Builder, org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder>
getClientVersionFieldBuilder() {
if (clientVersionBuilder_ == null) {
- clientVersionBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ clientVersionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ClientVersion, org.bitcoin.paymentchannel.Protos.ClientVersion.Builder, org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder>(
getClientVersion(),
getParentForChildren(),
@@ -1704,8 +1862,8 @@ public org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder getClientVersion
return clientVersionBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.ServerVersion serverVersion_ = org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.ServerVersion serverVersion_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ServerVersion, org.bitcoin.paymentchannel.Protos.ServerVersion.Builder, org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder> serverVersionBuilder_;
/**
* optional .paymentchannels.ServerVersion server_version = 3;
@@ -1718,7 +1876,7 @@ public boolean hasServerVersion() {
*/
public org.bitcoin.paymentchannel.Protos.ServerVersion getServerVersion() {
if (serverVersionBuilder_ == null) {
- return serverVersion_;
+ return serverVersion_ == null ? org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance() : serverVersion_;
} else {
return serverVersionBuilder_.getMessage();
}
@@ -1759,6 +1917,7 @@ public Builder setServerVersion(
public Builder mergeServerVersion(org.bitcoin.paymentchannel.Protos.ServerVersion value) {
if (serverVersionBuilder_ == null) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ serverVersion_ != null &&
serverVersion_ != org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance()) {
serverVersion_ =
org.bitcoin.paymentchannel.Protos.ServerVersion.newBuilder(serverVersion_).mergeFrom(value).buildPartial();
@@ -1777,7 +1936,7 @@ public Builder mergeServerVersion(org.bitcoin.paymentchannel.Protos.ServerVersio
*/
public Builder clearServerVersion() {
if (serverVersionBuilder_ == null) {
- serverVersion_ = org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance();
+ serverVersion_ = null;
onChanged();
} else {
serverVersionBuilder_.clear();
@@ -1800,17 +1959,18 @@ public org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder getServerVersion
if (serverVersionBuilder_ != null) {
return serverVersionBuilder_.getMessageOrBuilder();
} else {
- return serverVersion_;
+ return serverVersion_ == null ?
+ org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance() : serverVersion_;
}
}
/**
* optional .paymentchannels.ServerVersion server_version = 3;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ServerVersion, org.bitcoin.paymentchannel.Protos.ServerVersion.Builder, org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder>
getServerVersionFieldBuilder() {
if (serverVersionBuilder_ == null) {
- serverVersionBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ serverVersionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ServerVersion, org.bitcoin.paymentchannel.Protos.ServerVersion.Builder, org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder>(
getServerVersion(),
getParentForChildren(),
@@ -1820,8 +1980,8 @@ public org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder getServerVersion
return serverVersionBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.Initiate initiate_ = org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.Initiate initiate_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Initiate, org.bitcoin.paymentchannel.Protos.Initiate.Builder, org.bitcoin.paymentchannel.Protos.InitiateOrBuilder> initiateBuilder_;
/**
* optional .paymentchannels.Initiate initiate = 4;
@@ -1834,7 +1994,7 @@ public boolean hasInitiate() {
*/
public org.bitcoin.paymentchannel.Protos.Initiate getInitiate() {
if (initiateBuilder_ == null) {
- return initiate_;
+ return initiate_ == null ? org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance() : initiate_;
} else {
return initiateBuilder_.getMessage();
}
@@ -1875,6 +2035,7 @@ public Builder setInitiate(
public Builder mergeInitiate(org.bitcoin.paymentchannel.Protos.Initiate value) {
if (initiateBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
+ initiate_ != null &&
initiate_ != org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance()) {
initiate_ =
org.bitcoin.paymentchannel.Protos.Initiate.newBuilder(initiate_).mergeFrom(value).buildPartial();
@@ -1893,7 +2054,7 @@ public Builder mergeInitiate(org.bitcoin.paymentchannel.Protos.Initiate value) {
*/
public Builder clearInitiate() {
if (initiateBuilder_ == null) {
- initiate_ = org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance();
+ initiate_ = null;
onChanged();
} else {
initiateBuilder_.clear();
@@ -1916,17 +2077,18 @@ public org.bitcoin.paymentchannel.Protos.InitiateOrBuilder getInitiateOrBuilder(
if (initiateBuilder_ != null) {
return initiateBuilder_.getMessageOrBuilder();
} else {
- return initiate_;
+ return initiate_ == null ?
+ org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance() : initiate_;
}
}
/**
* optional .paymentchannels.Initiate initiate = 4;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Initiate, org.bitcoin.paymentchannel.Protos.Initiate.Builder, org.bitcoin.paymentchannel.Protos.InitiateOrBuilder>
getInitiateFieldBuilder() {
if (initiateBuilder_ == null) {
- initiateBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ initiateBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Initiate, org.bitcoin.paymentchannel.Protos.Initiate.Builder, org.bitcoin.paymentchannel.Protos.InitiateOrBuilder>(
getInitiate(),
getParentForChildren(),
@@ -1936,8 +2098,8 @@ public org.bitcoin.paymentchannel.Protos.InitiateOrBuilder getInitiateOrBuilder(
return initiateBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.ProvideRefund provideRefund_ = org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.ProvideRefund provideRefund_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ProvideRefund, org.bitcoin.paymentchannel.Protos.ProvideRefund.Builder, org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder> provideRefundBuilder_;
/**
* optional .paymentchannels.ProvideRefund provide_refund = 5;
@@ -1950,7 +2112,7 @@ public boolean hasProvideRefund() {
*/
public org.bitcoin.paymentchannel.Protos.ProvideRefund getProvideRefund() {
if (provideRefundBuilder_ == null) {
- return provideRefund_;
+ return provideRefund_ == null ? org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance() : provideRefund_;
} else {
return provideRefundBuilder_.getMessage();
}
@@ -1991,6 +2153,7 @@ public Builder setProvideRefund(
public Builder mergeProvideRefund(org.bitcoin.paymentchannel.Protos.ProvideRefund value) {
if (provideRefundBuilder_ == null) {
if (((bitField0_ & 0x00000010) == 0x00000010) &&
+ provideRefund_ != null &&
provideRefund_ != org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance()) {
provideRefund_ =
org.bitcoin.paymentchannel.Protos.ProvideRefund.newBuilder(provideRefund_).mergeFrom(value).buildPartial();
@@ -2009,7 +2172,7 @@ public Builder mergeProvideRefund(org.bitcoin.paymentchannel.Protos.ProvideRefun
*/
public Builder clearProvideRefund() {
if (provideRefundBuilder_ == null) {
- provideRefund_ = org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance();
+ provideRefund_ = null;
onChanged();
} else {
provideRefundBuilder_.clear();
@@ -2032,17 +2195,18 @@ public org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder getProvideRefund
if (provideRefundBuilder_ != null) {
return provideRefundBuilder_.getMessageOrBuilder();
} else {
- return provideRefund_;
+ return provideRefund_ == null ?
+ org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance() : provideRefund_;
}
}
/**
* optional .paymentchannels.ProvideRefund provide_refund = 5;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ProvideRefund, org.bitcoin.paymentchannel.Protos.ProvideRefund.Builder, org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder>
getProvideRefundFieldBuilder() {
if (provideRefundBuilder_ == null) {
- provideRefundBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ provideRefundBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ProvideRefund, org.bitcoin.paymentchannel.Protos.ProvideRefund.Builder, org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder>(
getProvideRefund(),
getParentForChildren(),
@@ -2052,8 +2216,8 @@ public org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder getProvideRefund
return provideRefundBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.ReturnRefund returnRefund_ = org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.ReturnRefund returnRefund_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ReturnRefund, org.bitcoin.paymentchannel.Protos.ReturnRefund.Builder, org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder> returnRefundBuilder_;
/**
* optional .paymentchannels.ReturnRefund return_refund = 6;
@@ -2066,7 +2230,7 @@ public boolean hasReturnRefund() {
*/
public org.bitcoin.paymentchannel.Protos.ReturnRefund getReturnRefund() {
if (returnRefundBuilder_ == null) {
- return returnRefund_;
+ return returnRefund_ == null ? org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance() : returnRefund_;
} else {
return returnRefundBuilder_.getMessage();
}
@@ -2107,6 +2271,7 @@ public Builder setReturnRefund(
public Builder mergeReturnRefund(org.bitcoin.paymentchannel.Protos.ReturnRefund value) {
if (returnRefundBuilder_ == null) {
if (((bitField0_ & 0x00000020) == 0x00000020) &&
+ returnRefund_ != null &&
returnRefund_ != org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance()) {
returnRefund_ =
org.bitcoin.paymentchannel.Protos.ReturnRefund.newBuilder(returnRefund_).mergeFrom(value).buildPartial();
@@ -2125,7 +2290,7 @@ public Builder mergeReturnRefund(org.bitcoin.paymentchannel.Protos.ReturnRefund
*/
public Builder clearReturnRefund() {
if (returnRefundBuilder_ == null) {
- returnRefund_ = org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance();
+ returnRefund_ = null;
onChanged();
} else {
returnRefundBuilder_.clear();
@@ -2148,17 +2313,18 @@ public org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder getReturnRefundOr
if (returnRefundBuilder_ != null) {
return returnRefundBuilder_.getMessageOrBuilder();
} else {
- return returnRefund_;
+ return returnRefund_ == null ?
+ org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance() : returnRefund_;
}
}
/**
* optional .paymentchannels.ReturnRefund return_refund = 6;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ReturnRefund, org.bitcoin.paymentchannel.Protos.ReturnRefund.Builder, org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder>
getReturnRefundFieldBuilder() {
if (returnRefundBuilder_ == null) {
- returnRefundBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ returnRefundBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ReturnRefund, org.bitcoin.paymentchannel.Protos.ReturnRefund.Builder, org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder>(
getReturnRefund(),
getParentForChildren(),
@@ -2168,8 +2334,8 @@ public org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder getReturnRefundOr
return returnRefundBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.ProvideContract provideContract_ = org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.ProvideContract provideContract_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ProvideContract, org.bitcoin.paymentchannel.Protos.ProvideContract.Builder, org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder> provideContractBuilder_;
/**
* optional .paymentchannels.ProvideContract provide_contract = 7;
@@ -2182,7 +2348,7 @@ public boolean hasProvideContract() {
*/
public org.bitcoin.paymentchannel.Protos.ProvideContract getProvideContract() {
if (provideContractBuilder_ == null) {
- return provideContract_;
+ return provideContract_ == null ? org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance() : provideContract_;
} else {
return provideContractBuilder_.getMessage();
}
@@ -2223,6 +2389,7 @@ public Builder setProvideContract(
public Builder mergeProvideContract(org.bitcoin.paymentchannel.Protos.ProvideContract value) {
if (provideContractBuilder_ == null) {
if (((bitField0_ & 0x00000040) == 0x00000040) &&
+ provideContract_ != null &&
provideContract_ != org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance()) {
provideContract_ =
org.bitcoin.paymentchannel.Protos.ProvideContract.newBuilder(provideContract_).mergeFrom(value).buildPartial();
@@ -2241,7 +2408,7 @@ public Builder mergeProvideContract(org.bitcoin.paymentchannel.Protos.ProvideCon
*/
public Builder clearProvideContract() {
if (provideContractBuilder_ == null) {
- provideContract_ = org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance();
+ provideContract_ = null;
onChanged();
} else {
provideContractBuilder_.clear();
@@ -2264,17 +2431,18 @@ public org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder getProvideCont
if (provideContractBuilder_ != null) {
return provideContractBuilder_.getMessageOrBuilder();
} else {
- return provideContract_;
+ return provideContract_ == null ?
+ org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance() : provideContract_;
}
}
/**
* optional .paymentchannels.ProvideContract provide_contract = 7;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ProvideContract, org.bitcoin.paymentchannel.Protos.ProvideContract.Builder, org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder>
getProvideContractFieldBuilder() {
if (provideContractBuilder_ == null) {
- provideContractBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ provideContractBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.ProvideContract, org.bitcoin.paymentchannel.Protos.ProvideContract.Builder, org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder>(
getProvideContract(),
getParentForChildren(),
@@ -2284,8 +2452,8 @@ public org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder getProvideCont
return provideContractBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.UpdatePayment updatePayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.UpdatePayment updatePayment_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.UpdatePayment, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder, org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder> updatePaymentBuilder_;
/**
* optional .paymentchannels.UpdatePayment update_payment = 8;
@@ -2298,7 +2466,7 @@ public boolean hasUpdatePayment() {
*/
public org.bitcoin.paymentchannel.Protos.UpdatePayment getUpdatePayment() {
if (updatePaymentBuilder_ == null) {
- return updatePayment_;
+ return updatePayment_ == null ? org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : updatePayment_;
} else {
return updatePaymentBuilder_.getMessage();
}
@@ -2339,6 +2507,7 @@ public Builder setUpdatePayment(
public Builder mergeUpdatePayment(org.bitcoin.paymentchannel.Protos.UpdatePayment value) {
if (updatePaymentBuilder_ == null) {
if (((bitField0_ & 0x00000080) == 0x00000080) &&
+ updatePayment_ != null &&
updatePayment_ != org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance()) {
updatePayment_ =
org.bitcoin.paymentchannel.Protos.UpdatePayment.newBuilder(updatePayment_).mergeFrom(value).buildPartial();
@@ -2357,7 +2526,7 @@ public Builder mergeUpdatePayment(org.bitcoin.paymentchannel.Protos.UpdatePaymen
*/
public Builder clearUpdatePayment() {
if (updatePaymentBuilder_ == null) {
- updatePayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance();
+ updatePayment_ = null;
onChanged();
} else {
updatePaymentBuilder_.clear();
@@ -2380,17 +2549,18 @@ public org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getUpdatePayment
if (updatePaymentBuilder_ != null) {
return updatePaymentBuilder_.getMessageOrBuilder();
} else {
- return updatePayment_;
+ return updatePayment_ == null ?
+ org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : updatePayment_;
}
}
/**
* optional .paymentchannels.UpdatePayment update_payment = 8;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.UpdatePayment, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder, org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder>
getUpdatePaymentFieldBuilder() {
if (updatePaymentBuilder_ == null) {
- updatePaymentBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ updatePaymentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.UpdatePayment, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder, org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder>(
getUpdatePayment(),
getParentForChildren(),
@@ -2400,8 +2570,8 @@ public org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getUpdatePayment
return updatePaymentBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.PaymentAck paymentAck_ = org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.PaymentAck paymentAck_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.PaymentAck, org.bitcoin.paymentchannel.Protos.PaymentAck.Builder, org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder> paymentAckBuilder_;
/**
* optional .paymentchannels.PaymentAck payment_ack = 11;
@@ -2414,7 +2584,7 @@ public boolean hasPaymentAck() {
*/
public org.bitcoin.paymentchannel.Protos.PaymentAck getPaymentAck() {
if (paymentAckBuilder_ == null) {
- return paymentAck_;
+ return paymentAck_ == null ? org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance() : paymentAck_;
} else {
return paymentAckBuilder_.getMessage();
}
@@ -2455,6 +2625,7 @@ public Builder setPaymentAck(
public Builder mergePaymentAck(org.bitcoin.paymentchannel.Protos.PaymentAck value) {
if (paymentAckBuilder_ == null) {
if (((bitField0_ & 0x00000100) == 0x00000100) &&
+ paymentAck_ != null &&
paymentAck_ != org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance()) {
paymentAck_ =
org.bitcoin.paymentchannel.Protos.PaymentAck.newBuilder(paymentAck_).mergeFrom(value).buildPartial();
@@ -2473,7 +2644,7 @@ public Builder mergePaymentAck(org.bitcoin.paymentchannel.Protos.PaymentAck valu
*/
public Builder clearPaymentAck() {
if (paymentAckBuilder_ == null) {
- paymentAck_ = org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance();
+ paymentAck_ = null;
onChanged();
} else {
paymentAckBuilder_.clear();
@@ -2496,17 +2667,18 @@ public org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder getPaymentAckOrBuil
if (paymentAckBuilder_ != null) {
return paymentAckBuilder_.getMessageOrBuilder();
} else {
- return paymentAck_;
+ return paymentAck_ == null ?
+ org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance() : paymentAck_;
}
}
/**
* optional .paymentchannels.PaymentAck payment_ack = 11;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.PaymentAck, org.bitcoin.paymentchannel.Protos.PaymentAck.Builder, org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder>
getPaymentAckFieldBuilder() {
if (paymentAckBuilder_ == null) {
- paymentAckBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ paymentAckBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.PaymentAck, org.bitcoin.paymentchannel.Protos.PaymentAck.Builder, org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder>(
getPaymentAck(),
getParentForChildren(),
@@ -2516,8 +2688,8 @@ public org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder getPaymentAckOrBuil
return paymentAckBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.Settlement settlement_ = org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.Settlement settlement_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Settlement, org.bitcoin.paymentchannel.Protos.Settlement.Builder, org.bitcoin.paymentchannel.Protos.SettlementOrBuilder> settlementBuilder_;
/**
* optional .paymentchannels.Settlement settlement = 9;
@@ -2530,7 +2702,7 @@ public boolean hasSettlement() {
*/
public org.bitcoin.paymentchannel.Protos.Settlement getSettlement() {
if (settlementBuilder_ == null) {
- return settlement_;
+ return settlement_ == null ? org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance() : settlement_;
} else {
return settlementBuilder_.getMessage();
}
@@ -2571,6 +2743,7 @@ public Builder setSettlement(
public Builder mergeSettlement(org.bitcoin.paymentchannel.Protos.Settlement value) {
if (settlementBuilder_ == null) {
if (((bitField0_ & 0x00000200) == 0x00000200) &&
+ settlement_ != null &&
settlement_ != org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance()) {
settlement_ =
org.bitcoin.paymentchannel.Protos.Settlement.newBuilder(settlement_).mergeFrom(value).buildPartial();
@@ -2589,7 +2762,7 @@ public Builder mergeSettlement(org.bitcoin.paymentchannel.Protos.Settlement valu
*/
public Builder clearSettlement() {
if (settlementBuilder_ == null) {
- settlement_ = org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance();
+ settlement_ = null;
onChanged();
} else {
settlementBuilder_.clear();
@@ -2612,17 +2785,18 @@ public org.bitcoin.paymentchannel.Protos.SettlementOrBuilder getSettlementOrBuil
if (settlementBuilder_ != null) {
return settlementBuilder_.getMessageOrBuilder();
} else {
- return settlement_;
+ return settlement_ == null ?
+ org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance() : settlement_;
}
}
/**
* optional .paymentchannels.Settlement settlement = 9;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Settlement, org.bitcoin.paymentchannel.Protos.Settlement.Builder, org.bitcoin.paymentchannel.Protos.SettlementOrBuilder>
getSettlementFieldBuilder() {
if (settlementBuilder_ == null) {
- settlementBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ settlementBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Settlement, org.bitcoin.paymentchannel.Protos.Settlement.Builder, org.bitcoin.paymentchannel.Protos.SettlementOrBuilder>(
getSettlement(),
getParentForChildren(),
@@ -2632,8 +2806,8 @@ public org.bitcoin.paymentchannel.Protos.SettlementOrBuilder getSettlementOrBuil
return settlementBuilder_;
}
- private org.bitcoin.paymentchannel.Protos.Error error_ = org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.Error error_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Error, org.bitcoin.paymentchannel.Protos.Error.Builder, org.bitcoin.paymentchannel.Protos.ErrorOrBuilder> errorBuilder_;
/**
* optional .paymentchannels.Error error = 10;
@@ -2646,7 +2820,7 @@ public boolean hasError() {
*/
public org.bitcoin.paymentchannel.Protos.Error getError() {
if (errorBuilder_ == null) {
- return error_;
+ return error_ == null ? org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance() : error_;
} else {
return errorBuilder_.getMessage();
}
@@ -2687,6 +2861,7 @@ public Builder setError(
public Builder mergeError(org.bitcoin.paymentchannel.Protos.Error value) {
if (errorBuilder_ == null) {
if (((bitField0_ & 0x00000400) == 0x00000400) &&
+ error_ != null &&
error_ != org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance()) {
error_ =
org.bitcoin.paymentchannel.Protos.Error.newBuilder(error_).mergeFrom(value).buildPartial();
@@ -2705,7 +2880,7 @@ public Builder mergeError(org.bitcoin.paymentchannel.Protos.Error value) {
*/
public Builder clearError() {
if (errorBuilder_ == null) {
- error_ = org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance();
+ error_ = null;
onChanged();
} else {
errorBuilder_.clear();
@@ -2728,17 +2903,18 @@ public org.bitcoin.paymentchannel.Protos.ErrorOrBuilder getErrorOrBuilder() {
if (errorBuilder_ != null) {
return errorBuilder_.getMessageOrBuilder();
} else {
- return error_;
+ return error_ == null ?
+ org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance() : error_;
}
}
/**
* optional .paymentchannels.Error error = 10;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Error, org.bitcoin.paymentchannel.Protos.Error.Builder, org.bitcoin.paymentchannel.Protos.ErrorOrBuilder>
getErrorFieldBuilder() {
if (errorBuilder_ == null) {
- errorBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ errorBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.Error, org.bitcoin.paymentchannel.Protos.Error.Builder, org.bitcoin.paymentchannel.Protos.ErrorOrBuilder>(
getError(),
getParentForChildren(),
@@ -2747,16 +2923,57 @@ public org.bitcoin.paymentchannel.Protos.ErrorOrBuilder getErrorOrBuilder() {
}
return errorBuilder_;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.TwoWayChannelMessage)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.TwoWayChannelMessage)
+ private static final org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage DEFAULT_INSTANCE;
static {
- defaultInstance = new TwoWayChannelMessage(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parseroptional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
boolean hasPreviousChannelContractHash();
/**
- * optional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
com.google.protobuf.ByteString getPreviousChannelContractHash();
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
boolean hasTimeWindowSecs();
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
long getTimeWindowSecs();
}
/**
- * Protobuf type {@code paymentchannels.ClientVersion}
- *
*
* Sent by primary to secondary on opening the connection. If anything is received before this is
* sent, the socket is closed.
*
+ *
+ * Protobuf type {@code paymentchannels.ClientVersion}
*/
- public static final class ClientVersion extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class ClientVersion extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.ClientVersion)
ClientVersionOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use ClientVersion.newBuilder() to construct.
- private ClientVersion(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private ClientVersion(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
}
- private ClientVersion(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final ClientVersion defaultInstance;
- public static ClientVersion getDefaultInstance() {
- return defaultInstance;
- }
-
- public ClientVersion getDefaultInstanceForType() {
- return defaultInstance;
+ private ClientVersion() {
+ major_ = 0;
+ minor_ = 0;
+ previousChannelContractHash_ = com.google.protobuf.ByteString.EMPTY;
+ timeWindowSecs_ = 86340L;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private ClientVersion(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -2873,13 +3088,6 @@ private ClientVersion(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 8: {
bitField0_ |= 0x00000001;
major_ = input.readInt32();
@@ -2900,13 +3108,20 @@ private ClientVersion(
timeWindowSecs_ = input.readUInt64();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -2917,28 +3132,14 @@ private ClientVersion(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ClientVersion_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ClientVersion_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.ClientVersion.class, org.bitcoin.paymentchannel.Protos.ClientVersion.Builder.class);
}
- public static com.google.protobuf.Parseroptional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
public boolean hasPreviousChannelContractHash() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
public com.google.protobuf.ByteString getPreviousChannelContractHash() {
return previousChannelContractHash_;
@@ -3002,35 +3203,30 @@ public com.google.protobuf.ByteString getPreviousChannelContractHash() {
public static final int TIME_WINDOW_SECS_FIELD_NUMBER = 4;
private long timeWindowSecs_;
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
public boolean hasTimeWindowSecs() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
public long getTimeWindowSecs() {
return timeWindowSecs_;
}
- private void initFields() {
- major_ = 0;
- minor_ = 0;
- previousChannelContractHash_ = com.google.protobuf.ByteString.EMPTY;
- timeWindowSecs_ = 86340L;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -3044,9 +3240,9 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, major_);
}
@@ -3059,12 +3255,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeUInt64(4, timeWindowSecs_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -3084,18 +3280,86 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(4, timeWindowSecs_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.ClientVersion)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.ClientVersion other = (org.bitcoin.paymentchannel.Protos.ClientVersion) obj;
+
+ boolean result = true;
+ result = result && (hasMajor() == other.hasMajor());
+ if (hasMajor()) {
+ result = result && (getMajor()
+ == other.getMajor());
+ }
+ result = result && (hasMinor() == other.hasMinor());
+ if (hasMinor()) {
+ result = result && (getMinor()
+ == other.getMinor());
+ }
+ result = result && (hasPreviousChannelContractHash() == other.hasPreviousChannelContractHash());
+ if (hasPreviousChannelContractHash()) {
+ result = result && getPreviousChannelContractHash()
+ .equals(other.getPreviousChannelContractHash());
+ }
+ result = result && (hasTimeWindowSecs() == other.hasTimeWindowSecs());
+ if (hasTimeWindowSecs()) {
+ result = result && (getTimeWindowSecs()
+ == other.getTimeWindowSecs());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasMajor()) {
+ hash = (37 * hash) + MAJOR_FIELD_NUMBER;
+ hash = (53 * hash) + getMajor();
+ }
+ if (hasMinor()) {
+ hash = (37 * hash) + MINOR_FIELD_NUMBER;
+ hash = (53 * hash) + getMinor();
+ }
+ if (hasPreviousChannelContractHash()) {
+ hash = (37 * hash) + PREVIOUS_CHANNEL_CONTRACT_HASH_FIELD_NUMBER;
+ hash = (53 * hash) + getPreviousChannelContractHash().hashCode();
+ }
+ if (hasTimeWindowSecs()) {
+ hash = (37 * hash) + TIME_WINDOW_SECS_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getTimeWindowSecs());
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -3119,59 +3383,72 @@ public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ClientVersion parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.ClientVersion prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.ClientVersion}
- *
*
* Sent by primary to secondary on opening the connection. If anything is received before this is
* sent, the socket is closed.
*
+ *
+ * Protobuf type {@code paymentchannels.ClientVersion}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderoptional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
public boolean hasPreviousChannelContractHash() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
public com.google.protobuf.ByteString getPreviousChannelContractHash() {
return previousChannelContractHash_;
}
/**
- * optional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
public Builder setPreviousChannelContractHash(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -3428,14 +3739,14 @@ public Builder setPreviousChannelContractHash(com.google.protobuf.ByteString val
return this;
}
/**
- * optional bytes previous_channel_contract_hash = 3;
- *
*
* The hash of the multisig contract of a previous channel. This indicates that the primary
* wishes to reopen the given channel. If the server is willing to reopen it, it simply
* responds with a SERVER_VERSION and then immediately sends a CHANNEL_OPEN, it otherwise
* follows SERVER_VERSION with an Initiate representing a new channel
*
+ *
+ * optional bytes previous_channel_contract_hash = 3;
*/
public Builder clearPreviousChannelContractHash() {
bitField0_ = (bitField0_ & ~0x00000004);
@@ -3446,34 +3757,34 @@ public Builder clearPreviousChannelContractHash() {
private long timeWindowSecs_ = 86340L;
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
public boolean hasTimeWindowSecs() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
public long getTimeWindowSecs() {
return timeWindowSecs_;
}
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
public Builder setTimeWindowSecs(long value) {
bitField0_ |= 0x00000008;
@@ -3482,12 +3793,12 @@ public Builder setTimeWindowSecs(long value) {
return this;
}
/**
- * optional uint64 time_window_secs = 4 [default = 86340];
- *
*
* How many seconds should the channel be open, only used when a new channel is created.
* Defaults to 24 h minus 60 seconds, 24*60*60 - 60
*
+ *
+ * optional uint64 time_window_secs = 4 [default = 86340];
*/
public Builder clearTimeWindowSecs() {
bitField0_ = (bitField0_ & ~0x00000008);
@@ -3495,16 +3806,57 @@ public Builder clearTimeWindowSecs() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.ClientVersion)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.ClientVersion)
+ private static final org.bitcoin.paymentchannel.Protos.ClientVersion DEFAULT_INSTANCE;
static {
- defaultInstance = new ClientVersion(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.ClientVersion();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.ClientVersion getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parser
* Send by secondary to primary upon receiving the ClientVersion message. If it is willing to
* speak the given major version, it sends back the same major version and the minor version it
@@ -3541,38 +3891,36 @@ public interface ServerVersionOrBuilder extends
* should immediately close the connection with a NO_ACCEPTABLE_VERSION Error. Backwards
* incompatible changes to the protocol bump the major version. Extensions bump the minor version
*
+ *
+ * Protobuf type {@code paymentchannels.ServerVersion}
*/
- public static final class ServerVersion extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class ServerVersion extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.ServerVersion)
ServerVersionOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use ServerVersion.newBuilder() to construct.
- private ServerVersion(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private ServerVersion(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private ServerVersion(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final ServerVersion defaultInstance;
- public static ServerVersion getDefaultInstance() {
- return defaultInstance;
}
-
- public ServerVersion getDefaultInstanceForType() {
- return defaultInstance;
+ private ServerVersion() {
+ major_ = 0;
+ minor_ = 0;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private ServerVersion(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -3584,13 +3932,6 @@ private ServerVersion(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 8: {
bitField0_ |= 0x00000001;
major_ = input.readInt32();
@@ -3601,13 +3942,20 @@ private ServerVersion(
minor_ = input.readInt32();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -3618,28 +3966,14 @@ private ServerVersion(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ServerVersion_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ServerVersion_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.ServerVersion.class, org.bitcoin.paymentchannel.Protos.ServerVersion.Builder.class);
}
- public static com.google.protobuf.Parser
* Send by secondary to primary upon receiving the ClientVersion message. If it is willing to
* speak the given major version, it sends back the same major version and the minor version it
@@ -3805,9 +4196,11 @@ protected Builder newBuilderForType(
* should immediately close the connection with a NO_ACCEPTABLE_VERSION Error. Backwards
* incompatible changes to the protocol bump the major version. Extensions bump the minor version
*
+ *
+ * Protobuf type {@code paymentchannels.ServerVersion}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
boolean hasMultisigKey();
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
com.google.protobuf.ByteString getMultisigKey();
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
boolean hasMinAcceptedChannelSize();
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
long getMinAcceptedChannelSize();
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4070,11 +4536,11 @@ public interface InitiateOrBuilder extends
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
boolean hasExpireTimeSecs();
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4084,12 +4550,12 @@ public interface InitiateOrBuilder extends
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
long getExpireTimeSecs();
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4098,11 +4564,11 @@ public interface InitiateOrBuilder extends
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
boolean hasMinPayment();
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4111,47 +4577,47 @@ public interface InitiateOrBuilder extends
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
long getMinPayment();
}
/**
- * Protobuf type {@code paymentchannels.Initiate}
- *
*
* Sent from server to client once version nego is done.
*
+ *
+ * Protobuf type {@code paymentchannels.Initiate}
*/
- public static final class Initiate extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class Initiate extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.Initiate)
InitiateOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use Initiate.newBuilder() to construct.
- private Initiate(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private Initiate(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private Initiate(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final Initiate defaultInstance;
- public static Initiate getDefaultInstance() {
- return defaultInstance;
}
-
- public Initiate getDefaultInstanceForType() {
- return defaultInstance;
+ private Initiate() {
+ multisigKey_ = com.google.protobuf.ByteString.EMPTY;
+ minAcceptedChannelSize_ = 0L;
+ expireTimeSecs_ = 0L;
+ minPayment_ = 0L;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private Initiate(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -4163,13 +4629,6 @@ private Initiate(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 10: {
bitField0_ |= 0x00000001;
multisigKey_ = input.readBytes();
@@ -4190,13 +4649,20 @@ private Initiate(
minPayment_ = input.readUInt64();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -4207,51 +4673,37 @@ private Initiate(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Initiate_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Initiate_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.Initiate.class, org.bitcoin.paymentchannel.Protos.Initiate.Builder.class);
}
- public static com.google.protobuf.Parserrequired bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
public boolean hasMultisigKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
public com.google.protobuf.ByteString getMultisigKey() {
return multisigKey_;
@@ -4260,27 +4712,27 @@ public com.google.protobuf.ByteString getMultisigKey() {
public static final int MIN_ACCEPTED_CHANNEL_SIZE_FIELD_NUMBER = 2;
private long minAcceptedChannelSize_;
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
public boolean hasMinAcceptedChannelSize() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
public long getMinAcceptedChannelSize() {
return minAcceptedChannelSize_;
@@ -4289,8 +4741,6 @@ public long getMinAcceptedChannelSize() {
public static final int EXPIRE_TIME_SECS_FIELD_NUMBER = 3;
private long expireTimeSecs_;
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4300,13 +4750,13 @@ public long getMinAcceptedChannelSize() {
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
public boolean hasExpireTimeSecs() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4316,6 +4766,8 @@ public boolean hasExpireTimeSecs() {
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
public long getExpireTimeSecs() {
return expireTimeSecs_;
@@ -4324,8 +4776,6 @@ public long getExpireTimeSecs() {
public static final int MIN_PAYMENT_FIELD_NUMBER = 4;
private long minPayment_;
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4334,13 +4784,13 @@ public long getExpireTimeSecs() {
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
public boolean hasMinPayment() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4349,18 +4799,15 @@ public boolean hasMinPayment() {
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
public long getMinPayment() {
return minPayment_;
}
- private void initFields() {
- multisigKey_ = com.google.protobuf.ByteString.EMPTY;
- minAcceptedChannelSize_ = 0L;
- expireTimeSecs_ = 0L;
- minPayment_ = 0L;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -4386,9 +4833,9 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, multisigKey_);
}
@@ -4401,12 +4848,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeUInt64(4, minPayment_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -4426,18 +4873,88 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(4, minPayment_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.Initiate)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.Initiate other = (org.bitcoin.paymentchannel.Protos.Initiate) obj;
+
+ boolean result = true;
+ result = result && (hasMultisigKey() == other.hasMultisigKey());
+ if (hasMultisigKey()) {
+ result = result && getMultisigKey()
+ .equals(other.getMultisigKey());
+ }
+ result = result && (hasMinAcceptedChannelSize() == other.hasMinAcceptedChannelSize());
+ if (hasMinAcceptedChannelSize()) {
+ result = result && (getMinAcceptedChannelSize()
+ == other.getMinAcceptedChannelSize());
+ }
+ result = result && (hasExpireTimeSecs() == other.hasExpireTimeSecs());
+ if (hasExpireTimeSecs()) {
+ result = result && (getExpireTimeSecs()
+ == other.getExpireTimeSecs());
+ }
+ result = result && (hasMinPayment() == other.hasMinPayment());
+ if (hasMinPayment()) {
+ result = result && (getMinPayment()
+ == other.getMinPayment());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasMultisigKey()) {
+ hash = (37 * hash) + MULTISIG_KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getMultisigKey().hashCode();
+ }
+ if (hasMinAcceptedChannelSize()) {
+ hash = (37 * hash) + MIN_ACCEPTED_CHANNEL_SIZE_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getMinAcceptedChannelSize());
+ }
+ if (hasExpireTimeSecs()) {
+ hash = (37 * hash) + EXPIRE_TIME_SECS_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getExpireTimeSecs());
+ }
+ if (hasMinPayment()) {
+ hash = (37 * hash) + MIN_PAYMENT_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getMinPayment());
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -4461,58 +4978,71 @@ public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.Initiate parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Initiate parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Initiate parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.Initiate prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.Initiate}
- *
*
* Sent from server to client once version nego is done.
*
+ *
+ * Protobuf type {@code paymentchannels.Initiate}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
public boolean hasMultisigKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
public com.google.protobuf.ByteString getMultisigKey() {
return multisigKey_;
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
public Builder setMultisigKey(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -4714,13 +5275,13 @@ public Builder setMultisigKey(com.google.protobuf.ByteString value) {
return this;
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is used only in the creation of the multisig contract, as outputs are
* created entirely by the secondary
*
+ *
+ * required bytes multisig_key = 1;
*/
public Builder clearMultisigKey() {
bitField0_ = (bitField0_ & ~0x00000001);
@@ -4731,40 +5292,40 @@ public Builder clearMultisigKey() {
private long minAcceptedChannelSize_ ;
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
public boolean hasMinAcceptedChannelSize() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
public long getMinAcceptedChannelSize() {
return minAcceptedChannelSize_;
}
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
public Builder setMinAcceptedChannelSize(long value) {
bitField0_ |= 0x00000002;
@@ -4773,14 +5334,14 @@ public Builder setMinAcceptedChannelSize(long value) {
return this;
}
/**
- * required uint64 min_accepted_channel_size = 2;
- *
*
* Once a channel is exhausted a new one must be set up. So secondary indicates the minimum
* size it's willing to accept here. This can be lower to trade off resources against
* security but shouldn't be so low the transactions get rejected by the network as spam.
* Zero isn't a sensible value to have here, so we make the field required.
*
+ *
+ * required uint64 min_accepted_channel_size = 2;
*/
public Builder clearMinAcceptedChannelSize() {
bitField0_ = (bitField0_ & ~0x00000002);
@@ -4791,8 +5352,6 @@ public Builder clearMinAcceptedChannelSize() {
private long expireTimeSecs_ ;
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4802,13 +5361,13 @@ public Builder clearMinAcceptedChannelSize() {
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
public boolean hasExpireTimeSecs() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4818,13 +5377,13 @@ public boolean hasExpireTimeSecs() {
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
public long getExpireTimeSecs() {
return expireTimeSecs_;
}
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4834,6 +5393,8 @@ public long getExpireTimeSecs() {
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
public Builder setExpireTimeSecs(long value) {
bitField0_ |= 0x00000004;
@@ -4842,8 +5403,6 @@ public Builder setExpireTimeSecs(long value) {
return this;
}
/**
- * required uint64 expire_time_secs = 3;
- *
*
* Rough UNIX time for when the channel expires. This is determined by the block header
* timestamps which can be very inaccurate when miners use the obsolete RollNTime hack.
@@ -4853,6 +5412,8 @@ public Builder setExpireTimeSecs(long value) {
* considers this value too far off (eg more than a day), it may send an ERROR and close the
* channel.
*
+ *
+ * required uint64 expire_time_secs = 3;
*/
public Builder clearExpireTimeSecs() {
bitField0_ = (bitField0_ & ~0x00000004);
@@ -4863,8 +5424,6 @@ public Builder clearExpireTimeSecs() {
private long minPayment_ ;
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4873,13 +5432,13 @@ public Builder clearExpireTimeSecs() {
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
public boolean hasMinPayment() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4888,13 +5447,13 @@ public boolean hasMinPayment() {
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
- */
+ *
+ * required uint64 min_payment = 4;
+ */
public long getMinPayment() {
return minPayment_;
}
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4903,6 +5462,8 @@ public long getMinPayment() {
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
public Builder setMinPayment(long value) {
bitField0_ |= 0x00000008;
@@ -4911,8 +5472,6 @@ public Builder setMinPayment(long value) {
return this;
}
/**
- * required uint64 min_payment = 4;
- *
*
* The amount of money the server requires for the initial payment. The act of opening a channel
* always transfers some quantity of money to the server: it's impossible to have a channel with
@@ -4921,6 +5480,8 @@ public Builder setMinPayment(long value) {
* server tells the client what it thinks it is, and the client is supposed to sanity check this
* value.
*
+ *
+ * required uint64 min_payment = 4;
*/
public Builder clearMinPayment() {
bitField0_ = (bitField0_ & ~0x00000008);
@@ -4928,16 +5489,57 @@ public Builder clearMinPayment() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.Initiate)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.Initiate)
+ private static final org.bitcoin.paymentchannel.Protos.Initiate DEFAULT_INSTANCE;
static {
- defaultInstance = new Initiate(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.Initiate();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.Initiate getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parserrequired bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
boolean hasMultisigKey();
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
com.google.protobuf.ByteString getMultisigKey();
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -4976,11 +5576,11 @@ public interface ProvideRefundOrBuilder extends
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
boolean hasTx();
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -4991,47 +5591,45 @@ public interface ProvideRefundOrBuilder extends
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
com.google.protobuf.ByteString getTx();
}
/**
- * Protobuf type {@code paymentchannels.ProvideRefund}
- *
*
* Sent from primary to secondary after Initiate to begin the refund transaction signing.
*
+ *
+ * Protobuf type {@code paymentchannels.ProvideRefund}
*/
- public static final class ProvideRefund extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class ProvideRefund extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.ProvideRefund)
ProvideRefundOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use ProvideRefund.newBuilder() to construct.
- private ProvideRefund(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private ProvideRefund(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private ProvideRefund(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final ProvideRefund defaultInstance;
- public static ProvideRefund getDefaultInstance() {
- return defaultInstance;
}
-
- public ProvideRefund getDefaultInstanceForType() {
- return defaultInstance;
+ private ProvideRefund() {
+ multisigKey_ = com.google.protobuf.ByteString.EMPTY;
+ tx_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private ProvideRefund(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -5043,13 +5641,6 @@ private ProvideRefund(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 10: {
bitField0_ |= 0x00000001;
multisigKey_ = input.readBytes();
@@ -5060,13 +5651,20 @@ private ProvideRefund(
tx_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -5077,49 +5675,35 @@ private ProvideRefund(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ProvideRefund_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ProvideRefund_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.ProvideRefund.class, org.bitcoin.paymentchannel.Protos.ProvideRefund.Builder.class);
}
- public static com.google.protobuf.Parserrequired bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
public boolean hasMultisigKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
public com.google.protobuf.ByteString getMultisigKey() {
return multisigKey_;
@@ -5128,8 +5712,6 @@ public com.google.protobuf.ByteString getMultisigKey() {
public static final int TX_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString tx_;
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -5140,13 +5722,13 @@ public com.google.protobuf.ByteString getMultisigKey() {
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
public boolean hasTx() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -5157,16 +5739,15 @@ public boolean hasTx() {
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
public com.google.protobuf.ByteString getTx() {
return tx_;
}
- private void initFields() {
- multisigKey_ = com.google.protobuf.ByteString.EMPTY;
- tx_ = com.google.protobuf.ByteString.EMPTY;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -5184,21 +5765,21 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, multisigKey_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, tx_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -5210,18 +5791,67 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, tx_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.ProvideRefund)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.ProvideRefund other = (org.bitcoin.paymentchannel.Protos.ProvideRefund) obj;
+
+ boolean result = true;
+ result = result && (hasMultisigKey() == other.hasMultisigKey());
+ if (hasMultisigKey()) {
+ result = result && getMultisigKey()
+ .equals(other.getMultisigKey());
+ }
+ result = result && (hasTx() == other.hasTx());
+ if (hasTx()) {
+ result = result && getTx()
+ .equals(other.getTx());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasMultisigKey()) {
+ hash = (37 * hash) + MULTISIG_KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getMultisigKey().hashCode();
+ }
+ if (hasTx()) {
+ hash = (37 * hash) + TX_FIELD_NUMBER;
+ hash = (53 * hash) + getTx().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -5245,58 +5875,71 @@ public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ProvideRefund parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.ProvideRefund prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.ProvideRefund}
- *
*
* Sent from primary to secondary after Initiate to begin the refund transaction signing.
*
+ *
+ * Protobuf type {@code paymentchannels.ProvideRefund}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
public boolean hasMultisigKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
public com.google.protobuf.ByteString getMultisigKey() {
return multisigKey_;
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
public Builder setMultisigKey(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -5469,12 +6145,12 @@ public Builder setMultisigKey(com.google.protobuf.ByteString value) {
return this;
}
/**
- * required bytes multisig_key = 1;
- *
*
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * required bytes multisig_key = 1;
*/
public Builder clearMultisigKey() {
bitField0_ = (bitField0_ & ~0x00000001);
@@ -5485,8 +6161,6 @@ public Builder clearMultisigKey() {
private com.google.protobuf.ByteString tx_ = com.google.protobuf.ByteString.EMPTY;
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -5497,13 +6171,13 @@ public Builder clearMultisigKey() {
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
public boolean hasTx() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -5514,13 +6188,13 @@ public boolean hasTx() {
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
public com.google.protobuf.ByteString getTx() {
return tx_;
}
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -5531,6 +6205,8 @@ public com.google.protobuf.ByteString getTx() {
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
public Builder setTx(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -5542,8 +6218,6 @@ public Builder setTx(com.google.protobuf.ByteString value) {
return this;
}
/**
- * required bytes tx = 2;
- *
*
* The serialized bytes of the return transaction in Satoshi format.
* * It must have exactly one input which spends the multisig output (see ProvideContract for
@@ -5554,6 +6228,8 @@ public Builder setTx(com.google.protobuf.ByteString value) {
* * It must have exactly one output which goes back to the primary. This output's
* scriptPubKey will be reused to create payment transactions.
*
+ *
+ * required bytes tx = 2;
*/
public Builder clearTx() {
bitField0_ = (bitField0_ & ~0x00000002);
@@ -5561,16 +6237,57 @@ public Builder clearTx() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.ProvideRefund)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.ProvideRefund)
+ private static final org.bitcoin.paymentchannel.Protos.ProvideRefund DEFAULT_INSTANCE;
static {
- defaultInstance = new ProvideRefund(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.ProvideRefund();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.ProvideRefund getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parser
* Sent from secondary to primary after it has done initial verification of the refund
* transaction. Contains the primary's signature which is required to spend the multisig contract
@@ -5596,38 +6311,35 @@ public interface ReturnRefundOrBuilder extends
* the postfix type byte) to allow the client to add any outputs/inputs it wants as long as the
* input's sequence and transaction's nLockTime remain set.
*
+ *
+ * Protobuf type {@code paymentchannels.ReturnRefund}
*/
- public static final class ReturnRefund extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class ReturnRefund extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.ReturnRefund)
ReturnRefundOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use ReturnRefund.newBuilder() to construct.
- private ReturnRefund(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private ReturnRefund(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
}
- private ReturnRefund(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final ReturnRefund defaultInstance;
- public static ReturnRefund getDefaultInstance() {
- return defaultInstance;
- }
-
- public ReturnRefund getDefaultInstanceForType() {
- return defaultInstance;
+ private ReturnRefund() {
+ signature_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private ReturnRefund(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -5639,25 +6351,25 @@ private ReturnRefund(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 10: {
bitField0_ |= 0x00000001;
signature_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -5668,28 +6380,14 @@ private ReturnRefund(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ReturnRefund_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ReturnRefund_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.ReturnRefund.class, org.bitcoin.paymentchannel.Protos.ReturnRefund.Builder.class);
}
- public static com.google.protobuf.Parser
* Sent from secondary to primary after it has done initial verification of the refund
* transaction. Contains the primary's signature which is required to spend the multisig contract
@@ -5830,9 +6577,11 @@ protected Builder newBuilderForType(
* the postfix type byte) to allow the client to add any outputs/inputs it wants as long as the
* input's sequence and transaction's nLockTime remain set.
*
+ *
+ * Protobuf type {@code paymentchannels.ReturnRefund}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6018,11 +6840,11 @@ public interface ProvideContractOrBuilder extends
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
boolean hasTx();
/**
- * required bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6037,104 +6859,102 @@ public interface ProvideContractOrBuilder extends
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
com.google.protobuf.ByteString getTx();
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
boolean hasInitialPayment();
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
org.bitcoin.paymentchannel.Protos.UpdatePayment getInitialPayment();
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getInitialPaymentOrBuilder();
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
boolean hasClientKey();
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
com.google.protobuf.ByteString getClientKey();
}
/**
- * Protobuf type {@code paymentchannels.ProvideContract}
- *
*
* Sent from the primary to the secondary to complete initialization.
*
+ *
+ * Protobuf type {@code paymentchannels.ProvideContract}
*/
- public static final class ProvideContract extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class ProvideContract extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.ProvideContract)
ProvideContractOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use ProvideContract.newBuilder() to construct.
- private ProvideContract(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private ProvideContract(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
}
- private ProvideContract(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final ProvideContract defaultInstance;
- public static ProvideContract getDefaultInstance() {
- return defaultInstance;
- }
-
- public ProvideContract getDefaultInstanceForType() {
- return defaultInstance;
+ private ProvideContract() {
+ tx_ = com.google.protobuf.ByteString.EMPTY;
+ clientKey_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private ProvideContract(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -6146,13 +6966,6 @@ private ProvideContract(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 10: {
bitField0_ |= 0x00000001;
tx_ = input.readBytes();
@@ -6176,13 +6989,20 @@ private ProvideContract(
clientKey_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -6193,34 +7013,18 @@ private ProvideContract(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ProvideContract_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ProvideContract_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.ProvideContract.class, org.bitcoin.paymentchannel.Protos.ProvideContract.Builder.class);
}
- public static com.google.protobuf.Parserrequired bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6235,13 +7039,13 @@ public com.google.protobuf.Parser
+ *
+ * required bytes tx = 1;
*/
public boolean hasTx() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6256,6 +7060,8 @@ public boolean hasTx() {
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
public com.google.protobuf.ByteString getTx() {
return tx_;
@@ -6264,80 +7070,76 @@ public com.google.protobuf.ByteString getTx() {
public static final int INITIAL_PAYMENT_FIELD_NUMBER = 2;
private org.bitcoin.paymentchannel.Protos.UpdatePayment initialPayment_;
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public boolean hasInitialPayment() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePayment getInitialPayment() {
- return initialPayment_;
+ return initialPayment_ == null ? org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : initialPayment_;
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getInitialPaymentOrBuilder() {
- return initialPayment_;
+ return initialPayment_ == null ? org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : initialPayment_;
}
public static final int CLIENT_KEY_FIELD_NUMBER = 3;
private com.google.protobuf.ByteString clientKey_;
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
public boolean hasClientKey() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
public com.google.protobuf.ByteString getClientKey() {
return clientKey_;
}
- private void initFields() {
- tx_ = com.google.protobuf.ByteString.EMPTY;
- initialPayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance();
- clientKey_ = com.google.protobuf.ByteString.EMPTY;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -6359,24 +7161,24 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, tx_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeMessage(2, initialPayment_);
+ output.writeMessage(2, getInitialPayment());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, clientKey_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -6386,24 +7188,82 @@ public int getSerializedSize() {
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(2, initialPayment_);
+ .computeMessageSize(2, getInitialPayment());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, clientKey_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.ProvideContract)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.ProvideContract other = (org.bitcoin.paymentchannel.Protos.ProvideContract) obj;
+
+ boolean result = true;
+ result = result && (hasTx() == other.hasTx());
+ if (hasTx()) {
+ result = result && getTx()
+ .equals(other.getTx());
+ }
+ result = result && (hasInitialPayment() == other.hasInitialPayment());
+ if (hasInitialPayment()) {
+ result = result && getInitialPayment()
+ .equals(other.getInitialPayment());
+ }
+ result = result && (hasClientKey() == other.hasClientKey());
+ if (hasClientKey()) {
+ result = result && getClientKey()
+ .equals(other.getClientKey());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasTx()) {
+ hash = (37 * hash) + TX_FIELD_NUMBER;
+ hash = (53 * hash) + getTx().hashCode();
+ }
+ if (hasInitialPayment()) {
+ hash = (37 * hash) + INITIAL_PAYMENT_FIELD_NUMBER;
+ hash = (53 * hash) + getInitialPayment().hashCode();
+ }
+ if (hasClientKey()) {
+ hash = (37 * hash) + CLIENT_KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getClientKey().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -6427,58 +7287,71 @@ public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.ProvideContract parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.ProvideContract prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.ProvideContract}
- *
*
* Sent from the primary to the secondary to complete initialization.
*
+ *
+ * Protobuf type {@code paymentchannels.ProvideContract}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6650,13 +7553,13 @@ public Builder mergeFrom(
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
public boolean hasTx() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6671,13 +7574,13 @@ public boolean hasTx() {
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
public com.google.protobuf.ByteString getTx() {
return tx_;
}
/**
- * required bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6692,6 +7595,8 @@ public com.google.protobuf.ByteString getTx() {
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
public Builder setTx(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -6703,8 +7608,6 @@ public Builder setTx(com.google.protobuf.ByteString value) {
return this;
}
/**
- * required bytes tx = 1;
- *
*
* The serialized bytes of the transaction in Satoshi format.
* For version 1:
@@ -6719,6 +7622,8 @@ public Builder setTx(com.google.protobuf.ByteString value) {
* * Its first output must be a CHECKLOCKTIMEVERIFY output with the first pubkey being the
* primary's and the second being the secondary's.
*
+ *
+ * required bytes tx = 1;
*/
public Builder clearTx() {
bitField0_ = (bitField0_ & ~0x00000001);
@@ -6727,48 +7632,48 @@ public Builder clearTx() {
return this;
}
- private org.bitcoin.paymentchannel.Protos.UpdatePayment initialPayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
+ private org.bitcoin.paymentchannel.Protos.UpdatePayment initialPayment_ = null;
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.UpdatePayment, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder, org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder> initialPaymentBuilder_;
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public boolean hasInitialPayment() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePayment getInitialPayment() {
if (initialPaymentBuilder_ == null) {
- return initialPayment_;
+ return initialPayment_ == null ? org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : initialPayment_;
} else {
return initialPaymentBuilder_.getMessage();
}
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public Builder setInitialPayment(org.bitcoin.paymentchannel.Protos.UpdatePayment value) {
if (initialPaymentBuilder_ == null) {
@@ -6784,14 +7689,14 @@ public Builder setInitialPayment(org.bitcoin.paymentchannel.Protos.UpdatePayment
return this;
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public Builder setInitialPayment(
org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder builderForValue) {
@@ -6805,18 +7710,19 @@ public Builder setInitialPayment(
return this;
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public Builder mergeInitialPayment(org.bitcoin.paymentchannel.Protos.UpdatePayment value) {
if (initialPaymentBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
+ initialPayment_ != null &&
initialPayment_ != org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance()) {
initialPayment_ =
org.bitcoin.paymentchannel.Protos.UpdatePayment.newBuilder(initialPayment_).mergeFrom(value).buildPartial();
@@ -6831,18 +7737,18 @@ public Builder mergeInitialPayment(org.bitcoin.paymentchannel.Protos.UpdatePayme
return this;
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public Builder clearInitialPayment() {
if (initialPaymentBuilder_ == null) {
- initialPayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance();
+ initialPayment_ = null;
onChanged();
} else {
initialPaymentBuilder_.clear();
@@ -6851,14 +7757,14 @@ public Builder clearInitialPayment() {
return this;
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder getInitialPaymentBuilder() {
bitField0_ |= 0x00000002;
@@ -6866,37 +7772,38 @@ public org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder getInitialPayment
return getInitialPaymentFieldBuilder().getBuilder();
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
public org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getInitialPaymentOrBuilder() {
if (initialPaymentBuilder_ != null) {
return initialPaymentBuilder_.getMessageOrBuilder();
} else {
- return initialPayment_;
+ return initialPayment_ == null ?
+ org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance() : initialPayment_;
}
}
/**
- * required .paymentchannels.UpdatePayment initial_payment = 2;
- *
*
* To open the channel, an initial payment of the server-specified dust limit value must be
* provided. This ensures that the channel is never in an un-settleable state due to either
* no payment tx having been provided at all, or a payment that is smaller than the dust
* limit being provided.
*
+ *
+ * required .paymentchannels.UpdatePayment initial_payment = 2;
*/
- private com.google.protobuf.SingleFieldBuilder<
+ private com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.UpdatePayment, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder, org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder>
getInitialPaymentFieldBuilder() {
if (initialPaymentBuilder_ == null) {
- initialPaymentBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ initialPaymentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
org.bitcoin.paymentchannel.Protos.UpdatePayment, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder, org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder>(
getInitialPayment(),
getParentForChildren(),
@@ -6908,40 +7815,40 @@ public org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder getInitialPaymen
private com.google.protobuf.ByteString clientKey_ = com.google.protobuf.ByteString.EMPTY;
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
public boolean hasClientKey() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
public com.google.protobuf.ByteString getClientKey() {
return clientKey_;
}
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
public Builder setClientKey(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -6953,14 +7860,14 @@ public Builder setClientKey(com.google.protobuf.ByteString value) {
return this;
}
/**
- * optional bytes client_key = 3;
- *
*
* This field is added in protocol version 2 to send the client public key to the server.
* In version 1 it isn't used.
* This must be a raw pubkey in regular ECDSA form. Both compressed and non-compressed forms
* are accepted. It is only used in the creation of the multisig contract.
*
+ *
+ * optional bytes client_key = 3;
*/
public Builder clearClientKey() {
bitField0_ = (bitField0_ & ~0x00000004);
@@ -6968,16 +7875,57 @@ public Builder clearClientKey() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.ProvideContract)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.ProvideContract)
+ private static final org.bitcoin.paymentchannel.Protos.ProvideContract DEFAULT_INSTANCE;
static {
- defaultInstance = new ProvideContract(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.ProvideContract();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.ProvideContract getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parserrequired uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
boolean hasClientChangeValue();
/**
- * required uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
long getClientChangeValue();
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
boolean hasSignature();
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
com.google.protobuf.ByteString getSignature();
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
boolean hasInfo();
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
com.google.protobuf.ByteString getInfo();
}
/**
- * Protobuf type {@code paymentchannels.UpdatePayment}
- *
*
* This message can only be used by the primary after it has received a CHANNEL_OPEN message. It
* creates a new payment transaction. Note that we don't resubmit the entire TX, this is to avoid
@@ -7061,38 +8007,37 @@ public interface UpdatePaymentOrBuilder extends
* * Adding any number of additional outputs as desired (leaving sufficient fee, if necessary)
* * Adding any number of additional inputs as desired (eg to add more fee)
*
+ *
+ * Protobuf type {@code paymentchannels.UpdatePayment}
*/
- public static final class UpdatePayment extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class UpdatePayment extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.UpdatePayment)
UpdatePaymentOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use UpdatePayment.newBuilder() to construct.
- private UpdatePayment(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private UpdatePayment(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private UpdatePayment(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final UpdatePayment defaultInstance;
- public static UpdatePayment getDefaultInstance() {
- return defaultInstance;
}
-
- public UpdatePayment getDefaultInstanceForType() {
- return defaultInstance;
+ private UpdatePayment() {
+ clientChangeValue_ = 0L;
+ signature_ = com.google.protobuf.ByteString.EMPTY;
+ info_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private UpdatePayment(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -7104,13 +8049,6 @@ private UpdatePayment(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 8: {
bitField0_ |= 0x00000001;
clientChangeValue_ = input.readUInt64();
@@ -7126,13 +8064,20 @@ private UpdatePayment(
info_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -7143,49 +8088,35 @@ private UpdatePayment(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_UpdatePayment_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_UpdatePayment_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.UpdatePayment.class, org.bitcoin.paymentchannel.Protos.UpdatePayment.Builder.class);
}
- public static com.google.protobuf.Parserrequired uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
public boolean hasClientChangeValue() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
public long getClientChangeValue() {
return clientChangeValue_;
@@ -7194,27 +8125,27 @@ public long getClientChangeValue() {
public static final int SIGNATURE_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString signature_;
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
public boolean hasSignature() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
public com.google.protobuf.ByteString getSignature() {
return signature_;
@@ -7223,32 +8154,28 @@ public com.google.protobuf.ByteString getSignature() {
public static final int INFO_FIELD_NUMBER = 3;
private com.google.protobuf.ByteString info_;
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
public boolean hasInfo() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
public com.google.protobuf.ByteString getInfo() {
return info_;
}
- private void initFields() {
- clientChangeValue_ = 0L;
- signature_ = com.google.protobuf.ByteString.EMPTY;
- info_ = com.google.protobuf.ByteString.EMPTY;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -7266,9 +8193,9 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeUInt64(1, clientChangeValue_);
}
@@ -7278,12 +8205,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, info_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -7299,18 +8226,77 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, info_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.UpdatePayment)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.UpdatePayment other = (org.bitcoin.paymentchannel.Protos.UpdatePayment) obj;
+
+ boolean result = true;
+ result = result && (hasClientChangeValue() == other.hasClientChangeValue());
+ if (hasClientChangeValue()) {
+ result = result && (getClientChangeValue()
+ == other.getClientChangeValue());
+ }
+ result = result && (hasSignature() == other.hasSignature());
+ if (hasSignature()) {
+ result = result && getSignature()
+ .equals(other.getSignature());
+ }
+ result = result && (hasInfo() == other.hasInfo());
+ if (hasInfo()) {
+ result = result && getInfo()
+ .equals(other.getInfo());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
}
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasClientChangeValue()) {
+ hash = (37 * hash) + CLIENT_CHANGE_VALUE_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getClientChangeValue());
+ }
+ if (hasSignature()) {
+ hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
+ hash = (53 * hash) + getSignature().hashCode();
+ }
+ if (hasInfo()) {
+ hash = (37 * hash) + INFO_FIELD_NUMBER;
+ hash = (53 * hash) + getInfo().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -7334,52 +8320,63 @@ public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.UpdatePayment parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.UpdatePayment prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.UpdatePayment}
- *
*
* This message can only be used by the primary after it has received a CHANNEL_OPEN message. It
* creates a new payment transaction. Note that we don't resubmit the entire TX, this is to avoid
@@ -7395,9 +8392,11 @@ protected Builder newBuilderForType(
* * Adding any number of additional outputs as desired (leaving sufficient fee, if necessary)
* * Adding any number of additional inputs as desired (eg to add more fee)
*
+ *
+ * Protobuf type {@code paymentchannels.UpdatePayment}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
public boolean hasClientChangeValue() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
public long getClientChangeValue() {
return clientChangeValue_;
}
/**
- * required uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
public Builder setClientChangeValue(long value) {
bitField0_ |= 0x00000001;
@@ -7576,12 +8608,12 @@ public Builder setClientChangeValue(long value) {
return this;
}
/**
- * required uint64 client_change_value = 1;
- *
*
* The value which is sent back to the primary. The rest of the multisig output is left for
* the secondary to do with as they wish.
*
+ *
+ * required uint64 client_change_value = 1;
*/
public Builder clearClientChangeValue() {
bitField0_ = (bitField0_ & ~0x00000001);
@@ -7592,40 +8624,40 @@ public Builder clearClientChangeValue() {
private com.google.protobuf.ByteString signature_ = com.google.protobuf.ByteString.EMPTY;
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
public boolean hasSignature() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
public com.google.protobuf.ByteString getSignature() {
return signature_;
}
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
public Builder setSignature(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -7637,14 +8669,14 @@ public Builder setSignature(com.google.protobuf.ByteString value) {
return this;
}
/**
- * required bytes signature = 2;
- *
*
* A SIGHASH_SINGLE|SIGHASH_ANYONECANPAY signature (including the postfix type byte) which
* spends the primary's part of the multisig contract's output. This signature only covers
* the primary's refund output and thus the secondary is free to do what they wish with their
* part of the multisig output.
*
+ *
+ * required bytes signature = 2;
*/
public Builder clearSignature() {
bitField0_ = (bitField0_ & ~0x00000002);
@@ -7655,31 +8687,31 @@ public Builder clearSignature() {
private com.google.protobuf.ByteString info_ = com.google.protobuf.ByteString.EMPTY;
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
public boolean hasInfo() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
public com.google.protobuf.ByteString getInfo() {
return info_;
}
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
public Builder setInfo(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -7691,11 +8723,11 @@ public Builder setInfo(com.google.protobuf.ByteString value) {
return this;
}
/**
- * optional bytes info = 3;
- *
*
* Information about this update. Used to extend this protocol.
*
+ *
+ * optional bytes info = 3;
*/
public Builder clearInfo() {
bitField0_ = (bitField0_ & ~0x00000004);
@@ -7703,16 +8735,57 @@ public Builder clearInfo() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.UpdatePayment)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.UpdatePayment)
+ private static final org.bitcoin.paymentchannel.Protos.UpdatePayment DEFAULT_INSTANCE;
static {
- defaultInstance = new UpdatePayment(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.UpdatePayment();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.UpdatePayment getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parseroptional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
boolean hasInfo();
/**
- * optional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
com.google.protobuf.ByteString getInfo();
}
/**
- * Protobuf type {@code paymentchannels.PaymentAck}
- *
*
* This message is sent as an acknowledgement of an UpdatePayment message
*
+ *
+ * Protobuf type {@code paymentchannels.PaymentAck}
*/
- public static final class PaymentAck extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class PaymentAck extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.PaymentAck)
PaymentAckOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use PaymentAck.newBuilder() to construct.
- private PaymentAck(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private PaymentAck(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private PaymentAck(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final PaymentAck defaultInstance;
- public static PaymentAck getDefaultInstance() {
- return defaultInstance;
}
-
- public PaymentAck getDefaultInstanceForType() {
- return defaultInstance;
+ private PaymentAck() {
+ info_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private PaymentAck(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -7785,25 +8853,25 @@ private PaymentAck(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 10: {
bitField0_ |= 0x00000001;
info_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -7814,56 +8882,40 @@ private PaymentAck(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_PaymentAck_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_PaymentAck_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.PaymentAck.class, org.bitcoin.paymentchannel.Protos.PaymentAck.Builder.class);
}
- public static com.google.protobuf.Parseroptional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
public boolean hasInfo() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * optional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
public com.google.protobuf.ByteString getInfo() {
return info_;
}
- private void initFields() {
- info_ = com.google.protobuf.ByteString.EMPTY;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -7873,18 +8925,18 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, info_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -7892,18 +8944,58 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, info_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.PaymentAck)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.PaymentAck other = (org.bitcoin.paymentchannel.Protos.PaymentAck) obj;
+
+ boolean result = true;
+ result = result && (hasInfo() == other.hasInfo());
+ if (hasInfo()) {
+ result = result && getInfo()
+ .equals(other.getInfo());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasInfo()) {
+ hash = (37 * hash) + INFO_FIELD_NUMBER;
+ hash = (53 * hash) + getInfo().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -7927,58 +9019,71 @@ public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.PaymentAck parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.PaymentAck prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.PaymentAck}
- *
*
* This message is sent as an acknowledgement of an UpdatePayment message
*
+ *
+ * Protobuf type {@code paymentchannels.PaymentAck}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderoptional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
public boolean hasInfo() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * optional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
public com.google.protobuf.ByteString getInfo() {
return info_;
}
/**
- * optional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
public Builder setInfo(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -8131,11 +9271,11 @@ public Builder setInfo(com.google.protobuf.ByteString value) {
return this;
}
/**
- * optional bytes info = 1;
- *
*
* Information about this update. Used to extend this protocol
*
+ *
+ * optional bytes info = 1;
*/
public Builder clearInfo() {
bitField0_ = (bitField0_ & ~0x00000001);
@@ -8143,16 +9283,57 @@ public Builder clearInfo() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.PaymentAck)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.PaymentAck)
+ private static final org.bitcoin.paymentchannel.Protos.PaymentAck DEFAULT_INSTANCE;
static {
- defaultInstance = new PaymentAck(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.PaymentAck();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.PaymentAck getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parserrequired bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
boolean hasTx();
/**
- * required bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
com.google.protobuf.ByteString getTx();
}
/**
* Protobuf type {@code paymentchannels.Settlement}
*/
- public static final class Settlement extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class Settlement extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.Settlement)
SettlementOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use Settlement.newBuilder() to construct.
- private Settlement(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private Settlement(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private Settlement(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final Settlement defaultInstance;
- public static Settlement getDefaultInstance() {
- return defaultInstance;
}
-
- public Settlement getDefaultInstanceForType() {
- return defaultInstance;
+ private Settlement() {
+ tx_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private Settlement(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -8223,25 +9399,25 @@ private Settlement(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 26: {
bitField0_ |= 0x00000001;
tx_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -8252,58 +9428,42 @@ private Settlement(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Settlement_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Settlement_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.Settlement.class, org.bitcoin.paymentchannel.Protos.Settlement.Builder.class);
}
- public static com.google.protobuf.Parserrequired bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
public boolean hasTx() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
public com.google.protobuf.ByteString getTx() {
return tx_;
}
- private void initFields() {
- tx_ = com.google.protobuf.ByteString.EMPTY;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -8317,18 +9477,18 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(3, tx_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
@@ -8336,18 +9496,58 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, tx_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.Settlement)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.Settlement other = (org.bitcoin.paymentchannel.Protos.Settlement) obj;
+
+ boolean result = true;
+ result = result && (hasTx() == other.hasTx());
+ if (hasTx()) {
+ result = result && getTx()
+ .equals(other.getTx());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasTx()) {
+ hash = (37 * hash) + TX_FIELD_NUMBER;
+ hash = (53 * hash) + getTx().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -8371,46 +9571,59 @@ public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.Settlement parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Settlement parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Settlement parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.Settlement prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@@ -8418,7 +9631,7 @@ protected Builder newBuilderForType(
* Protobuf type {@code paymentchannels.Settlement}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderrequired bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
public boolean hasTx() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * required bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
public com.google.protobuf.ByteString getTx() {
return tx_;
}
/**
- * required bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
public Builder setTx(com.google.protobuf.ByteString value) {
if (value == null) {
@@ -8578,12 +9825,12 @@ public Builder setTx(com.google.protobuf.ByteString value) {
return this;
}
/**
- * required bytes tx = 3;
- *
*
* A copy of the fully signed final contract that settles the channel. The client can verify
* the transaction is correct and then commit it to their wallet.
*
+ *
+ * required bytes tx = 3;
*/
public Builder clearTx() {
bitField0_ = (bitField0_ & ~0x00000001);
@@ -8591,16 +9838,57 @@ public Builder clearTx() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:paymentchannels.Settlement)
+ }
+
+ // @@protoc_insertion_point(class_scope:paymentchannels.Settlement)
+ private static final org.bitcoin.paymentchannel.Protos.Settlement DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.Settlement();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.Settlement getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parseroptional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
boolean hasExplanation();
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
java.lang.String getExplanation();
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
com.google.protobuf.ByteString
getExplanationBytes();
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
boolean hasExpectedValue();
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
long getExpectedValue();
}
/**
- * Protobuf type {@code paymentchannels.Error}
- *
*
* An Error can be sent by either party at any time
* Both parties should make an effort to send either an ERROR or a CLOSE immediately before
* closing the socket (unless they just received an ERROR or a CLOSE)
*
+ *
+ * Protobuf type {@code paymentchannels.Error}
*/
- public static final class Error extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class Error extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:paymentchannels.Error)
ErrorOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use Error.newBuilder() to construct.
- private Error(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private Error(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private Error(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final Error defaultInstance;
- public static Error getDefaultInstance() {
- return defaultInstance;
}
-
- public Error getDefaultInstanceForType() {
- return defaultInstance;
+ private Error() {
+ code_ = 8;
+ explanation_ = "";
+ expectedValue_ = 0L;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private Error(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -8710,21 +9995,15 @@ private Error(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 8: {
int rawValue = input.readEnum();
+ @SuppressWarnings("deprecation")
org.bitcoin.paymentchannel.Protos.Error.ErrorCode value = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.valueOf(rawValue);
if (value == null) {
unknownFields.mergeVarintField(1, rawValue);
} else {
bitField0_ |= 0x00000001;
- code_ = value;
+ code_ = rawValue;
}
break;
}
@@ -8739,13 +10018,20 @@ private Error(
expectedValue_ = input.readUInt64();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -8756,151 +10042,137 @@ private Error(
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Error_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Error_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.paymentchannel.Protos.Error.class, org.bitcoin.paymentchannel.Protos.Error.Builder.class);
}
- public static com.google.protobuf.ParserTIMEOUT = 1;
- *
*
* Protocol timeout occurred (one party hung).
*
+ *
+ * TIMEOUT = 1;
*/
- TIMEOUT(0, 1),
+ TIMEOUT(1),
/**
- * SYNTAX_ERROR = 2;
- *
*
* Generic error indicating some message was not properly
*
+ *
+ * SYNTAX_ERROR = 2;
*/
- SYNTAX_ERROR(1, 2),
+ SYNTAX_ERROR(2),
/**
- * NO_ACCEPTABLE_VERSION = 3;
- *
*
* formatted or was out of order.
*
+ *
+ * NO_ACCEPTABLE_VERSION = 3;
*/
- NO_ACCEPTABLE_VERSION(2, 3),
+ NO_ACCEPTABLE_VERSION(3),
/**
- * BAD_TRANSACTION = 4;
- *
*
* A provided transaction was not in the proper structure
*
+ *
+ * BAD_TRANSACTION = 4;
*/
- BAD_TRANSACTION(3, 4),
+ BAD_TRANSACTION(4),
/**
- * TIME_WINDOW_UNACCEPTABLE = 5;
- *
*
* (wrong inputs/outputs, sequence, lock time, signature,
* etc)
*
+ *
+ * TIME_WINDOW_UNACCEPTABLE = 5;
*/
- TIME_WINDOW_UNACCEPTABLE(4, 5),
+ TIME_WINDOW_UNACCEPTABLE(5),
/**
- * CHANNEL_VALUE_TOO_LARGE = 6;
- *
*
* for the primary
*
+ *
+ * CHANNEL_VALUE_TOO_LARGE = 6;
*/
- CHANNEL_VALUE_TOO_LARGE(5, 6),
+ CHANNEL_VALUE_TOO_LARGE(6),
/**
- * MIN_PAYMENT_TOO_LARGE = 7;
- *
*
* too large for the primary
*
+ *
+ * MIN_PAYMENT_TOO_LARGE = 7;
*/
- MIN_PAYMENT_TOO_LARGE(6, 7),
+ MIN_PAYMENT_TOO_LARGE(7),
/**
* OTHER = 8;
*/
- OTHER(7, 8),
+ OTHER(8),
;
/**
- * TIMEOUT = 1;
- *
*
* Protocol timeout occurred (one party hung).
*
+ *
+ * TIMEOUT = 1;
*/
public static final int TIMEOUT_VALUE = 1;
/**
- * SYNTAX_ERROR = 2;
- *
*
* Generic error indicating some message was not properly
*
+ *
+ * SYNTAX_ERROR = 2;
*/
public static final int SYNTAX_ERROR_VALUE = 2;
/**
- * NO_ACCEPTABLE_VERSION = 3;
- *
*
* formatted or was out of order.
*
+ *
+ * NO_ACCEPTABLE_VERSION = 3;
*/
public static final int NO_ACCEPTABLE_VERSION_VALUE = 3;
/**
- * BAD_TRANSACTION = 4;
- *
*
* A provided transaction was not in the proper structure
*
+ *
+ * BAD_TRANSACTION = 4;
*/
public static final int BAD_TRANSACTION_VALUE = 4;
/**
- * TIME_WINDOW_UNACCEPTABLE = 5;
- *
*
* (wrong inputs/outputs, sequence, lock time, signature,
* etc)
*
+ *
+ * TIME_WINDOW_UNACCEPTABLE = 5;
*/
public static final int TIME_WINDOW_UNACCEPTABLE_VALUE = 5;
/**
- * CHANNEL_VALUE_TOO_LARGE = 6;
- *
*
* for the primary
*
+ *
+ * CHANNEL_VALUE_TOO_LARGE = 6;
*/
public static final int CHANNEL_VALUE_TOO_LARGE_VALUE = 6;
/**
- * MIN_PAYMENT_TOO_LARGE = 7;
- *
*
* too large for the primary
*
+ *
+ * MIN_PAYMENT_TOO_LARGE = 7;
*/
public static final int MIN_PAYMENT_TOO_LARGE_VALUE = 7;
/**
@@ -8909,9 +10181,19 @@ public enum ErrorCode
public static final int OTHER_VALUE = 8;
- public final int getNumber() { return value; }
+ public final int getNumber() {
+ return value;
+ }
+ /**
+ * @deprecated Use {@link #forNumber(int)} instead.
+ */
+ @java.lang.Deprecated
public static ErrorCode valueOf(int value) {
+ return forNumber(value);
+ }
+
+ public static ErrorCode forNumber(int value) {
switch (value) {
case 1: return TIMEOUT;
case 2: return SYNTAX_ERROR;
@@ -8929,17 +10211,17 @@ public static ErrorCode valueOf(int value) {
internalGetValueMap() {
return internalValueMap;
}
- private static com.google.protobuf.Internal.EnumLiteMapoptional .paymentchannels.Error.ErrorCode code = 1 [default = OTHER];
*/
@@ -8985,27 +10265,29 @@ public boolean hasCode() {
* optional .paymentchannels.Error.ErrorCode code = 1 [default = OTHER];
*/
public org.bitcoin.paymentchannel.Protos.Error.ErrorCode getCode() {
- return code_;
+ @SuppressWarnings("deprecation")
+ org.bitcoin.paymentchannel.Protos.Error.ErrorCode result = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.valueOf(code_);
+ return result == null ? org.bitcoin.paymentchannel.Protos.Error.ErrorCode.OTHER : result;
}
public static final int EXPLANATION_FIELD_NUMBER = 2;
- private java.lang.Object explanation_;
+ private volatile java.lang.Object explanation_;
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public boolean hasExplanation() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public java.lang.String getExplanation() {
java.lang.Object ref = explanation_;
@@ -9022,11 +10304,11 @@ public java.lang.String getExplanation() {
}
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public com.google.protobuf.ByteString
getExplanationBytes() {
@@ -9045,32 +10327,28 @@ public java.lang.String getExplanation() {
public static final int EXPECTED_VALUE_FIELD_NUMBER = 3;
private long expectedValue_;
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
public boolean hasExpectedValue() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
public long getExpectedValue() {
return expectedValue_;
}
- private void initFields() {
- code_ = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.OTHER;
- explanation_ = "";
- expectedValue_ = 0L;
- }
private byte memoizedIsInitialized = -1;
+ @java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
@@ -9080,51 +10358,108 @@ public final boolean isInitialized() {
return true;
}
+ @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeEnum(1, code_.getNumber());
+ output.writeEnum(1, code_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeBytes(2, getExplanationBytes());
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, explanation_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeUInt64(3, expectedValue_);
}
- getUnknownFields().writeTo(output);
+ unknownFields.writeTo(output);
}
- private int memoizedSerializedSize = -1;
+ @java.lang.Override
public int getSerializedSize() {
- int size = memoizedSerializedSize;
+ int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
- .computeEnumSize(1, code_.getNumber());
+ .computeEnumSize(1, code_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
- size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(2, getExplanationBytes());
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, explanation_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(3, expectedValue_);
}
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
return size;
}
- private static final long serialVersionUID = 0L;
@java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.bitcoin.paymentchannel.Protos.Error)) {
+ return super.equals(obj);
+ }
+ org.bitcoin.paymentchannel.Protos.Error other = (org.bitcoin.paymentchannel.Protos.Error) obj;
+
+ boolean result = true;
+ result = result && (hasCode() == other.hasCode());
+ if (hasCode()) {
+ result = result && code_ == other.code_;
+ }
+ result = result && (hasExplanation() == other.hasExplanation());
+ if (hasExplanation()) {
+ result = result && getExplanation()
+ .equals(other.getExplanation());
+ }
+ result = result && (hasExpectedValue() == other.hasExpectedValue());
+ if (hasExpectedValue()) {
+ result = result && (getExpectedValue()
+ == other.getExpectedValue());
+ }
+ result = result && unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasCode()) {
+ hash = (37 * hash) + CODE_FIELD_NUMBER;
+ hash = (53 * hash) + code_;
+ }
+ if (hasExplanation()) {
+ hash = (37 * hash) + EXPLANATION_FIELD_NUMBER;
+ hash = (53 * hash) + getExplanation().hashCode();
+ }
+ if (hasExpectedValue()) {
+ hash = (37 * hash) + EXPECTED_VALUE_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ getExpectedValue());
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
}
+ public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -9148,60 +10483,73 @@ public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
}
public static org.bitcoin.paymentchannel.Protos.Error parseFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.Error parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Error parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
- return PARSER.parseFrom(input);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
}
public static org.bitcoin.paymentchannel.Protos.Error parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
}
- public static Builder newBuilder() { return Builder.create(); }
+ @java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
public static Builder newBuilder(org.bitcoin.paymentchannel.Protos.Error prototype) {
- return newBuilder().mergeFrom(prototype);
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
}
- public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
- * Protobuf type {@code paymentchannels.Error}
- *
*
* An Error can be sent by either party at any time
* Both parties should make an effort to send either an ERROR or a CLOSE immediately before
* closing the socket (unless they just received an ERROR or a CLOSE)
*
+ *
+ * Protobuf type {@code paymentchannels.Error}
*/
public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builderoptional .paymentchannels.Error.ErrorCode code = 1 [default = OTHER];
*/
@@ -9347,7 +10730,9 @@ public boolean hasCode() {
* optional .paymentchannels.Error.ErrorCode code = 1 [default = OTHER];
*/
public org.bitcoin.paymentchannel.Protos.Error.ErrorCode getCode() {
- return code_;
+ @SuppressWarnings("deprecation")
+ org.bitcoin.paymentchannel.Protos.Error.ErrorCode result = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.valueOf(code_);
+ return result == null ? org.bitcoin.paymentchannel.Protos.Error.ErrorCode.OTHER : result;
}
/**
* optional .paymentchannels.Error.ErrorCode code = 1 [default = OTHER];
@@ -9357,7 +10742,7 @@ public Builder setCode(org.bitcoin.paymentchannel.Protos.Error.ErrorCode value)
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
- code_ = value;
+ code_ = value.getNumber();
onChanged();
return this;
}
@@ -9366,28 +10751,28 @@ public Builder setCode(org.bitcoin.paymentchannel.Protos.Error.ErrorCode value)
*/
public Builder clearCode() {
bitField0_ = (bitField0_ & ~0x00000001);
- code_ = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.OTHER;
+ code_ = 8;
onChanged();
return this;
}
private java.lang.Object explanation_ = "";
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public boolean hasExplanation() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public java.lang.String getExplanation() {
java.lang.Object ref = explanation_;
@@ -9404,11 +10789,11 @@ public java.lang.String getExplanation() {
}
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public com.google.protobuf.ByteString
getExplanationBytes() {
@@ -9424,11 +10809,11 @@ public java.lang.String getExplanation() {
}
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public Builder setExplanation(
java.lang.String value) {
@@ -9441,11 +10826,11 @@ public Builder setExplanation(
return this;
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public Builder clearExplanation() {
bitField0_ = (bitField0_ & ~0x00000002);
@@ -9454,11 +10839,11 @@ public Builder clearExplanation() {
return this;
}
/**
- * optional string explanation = 2;
- *
*
* NOT SAFE FOR HTML WITHOUT ESCAPING
*
+ *
+ * optional string explanation = 2;
*/
public Builder setExplanationBytes(
com.google.protobuf.ByteString value) {
@@ -9473,31 +10858,31 @@ public Builder setExplanationBytes(
private long expectedValue_ ;
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
public boolean hasExpectedValue() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
public long getExpectedValue() {
return expectedValue_;
}
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
public Builder setExpectedValue(long value) {
bitField0_ |= 0x00000004;
@@ -9506,11 +10891,11 @@ public Builder setExpectedValue(long value) {
return this;
}
/**
- * optional uint64 expected_value = 3;
- *
*
* Can be set by the client when erroring to the server if a value was out of range. Can help with debugging.
*
+ *
+ * optional uint64 expected_value = 3;
*/
public Builder clearExpectedValue() {
bitField0_ = (bitField0_ & ~0x00000004);
@@ -9518,79 +10903,120 @@ public Builder clearExpectedValue() {
onChanged();
return this;
}
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
// @@protoc_insertion_point(builder_scope:paymentchannels.Error)
}
+ // @@protoc_insertion_point(class_scope:paymentchannels.Error)
+ private static final org.bitcoin.paymentchannel.Protos.Error DEFAULT_INSTANCE;
static {
- defaultInstance = new Error(true);
- defaultInstance.initFields();
+ DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.Error();
+ }
+
+ public static org.bitcoin.paymentchannel.Protos.Error getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ @java.lang.Deprecated public static final com.google.protobuf.Parseroptional uint64 amount = 1 [default = 0];
- *
*
* amount is integer-number-of-satoshis
*
+ *
+ * optional uint64 amount = 1 [default = 0];
*/
boolean hasAmount();
/**
- * optional uint64 amount = 1 [default = 0];
- *
*
* amount is integer-number-of-satoshis
*
+ *
+ * optional uint64 amount = 1 [default = 0];
*/
long getAmount();
/**
- * required bytes script = 2;
- *
*
* usually one of the standard Script forms
*
+ *
+ * required bytes script = 2;
*/
boolean hasScript();
/**
- * required bytes script = 2;
- *
*
* usually one of the standard Script forms
*
+ *
+ * required bytes script = 2;
*/
com.google.protobuf.ByteString getScript();
}
/**
- * Protobuf type {@code payments.Output}
- *
*
* Generalized form of "send payment to this/these bitcoin addresses"
*
+ *
+ * Protobuf type {@code payments.Output}
*/
- public static final class Output extends
- com.google.protobuf.GeneratedMessage implements
+ public static final class Output extends
+ com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:payments.Output)
OutputOrBuilder {
+ private static final long serialVersionUID = 0L;
// Use Output.newBuilder() to construct.
- private Output(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ private Output(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private Output(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final Output defaultInstance;
- public static Output getDefaultInstance() {
- return defaultInstance;
}
-
- public Output getDefaultInstanceForType() {
- return defaultInstance;
+ private Output() {
+ amount_ = 0L;
+ script_ = com.google.protobuf.ByteString.EMPTY;
}
- private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
+ getUnknownFields() {
return this.unknownFields;
}
private Output(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
@@ -95,13 +97,6 @@ private Output(
case 0:
done = true;
break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
case 8: {
bitField0_ |= 0x00000001;
amount_ = input.readUInt64();
@@ -112,13 +107,20 @@ private Output(
script_ = input.readBytes();
break;
}
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
+ e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
@@ -129,47 +131,33 @@ private Output(
return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.bitcoin.protocols.payments.Protos.Output.class, org.bitcoin.protocols.payments.Protos.Output.Builder.class);
}
- public static com.google.protobuf.Parser
This class implements an abstract class which makes it simple to create a BlockChain that does/doesn't do full * verification. It verifies headers and is implements most of what is required to implement SPV mode, but @@ -52,7 +53,7 @@ *
There are two subclasses of AbstractBlockChain that are useful: {@link BlockChain}, which is the simplest * class and implements simplified payment verification. This is a lightweight and efficient mode that does * not verify the contents of blocks, just their headers. A {@link FullPrunedBlockChain} paired with a - * {@link org.bitcoinj.store.H2FullPrunedBlockStore} implements full verification, which is equivalent to + * {@link H2FullPrunedBlockStore} implements full verification, which is equivalent to * Bitcoin Core. To learn more about the alternative security models, please consult the articles on the * website.
* @@ -68,8 +69,8 @@ * we say it is an orphan chain. Orphan chains can occur when blocks are solved and received during the initial block * chain download, or if we connect to a peer that doesn't send us blocks in order. * - *A reorganize occurs when the blocks that make up the best known chain changes. Note that simply adding a - * new block to the top of the best chain isn't as reorganize, but that a reorganize is always triggered by adding + *
A reorganize occurs when the blocks that make up the best known chain change. Note that simply adding a + * new block to the top of the best chain isn't a reorganize, but that a reorganize is always triggered by adding * a new block that connects to some other (non best head) block. By "best" we mean the chain representing the largest * amount of work done.
* @@ -121,7 +122,7 @@ class OrphanBlock { } // Holds blocks that we have received but can't plug into the chain yet, eg because they were created whilst we // were downloading the block chain. - private final LinkedHashMapA Bitcoin address looks like 1MsScoe2fTJoq4ZPdQgqyhgWeoNamYPevy and is derived from an elliptic curve public key - * plus a set of network parameters. Not to be confused with a {@link PeerAddress} or {@link AddressMessage} - * which are about network (TCP) addresses.
- * - *A standard address is built by taking the RIPE-MD160 hash of the public key bytes, with a version prefix and a - * checksum suffix, then encoding it textually as base58. The version prefix is used to both denote the network for - * which the address is valid (see {@link NetworkParameters}, and also to indicate how the bytes inside the address - * should be interpreted. Whilst almost all addresses today are hashes of public keys, another (currently unsupported - * type) can contain a hash of a script instead.
+ *+ * Base class for addresses, e.g. native segwit addresses ({@link SegwitAddress}) or legacy addresses ({@link LegacyAddress}). + *
+ * + *+ * Use {@link #fromString(NetworkParameters, String)} to conveniently construct any kind of address from its textual + * form. + *
*/ -public class Address extends VersionedChecksummedBytes { - /** - * An address is a RIPEMD160 hash of a public key, therefore is always 160 bits or 20 bytes. - */ - public static final int LENGTH = 20; - - private transient NetworkParameters params; - - /** - * Construct an address from parameters, the address version, and the hash160 form. Example:- * - *
new Address(MainNetParams.get(), NetworkParameters.getAddressHeader(), Hex.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));- */ - public Address(NetworkParameters params, int version, byte[] hash160) throws WrongNetworkException { - super(version, hash160); - checkNotNull(params); - checkArgument(hash160.length == 20, "Addresses are 160-bit hashes, so you must provide 20 bytes"); - if (!isAcceptableVersion(params, version)) - throw new WrongNetworkException(version, params.getAcceptableAddressCodes()); - this.params = params; - } - - /** Returns an Address that represents the given P2SH script hash. */ - public static Address fromP2SHHash(NetworkParameters params, byte[] hash160) { - try { - return new Address(params, params.getP2SHHeader(), hash160); - } catch (WrongNetworkException e) { - throw new RuntimeException(e); // Cannot happen. - } - } - - /** Returns an Address that represents the script hash extracted from the given scriptPubKey */ - public static Address fromP2SHScript(NetworkParameters params, Script scriptPubKey) { - checkArgument(scriptPubKey.isPayToScriptHash(), "Not a P2SH script"); - return fromP2SHHash(params, scriptPubKey.getPubKeyHash()); +public abstract class Address extends PrefixedChecksummedBytes { + public Address(NetworkParameters params, byte[] bytes) { + super(params, bytes); } /** - * Construct an address from its Base58 representation. + * Construct an address from its textual form. + * * @param params - * The expected NetworkParameters or null if you don't want validation. - * @param base58 - * The textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL". + * the expected network this address is valid for, or null if the network should be derived from the + * textual form + * @param str + * the textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL" or + * "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4" + * @return constructed address * @throws AddressFormatException - * if the given base58 doesn't parse or the checksum is invalid - * @throws WrongNetworkException - * if the given address is valid but for a different chain (eg testnet vs mainnet) - */ - public static Address fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException { - return new Address(params, base58); - } - - /** - * Construct an address from parameters and the hash160 form. Example:
- * - *
new Address(MainNetParams.get(), Hex.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));+ * if the given string doesn't parse or the checksum is invalid + * @throws AddressFormatException.WrongNetwork + * if the given string is valid but not for the expected network (eg testnet vs mainnet) */ - public Address(NetworkParameters params, byte[] hash160) { - super(params.getAddressHeader(), hash160); - checkArgument(hash160.length == 20, "Addresses are 160-bit hashes, so you must provide 20 bytes"); - this.params = params; - } - - /** @deprecated Use {@link #fromBase58(NetworkParameters, String)} */ - @Deprecated - public Address(@Nullable NetworkParameters params, String address) throws AddressFormatException { - super(address); - if (params != null) { - if (!isAcceptableVersion(params, version)) { - throw new WrongNetworkException(version, params.getAcceptableAddressCodes()); - } - this.params = params; - } else { - NetworkParameters paramsFound = null; - for (NetworkParameters p : Networks.get()) { - if (isAcceptableVersion(p, version)) { - paramsFound = p; - break; - } + public static Address fromString(@Nullable NetworkParameters params, String str) + throws AddressFormatException { + try { + return LegacyAddress.fromBase58(params, str); + } catch (AddressFormatException.WrongNetwork x) { + throw x; + } catch (AddressFormatException x) { + try { + return SegwitAddress.fromBech32(params, str); + } catch (AddressFormatException.WrongNetwork x2) { + throw x; + } catch (AddressFormatException x2) { + throw new AddressFormatException(str); } - if (paramsFound == null) - throw new AddressFormatException("No network found for " + address); - - this.params = paramsFound; } } - /** The (big endian) 20 byte hash that is the core of a Bitcoin address. */ - public byte[] getHash160() { - return bytes; - } - - /** - * Returns true if this address is a Pay-To-Script-Hash (P2SH) address. - * See also https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki: Address Format for pay-to-script-hash - */ - public boolean isP2SHAddress() { - final NetworkParameters parameters = getParameters(); - return parameters != null && this.version == parameters.p2shHeader; - } - - /** - * Examines the version byte of the address and attempts to find a matching NetworkParameters. If you aren't sure - * which network the address is intended for (eg, it was provided by a user), you can use this to decide if it is - * compatible with the current wallet. You should be able to handle a null response from this method. Note that the - * parameters returned is not necessarily the same as the one the Address was created with. - * - * @return a NetworkParameters representing the network the address is intended for. - */ - public NetworkParameters getParameters() { - return params; - } - /** - * Given an address, examines the version byte and attempts to find a matching NetworkParameters. If you aren't sure - * which network the address is intended for (eg, it was provided by a user), you can use this to decide if it is - * compatible with the current wallet. - * @return a NetworkParameters of the address - * @throws AddressFormatException if the string wasn't of a known version + * Construct an {@link Address} that represents the public part of the given {@link ECKey}. + * + * @param params + * network this address is valid for + * @param key + * only the public part is used + * @param outputScriptType + * script type the address should use + * @return constructed address */ - public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { - try { - return Address.fromBase58(null, address).getParameters(); - } catch (WrongNetworkException e) { - throw new RuntimeException(e); // Cannot happen. - } + public static Address fromKey(final NetworkParameters params, final ECKey key, final ScriptType outputScriptType) { + if (outputScriptType == Script.ScriptType.P2PKH) + return LegacyAddress.fromKey(params, key); + else if (outputScriptType == Script.ScriptType.P2WPKH) + return SegwitAddress.fromKey(params, key); + else + throw new IllegalArgumentException(outputScriptType.toString()); } /** - * Check if a given address version is valid given the NetworkParameters. + * Get either the public key hash or script hash that is encoded in the address. + * + * @return hash that is encoded in the address */ - private static boolean isAcceptableVersion(NetworkParameters params, int version) { - for (int v : params.getAcceptableAddressCodes()) { - if (version == v) { - return true; - } - } - return false; - } + public abstract byte[] getHash(); /** - * This implementation narrows the return type to
Address
.
+ * Get the type of output script that will be used for sending to the address.
+ *
+ * @return type of output script
*/
- @Override
- public Address clone() throws CloneNotSupportedException {
- return (Address) super.clone();
- }
-
- // Java serialization
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- out.defaultWriteObject();
- out.writeUTF(params.id);
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- params = NetworkParameters.fromID(in.readUTF());
- }
+ public abstract ScriptType getOutputScriptType();
}
diff --git a/core/src/main/java/org/bitcoinj/core/AddressFormatException.java b/core/src/main/java/org/bitcoinj/core/AddressFormatException.java
index 86528254318..e3b23e747cb 100644
--- a/core/src/main/java/org/bitcoinj/core/AddressFormatException.java
+++ b/core/src/main/java/org/bitcoinj/core/AddressFormatException.java
@@ -26,4 +26,81 @@ public AddressFormatException() {
public AddressFormatException(String message) {
super(message);
}
+
+ /**
+ * This exception is thrown by {@link Base58}, {@link Bech32} and the {@link PrefixedChecksummedBytes} hierarchy of
+ * classes when you try to decode data and a character isn't valid. You shouldn't allow the user to proceed in this
+ * case.
+ */
+ public static class InvalidCharacter extends AddressFormatException {
+ public final char character;
+ public final int position;
+
+ public InvalidCharacter(char character, int position) {
+ super("Invalid character '" + Character.toString(character) + "' at position " + position);
+ this.character = character;
+ this.position = position;
+ }
+ }
+
+ /**
+ * This exception is thrown by {@link Base58}, {@link Bech32} and the {@link PrefixedChecksummedBytes} hierarchy of
+ * classes when you try to decode data and the data isn't of the right size. You shouldn't allow the user to proceed
+ * in this case.
+ */
+ public static class InvalidDataLength extends AddressFormatException {
+ public InvalidDataLength() {
+ super();
+ }
+
+ public InvalidDataLength(String message) {
+ super(message);
+ }
+ }
+
+ /**
+ * This exception is thrown by {@link Base58}, {@link Bech32} and the {@link PrefixedChecksummedBytes} hierarchy of
+ * classes when you try to decode data and the checksum isn't valid. You shouldn't allow the user to proceed in this
+ * case.
+ */
+ public static class InvalidChecksum extends AddressFormatException {
+ public InvalidChecksum() {
+ super("Checksum does not validate");
+ }
+
+ public InvalidChecksum(String message) {
+ super(message);
+ }
+ }
+
+ /**
+ * This exception is thrown by the {@link PrefixedChecksummedBytes} hierarchy of classes when you try and decode an
+ * address or private key with an invalid prefix (version header or human-readable part). You shouldn't allow the
+ * user to proceed in this case.
+ */
+ public static class InvalidPrefix extends AddressFormatException {
+ public InvalidPrefix() {
+ super();
+ }
+
+ public InvalidPrefix(String message) {
+ super(message);
+ }
+ }
+
+ /**
+ * This exception is thrown by the {@link PrefixedChecksummedBytes} hierarchy of classes when you try and decode an
+ * address with a prefix (version header or human-readable part) that used by another network (usually: mainnet vs
+ * testnet). You shouldn't allow the user to proceed in this case as they are trying to send money across different
+ * chains, an operation that is guaranteed to destroy the money.
+ */
+ public static class WrongNetwork extends InvalidPrefix {
+ public WrongNetwork(int versionHeader) {
+ super("Version code of address did not match acceptable versions for network: " + versionHeader);
+ }
+
+ public WrongNetwork(String hrp) {
+ super("Human readable part of address did not match acceptable HRPs for network: " + hrp);
+ }
+ }
}
diff --git a/core/src/main/java/org/bitcoinj/core/AddressMessage.java b/core/src/main/java/org/bitcoinj/core/AddressMessage.java
index b4053852d56..04b3921bcc0 100644
--- a/core/src/main/java/org/bitcoinj/core/AddressMessage.java
+++ b/core/src/main/java/org/bitcoinj/core/AddressMessage.java
@@ -36,22 +36,20 @@ public class AddressMessage extends Message {
private List+ * be purely peer-to-peer. You don't have to use this of course, and indeed it often makes more sense not to.
* *Before doing anything with an alert, you should check {@link AlertMessage#isSignatureValid()}.
* @@ -87,7 +87,7 @@ protected void parse() throws ProtocolException { } // Using a hashset here is very inefficient given that this will normally be only one item. But Java doesn't // make it easy to do better. What we really want is just an array-backed set. - Set* Note that this is not the same base58 as used by Flickr, which you may find referenced around the Internet. *
- * You may want to consider working with {@link VersionedChecksummedBytes} instead, which + * You may want to consider working with {@link PrefixedChecksummedBytes} instead, which * adds support for testing the prefix and suffix bytes commonly found in addresses. *
* Satoshi explains: why base-58 instead of standard base-64 encoding?
@@ -90,6 +91,27 @@ public static String encode(byte[] input) {
return new String(encoded, outputStart, encoded.length - outputStart);
}
+ /**
+ * Encodes the given version and bytes as a base58 string. A checksum is appended.
+ *
+ * @param version the version to encode
+ * @param payload the bytes to encode, e.g. pubkey hash
+ * @return the base58-encoded string
+ */
+ public static String encodeChecked(int version, byte[] payload) {
+ if (version < 0 || version > 255)
+ throw new IllegalArgumentException("Version not in range.");
+
+ // A stringified buffer is:
+ // 1 byte version + data bytes + 4 bytes check code (a truncated hash)
+ byte[] addressBytes = new byte[1 + payload.length + 4];
+ addressBytes[0] = (byte) version;
+ System.arraycopy(payload, 0, addressBytes, 1, payload.length);
+ byte[] checksum = Sha256Hash.hashTwice(addressBytes, 0, payload.length + 1);
+ System.arraycopy(checksum, 0, addressBytes, payload.length + 1, 4);
+ return Base58.encode(addressBytes);
+ }
+
/**
* Decodes the given base58 string into the original data bytes.
*
@@ -107,7 +129,7 @@ public static byte[] decode(String input) throws AddressFormatException {
char c = input.charAt(i);
int digit = c < 128 ? INDEXES[c] : -1;
if (digit < 0) {
- throw new AddressFormatException("Illegal character " + c + " at position " + i);
+ throw new AddressFormatException.InvalidCharacter(c, i);
}
input58[i] = (byte) digit;
}
@@ -148,12 +170,12 @@ public static BigInteger decodeToBigInteger(String input) throws AddressFormatEx
public static byte[] decodeChecked(String input) throws AddressFormatException {
byte[] decoded = decode(input);
if (decoded.length < 4)
- throw new AddressFormatException("Input too short");
+ throw new AddressFormatException.InvalidDataLength("Input too short: " + decoded.length);
byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4);
byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length);
byte[] actualChecksum = Arrays.copyOfRange(Sha256Hash.hashTwice(data), 0, 4);
if (!Arrays.equals(checksum, actualChecksum))
- throw new AddressFormatException("Checksum does not validate");
+ throw new AddressFormatException.InvalidChecksum();
return data;
}
@@ -180,5 +202,4 @@ private static byte divmod(byte[] number, int firstDigit, int base, int divisor)
}
return (byte) remainder;
}
-
}
diff --git a/core/src/main/java/org/bitcoinj/core/Bech32.java b/core/src/main/java/org/bitcoinj/core/Bech32.java
new file mode 100644
index 00000000000..120056c9d8d
--- /dev/null
+++ b/core/src/main/java/org/bitcoinj/core/Bech32.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2018 Coinomi Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.bitcoinj.core;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import java.util.Arrays;
+import java.util.Locale;
+
+public class Bech32 {
+ /** The Bech32 character set for encoding. */
+ private static final String CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
+
+ /** The Bech32 character set for decoding. */
+ private static final byte[] CHARSET_REV = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 15, -1, 10, 17, 21, 20, 26, 30, 7, 5, -1, -1, -1, -1, -1, -1,
+ -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1,
+ 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1,
+ -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1,
+ 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1
+ };
+
+ public static class Bech32Data {
+ public final String hrp;
+ public final byte[] data;
+
+ private Bech32Data(final String hrp, final byte[] data) {
+ this.hrp = hrp;
+ this.data = data;
+ }
+ }
+
+ /** Find the polynomial with value coefficients mod the generator as 30-bit. */
+ private static int polymod(final byte[] values) {
+ int c = 1;
+ for (byte v_i: values) {
+ int c0 = (c >>> 25) & 0xff;
+ c = ((c & 0x1ffffff) << 5) ^ (v_i & 0xff);
+ if ((c0 & 1) != 0) c ^= 0x3b6a57b2;
+ if ((c0 & 2) != 0) c ^= 0x26508e6d;
+ if ((c0 & 4) != 0) c ^= 0x1ea119fa;
+ if ((c0 & 8) != 0) c ^= 0x3d4233dd;
+ if ((c0 & 16) != 0) c ^= 0x2a1462b3;
+ }
+ return c;
+ }
+
+ /** Expand a HRP for use in checksum computation. */
+ private static byte[] expandHrp(final String hrp) {
+ int hrpLength = hrp.length();
+ byte ret[] = new byte[hrpLength * 2 + 1];
+ for (int i = 0; i < hrpLength; ++i) {
+ int c = hrp.charAt(i) & 0x7f; // Limit to standard 7-bit ASCII
+ ret[i] = (byte) ((c >>> 5) & 0x07);
+ ret[i + hrpLength + 1] = (byte) (c & 0x1f);
+ }
+ ret[hrpLength] = 0;
+ return ret;
+ }
+
+ /** Verify a checksum. */
+ private static boolean verifyChecksum(final String hrp, final byte[] values) {
+ byte[] hrpExpanded = expandHrp(hrp);
+ byte[] combined = new byte[hrpExpanded.length + values.length];
+ System.arraycopy(hrpExpanded, 0, combined, 0, hrpExpanded.length);
+ System.arraycopy(values, 0, combined, hrpExpanded.length, values.length);
+ return polymod(combined) == 1;
+ }
+
+ /** Create a checksum. */
+ private static byte[] createChecksum(final String hrp, final byte[] values) {
+ byte[] hrpExpanded = expandHrp(hrp);
+ byte[] enc = new byte[hrpExpanded.length + values.length + 6];
+ System.arraycopy(hrpExpanded, 0, enc, 0, hrpExpanded.length);
+ System.arraycopy(values, 0, enc, hrpExpanded.length, values.length);
+ int mod = polymod(enc) ^ 1;
+ byte[] ret = new byte[6];
+ for (int i = 0; i < 6; ++i) {
+ ret[i] = (byte) ((mod >>> (5 * (5 - i))) & 31);
+ }
+ return ret;
+ }
+
+ /** Encode a Bech32 string. */
+ public static String encode(final Bech32Data bech32) {
+ return encode(bech32.hrp, bech32.data);
+ }
+
+ /** Encode a Bech32 string. */
+ public static String encode(String hrp, final byte[] values) {
+ checkArgument(hrp.length() >= 1, "Human-readable part is too short");
+ checkArgument(hrp.length() <= 83, "Human-readable part is too long");
+ hrp = hrp.toLowerCase(Locale.ROOT);
+ byte[] checksum = createChecksum(hrp, values);
+ byte[] combined = new byte[values.length + checksum.length];
+ System.arraycopy(values, 0, combined, 0, values.length);
+ System.arraycopy(checksum, 0, combined, values.length, checksum.length);
+ StringBuilder sb = new StringBuilder(hrp.length() + 1 + combined.length);
+ sb.append(hrp);
+ sb.append('1');
+ for (byte b : combined) {
+ sb.append(CHARSET.charAt(b));
+ }
+ return sb.toString();
+ }
+
+ /** Decode a Bech32 string. */
+ public static Bech32Data decode(final String str) throws AddressFormatException {
+ boolean lower = false, upper = false;
+ if (str.length() < 8)
+ throw new AddressFormatException.InvalidDataLength("Input too short: " + str.length());
+ if (str.length() > 90)
+ throw new AddressFormatException.InvalidDataLength("Input too long: " + str.length());
+ for (int i = 0; i < str.length(); ++i) {
+ char c = str.charAt(i);
+ if (c < 33 || c > 126) throw new AddressFormatException.InvalidCharacter(c, i);
+ if (c >= 'a' && c <= 'z') {
+ if (upper)
+ throw new AddressFormatException.InvalidCharacter(c, i);
+ lower = true;
+ }
+ if (c >= 'A' && c <= 'Z') {
+ if (lower)
+ throw new AddressFormatException.InvalidCharacter(c, i);
+ upper = true;
+ }
+ }
+ final int pos = str.lastIndexOf('1');
+ if (pos < 1) throw new AddressFormatException.InvalidPrefix("Missing human-readable part");
+ final int dataPartLength = str.length() - 1 - pos;
+ if (dataPartLength < 6) throw new AddressFormatException.InvalidDataLength("Data part too short: " + dataPartLength);
+ byte[] values = new byte[dataPartLength];
+ for (int i = 0; i < dataPartLength; ++i) {
+ char c = str.charAt(i + pos + 1);
+ if (CHARSET_REV[c] == -1) throw new AddressFormatException.InvalidCharacter(c, i + pos + 1);
+ values[i] = CHARSET_REV[c];
+ }
+ String hrp = str.substring(0, pos).toLowerCase(Locale.ROOT);
+ if (!verifyChecksum(hrp, values)) throw new AddressFormatException.InvalidChecksum();
+ return new Bech32Data(hrp, Arrays.copyOfRange(values, 0, values.length - 6));
+ }
+}
diff --git a/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java b/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java
index 6f68e00c63b..c149a93d5f3 100644
--- a/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java
+++ b/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java
@@ -24,6 +24,7 @@
import java.io.OutputStream;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@@ -48,7 +49,7 @@ public class BitcoinSerializer extends MessageSerializer {
private final NetworkParameters params;
private final boolean parseRetain;
- private static final Map
To get a block, you can either build one from the raw bytes you can get from another implementation, or request one * specifically using {@link Peer#getBlock(Sha256Hash)}, or grab one from a downloaded {@link BlockChain}.
@@ -92,7 +93,7 @@ public enum VerifyFlag { // Fields defined as part of the protocol format. private long version; private Sha256Hash prevBlockHash; - private Sha256Hash merkleRoot; + private Sha256Hash merkleRoot, witnessRoot; private long time; private long difficultyTarget; // "nBits" private long nonce; @@ -118,7 +119,7 @@ public enum VerifyFlag { // Set up a few basic things. We are not complete after this though. version = setVersion; difficultyTarget = 0x1d07fff8L; - time = System.currentTimeMillis() / 1000; + time = Utils.currentTimeSeconds(); prevBlockHash = Sha256Hash.ZERO_HASH; length = HEADER_SIZE; @@ -201,7 +202,7 @@ public Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, S this.time = time; this.difficultyTarget = difficultyTarget; this.nonce = nonce; - this.transactions = new LinkedListThe half-life is controlled by {@link org.bitcoinj.core.NetworkParameters#getSubsidyDecreaseBlockCount()}. + *
The half-life is controlled by {@link NetworkParameters#getSubsidyDecreaseBlockCount()}. *
*/ public Coin getBlockInflation(int height) { @@ -237,9 +238,9 @@ protected void parseTransactions(final int transactionsOffset) throws ProtocolEx int numTransactions = (int) readVarInt(); optimalEncodingMessageSize += VarInt.sizeOf(numTransactions); - transactions = new ArrayListConstructs a BlockChain connected to the given wallet and store. To obtain a {@link Wallet} you can construct * one from scratch, or you can deserialize a saved wallet from disk using - * {@link Wallet#loadFromFile(java.io.File, WalletExtension...)}
+ * {@link Wallet#loadFromFile(File, WalletExtension...)} * - *For the store, you should use {@link org.bitcoinj.store.SPVBlockStore} or you could also try a - * {@link org.bitcoinj.store.MemoryBlockStore} if you want to hold all headers in RAM and don't care about + *
For the store, you should use {@link SPVBlockStore} or you could also try a + * {@link MemoryBlockStore} if you want to hold all headers in RAM and don't care about * disk serialization (this is rare).
*/ public BlockChain(Context context, Wallet wallet, BlockStore blockStore) throws BlockStoreException { diff --git a/core/src/main/java/org/bitcoinj/core/BlockLocator.java b/core/src/main/java/org/bitcoinj/core/BlockLocator.java new file mode 100644 index 00000000000..74a33a4eb2b --- /dev/null +++ b/core/src/main/java/org/bitcoinj/core/BlockLocator.java @@ -0,0 +1,88 @@ +/* + * Copyright by the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.bitcoinj.core; + +import com.google.common.collect.ImmutableList; + +import java.util.List; + +/** + * Represents Block Locator in GetBlocks and GetHeaders messages + **/ +public final class BlockLocator { + private final ImmutableListupdateFlag is used to control filter behaviour on the server (remote node) side when it encounters a hit. - * See {@link org.bitcoinj.core.BloomFilter.BloomUpdate} for a brief description of each mode. The purpose + * See {@link BloomFilter.BloomUpdate} for a brief description of each mode. The purpose * of this flag is to reduce network round-tripping and avoid over-dirtying the filter for the most common * wallet configurations.
*/ @@ -129,7 +132,11 @@ public double getFalsePositiveRate(int elements) { @Override public String toString() { - return "Bloom Filter of size " + data.length + " with " + hashFuncs + " hash functions."; + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); + helper.add("data length", data.length); + helper.add("hashFuncs", hashFuncs); + helper.add("nFlags", getUpdateFlag()); + return helper.toString(); } @Override @@ -163,7 +170,7 @@ private static int rotateLeft32(int x, int r) { /** * Applies the MurmurHash3 (x86_32) algorithm to the given data. - * See this C++ code for the original. + * See this C++ code for the original. */ public static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object) { int h1 = (int)(hashNum * 0xFBA4C795L + nTweak); @@ -240,6 +247,11 @@ public synchronized void insert(ECKey key) { insert(key.getPubKeyHash()); } + /** Inserts the given transaction outpoint. */ + public synchronized void insert(TransactionOutPoint outpoint) { + insert(outpoint.unsafeBitcoinSerialize()); + } + /** * Sets this filter to match all objects. A Bloom filter which matches everything may seem pointless, however, * it is useful in order to reduce steady state bandwidth usage when you want full blocks. Instead of receiving @@ -268,7 +280,7 @@ public synchronized void merge(BloomFilter filter) { } /** - * Returns true if this filter will match anything. See {@link org.bitcoinj.core.BloomFilter#setMatchAll()} + * Returns true if this filter will match anything. See {@link BloomFilter#setMatchAll()} * for when this can be a useful thing to do. */ public synchronized boolean matchesAll() { @@ -301,12 +313,12 @@ else if (nFlags == 2) */ public synchronized FilteredBlock applyAndUpdate(Block block) { ListCheckpoints are used by the SPV {@link BlockChain} to initialize fresh - * {@link org.bitcoinj.store.SPVBlockStore}s. They are not used by fully validating mode, which instead has a + * {@link SPVBlockStore}s. They are not used by fully validating mode, which instead has a * different concept of checkpoints that are used to hard-code the validity of blocks that violate BIP30 (duplicate * coinbase transactions). Those "checkpoints" can be found in NetworkParameters.
* @@ -75,8 +76,8 @@ public class CheckpointManager { private static final String TEXTUAL_MAGIC = "TXT CHECKPOINTS 1"; private static final int MAX_SIGNATURES = 256; - // Map of block header time to data. - protected final TreeMapNote that time is adjusted backwards by a week to account for possible clock drift in the block headers.
+ *Note that timeSecs is adjusted backwards by a week to account for possible clock drift in the block headers.
*/ - public static void checkpoint(NetworkParameters params, InputStream checkpoints, BlockStore store, long time) + public static void checkpoint(NetworkParameters params, InputStream checkpoints, BlockStore store, long timeSecs) throws IOException, BlockStoreException { checkNotNull(params); checkNotNull(store); checkArgument(!(store instanceof FullPrunedBlockStore), "You cannot use checkpointing with a full store."); - time -= 86400 * 7; + timeSecs -= 60 * 60 * 24 * 7; // one week in seconds - checkArgument(time > 0); - log.info("Attempting to initialize a new block store with a checkpoint for time {} ({})", time, Utils.dateTimeFormat(time * 1000)); + checkArgument(timeSecs > 0); + log.info("Attempting to initialize a new block store with a checkpoint for time {} ({})", timeSecs, + Utils.dateTimeFormat(timeSecs * 1000)); BufferedInputStream stream = new BufferedInputStream(checkpoints); CheckpointManager manager = new CheckpointManager(params, stream); - StoredBlock checkpoint = manager.getCheckpointBefore(time); + StoredBlock checkpoint = manager.getCheckpointBefore(timeSecs); store.put(checkpoint); store.setChainHead(checkpoint); } diff --git a/core/src/main/java/org/bitcoinj/core/ChildMessage.java b/core/src/main/java/org/bitcoinj/core/ChildMessage.java index 87576d311a6..38caea80c72 100644 --- a/core/src/main/java/org/bitcoinj/core/ChildMessage.java +++ b/core/src/main/java/org/bitcoinj/core/ChildMessage.java @@ -29,7 +29,7 @@ public abstract class ChildMessage extends Message { @Nullable protected Message parent; /** - * @deprecated Use {@link #ChildMessage(NetworkParameters) instead. + * @deprecated Use {@link #ChildMessage(NetworkParameters)} instead. */ @Deprecated protected ChildMessage() { @@ -43,7 +43,8 @@ public ChildMessage(NetworkParameters params, byte[] payload, int offset, int pr super(params, payload, offset, protocolVersion); } - public ChildMessage(NetworkParameters params, byte[] payload, int offset, int protocolVersion, Message parent, MessageSerializer setSerializer, int length) throws ProtocolException { + public ChildMessage(NetworkParameters params, byte[] payload, int offset, int protocolVersion, + @Nullable Message parent, MessageSerializer setSerializer, int length) throws ProtocolException { super(params, payload, offset, protocolVersion, setSerializer, length); this.parent = parent; } diff --git a/core/src/main/java/org/bitcoinj/core/Coin.java b/core/src/main/java/org/bitcoinj/core/Coin.java index a1a22b4a353..370f15dbcf7 100644 --- a/core/src/main/java/org/bitcoinj/core/Coin.java +++ b/core/src/main/java/org/bitcoinj/core/Coin.java @@ -116,16 +116,33 @@ public static Coin valueOf(final int coins, final int cents) { } /** - * Parses an amount expressed in the way humans are used to.- *
- * This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, - * for example "0", "1", "0.10", "1.23E3", "1234.5E-5". + *Parses an amount expressed in the way humans are used to.
+ *This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", + * "1.23E3", "1234.5E-5".
* - * @throws IllegalArgumentException if you try to specify fractional satoshis, or a value out of range. + * @throws IllegalArgumentException + * if you try to specify fractional satoshis, or a value out of range. */ public static Coin parseCoin(final String str) { try { - long satoshis = new BigDecimal(str).movePointRight(SMALLEST_UNIT_EXPONENT).toBigIntegerExact().longValue(); + long satoshis = new BigDecimal(str).movePointRight(SMALLEST_UNIT_EXPONENT).longValueExact(); + return Coin.valueOf(satoshis); + } catch (ArithmeticException e) { + throw new IllegalArgumentException(e); // Repackage exception to honor method contract + } + } + + /** + *Parses an amount expressed in the way humans are used to. The amount is cut to satoshi precision.
+ *This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", + * "1.23E3", "1234.5E-5".
+ * + * @throws IllegalArgumentException + * if you try to specify a value out of range. + */ + public static Coin parseCoinInexact(final String str) { + try { + long satoshis = new BigDecimal(str).movePointRight(SMALLEST_UNIT_EXPONENT).longValue(); return Coin.valueOf(satoshis); } catch (ArithmeticException e) { throw new IllegalArgumentException(e); // Repackage exception to honor method contract diff --git a/core/src/main/java/org/bitcoinj/core/Context.java b/core/src/main/java/org/bitcoinj/core/Context.java index 709b98d66e3..26954dbd44d 100644 --- a/core/src/main/java/org/bitcoinj/core/Context.java +++ b/core/src/main/java/org/bitcoinj/core/Context.java @@ -1,4 +1,6 @@ /* + * Copyright by the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,6 +16,8 @@ package org.bitcoinj.core; +import org.bitcoinj.utils.ContextPropagatingThreadFactory; +import org.bitcoinj.wallet.SendRequest; import org.slf4j.*; import static com.google.common.base.Preconditions.*; @@ -25,7 +29,6 @@ // TODO: Move Threading.USER_THREAD to here and leave behind just a source code stub. Allow different instantiations of the library to use different user threads. // TODO: Keep a URI to where library internal data files can be found, to abstract over the lack of JAR files on Android. // TODO: Stash anything else that resembles global library configuration in here and use it to clean up the rest of the API without breaking people. -// TODO: Move the TorClient into Context, so different parts of the library can read data over Tor without having to request it directly. (or maybe a general socket factory??) /** *The Context object holds various objects and pieces of configuration that are scoped to a specific instantiation of
@@ -41,11 +44,13 @@
public class Context {
private static final Logger log = LoggerFactory.getLogger(Context.class);
- private TxConfidenceTable confidenceTable;
- private NetworkParameters params;
- private int eventHorizon = 100;
- private boolean ensureMinRequiredFee = true;
- private Coin feePerKb = Transaction.DEFAULT_TX_FEE;
+ public static final int DEFAULT_EVENT_HORIZON = 100;
+
+ final private TxConfidenceTable confidenceTable;
+ final private NetworkParameters params;
+ final private int eventHorizon;
+ final private boolean ensureMinRequiredFee;
+ final private Coin feePerKb;
/**
* Creates a new context object. For now, this will be done for you by the framework. Eventually you will be
@@ -54,31 +59,31 @@ public class Context {
* @param params The network parameters that will be associated with this context.
*/
public Context(NetworkParameters params) {
- this.confidenceTable = new TxConfidenceTable();
- this.params = params;
- lastConstructed = this;
- // We may already have a context in our TLS slot. This can happen a lot during unit tests, so just ignore it.
- slot.set(this);
+ this(params, DEFAULT_EVENT_HORIZON, Transaction.DEFAULT_TX_FEE, true);
}
/**
* Creates a new custom context object. This is mainly meant for unit tests for now.
*
* @param params The network parameters that will be associated with this context.
- * @param eventHorizon Number of blocks after which the library will delete data and be unable to always process reorgs (see {@link #getEventHorizon()}.
- * @param feePerKb The default fee per 1000 bytes of transaction data to pay when completing transactions. For details, see {@link SendRequest#feePerKb}.
+ * @param eventHorizon Number of blocks after which the library will delete data and be unable to always process reorgs. See {@link #getEventHorizon()}.
+ * @param feePerKb The default fee per 1000 virtual bytes of transaction data to pay when completing transactions. For details, see {@link SendRequest#feePerKb}.
* @param ensureMinRequiredFee Whether to ensure the minimum required fee by default when completing transactions. For details, see {@link SendRequest#ensureMinRequiredFee}.
*/
public Context(NetworkParameters params, int eventHorizon, Coin feePerKb, boolean ensureMinRequiredFee) {
- this(params);
+ log.info("Creating bitcoinj {} context.", VersionMessage.BITCOINJ_VERSION);
+ this.confidenceTable = new TxConfidenceTable();
+ this.params = params;
this.eventHorizon = eventHorizon;
- this.feePerKb = feePerKb;
this.ensureMinRequiredFee = ensureMinRequiredFee;
+ this.feePerKb = feePerKb;
+ lastConstructed = this;
+ slot.set(this);
}
private static volatile Context lastConstructed;
private static boolean isStrictMode;
- private static final ThreadLocal Represents an elliptic curve public and (optionally) private key, usable for digital signatures but not encryption.
@@ -136,10 +138,8 @@ public int compare(ECKey k1, ECKey k2) {
if (Utils.isAndroidRuntime())
new LinuxSecureRandom();
- // Tell Bouncy Castle to precompute data that's needed during secp256k1 calculations. Increasing the width
- // number makes calculations faster, but at a cost of extra memory usage and with decreasing returns. 12 was
- // picked after consulting with the BC team.
- FixedPointUtil.precompute(CURVE_PARAMS.getG(), 12);
+ // Tell Bouncy Castle to precompute data that's needed during secp256k1 calculations.
+ FixedPointUtil.precompute(CURVE_PARAMS.getG());
CURVE = new ECDomainParameters(CURVE_PARAMS.getCurve(), CURVE_PARAMS.getG(), CURVE_PARAMS.getN(),
CURVE_PARAMS.getH());
HALF_CURVE_ORDER = CURVE_PARAMS.getN().shiftRight(1);
@@ -148,7 +148,7 @@ public int compare(ECKey k1, ECKey k2) {
// The two parts of the key. If "priv" is set, "pub" can always be calculated. If "pub" is set but not "priv", we
// can only verify signatures not make them.
- protected final BigInteger priv; // A field element.
+ @Nullable protected final BigInteger priv; // A field element.
protected final LazyECPoint pub;
// Creation time of the key in seconds since the epoch, or zero if the key was deserialized from a version that did
@@ -185,18 +185,18 @@ public ECKey(SecureRandom secureRandom) {
}
protected ECKey(@Nullable BigInteger priv, ECPoint pub) {
+ this(priv, new LazyECPoint(checkNotNull(pub)));
+ }
+
+ protected ECKey(@Nullable BigInteger priv, LazyECPoint pub) {
if (priv != null) {
+ checkArgument(priv.bitLength() <= 32 * 8, "private key exceeds 32 bytes: %s bits", priv.bitLength());
// Try and catch buggy callers or bad key imports, etc. Zero and one are special because these are often
// used as sentinel values and because scripting languages have a habit of auto-casting true and false to
// 1 and 0 or vice-versa. Type confusion bugs could therefore result in private keys with these values.
checkArgument(!priv.equals(BigInteger.ZERO));
checkArgument(!priv.equals(BigInteger.ONE));
}
- this.priv = priv;
- this.pub = new LazyECPoint(checkNotNull(pub));
- }
-
- protected ECKey(@Nullable BigInteger priv, LazyECPoint pub) {
this.priv = priv;
this.pub = checkNotNull(pub);
}
@@ -446,8 +446,8 @@ public byte[] toASN1() {
}
/**
- * Returns public key bytes from the given private key. To convert a byte array into a BigInteger, use
- * new BigInteger(1, bytes);
+ * Returns public key bytes from the given private key. To convert a byte array into a BigInteger,
+ * use {@code new BigInteger(1, bytes);}
*/
public static byte[] publicKeyFromPrivate(BigInteger privKey, boolean compressed) {
ECPoint point = publicPointFromPrivate(privKey);
@@ -455,8 +455,8 @@ public static byte[] publicKeyFromPrivate(BigInteger privKey, boolean compressed
}
/**
- * Returns public key point from the given private key. To convert a byte array into a BigInteger, use
- * new BigInteger(1, bytes);
+ * Returns public key point from the given private key. To convert a byte array into a BigInteger,
+ * use {@code new BigInteger(1, bytes);}
*/
public static ECPoint publicPointFromPrivate(BigInteger privKey) {
/*
@@ -508,14 +508,6 @@ public boolean isCompressed() {
return pub.isCompressed();
}
- /**
- * Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from
- * the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient).
- */
- public Address toAddress(NetworkParameters params) {
- return new Address(params, getPubKeyHash());
- }
-
/**
* Groups the two components that make up a signature, and provides a way to encode to DER form, which is
* how ECDSA signatures are represented when embedded in other data structures in the Bitcoin protocol. The raw
@@ -574,28 +566,38 @@ public byte[] encodeToDER() {
}
}
- public static ECDSASignature decodeFromDER(byte[] bytes) {
+ /**
+ * @throws SignatureDecodeException if the signature is unparseable in some way.
+ */
+ public static ECDSASignature decodeFromDER(byte[] bytes) throws SignatureDecodeException {
ASN1InputStream decoder = null;
try {
+ // BouncyCastle by default is strict about parsing ASN.1 integers. We relax this check, because some
+ // Bitcoin signatures would not parse.
+ Properties.setThreadOverride("org.bouncycastle.asn1.allow_unsafe_integer", true);
decoder = new ASN1InputStream(bytes);
- DLSequence seq = (DLSequence) decoder.readObject();
- if (seq == null)
- throw new RuntimeException("Reached past end of ASN.1 stream.");
+ final ASN1Primitive seqObj = decoder.readObject();
+ if (seqObj == null)
+ throw new SignatureDecodeException("Reached past end of ASN.1 stream.");
+ if (!(seqObj instanceof DLSequence))
+ throw new SignatureDecodeException("Read unexpected class: " + seqObj.getClass().getName());
+ final DLSequence seq = (DLSequence) seqObj;
ASN1Integer r, s;
try {
r = (ASN1Integer) seq.getObjectAt(0);
s = (ASN1Integer) seq.getObjectAt(1);
} catch (ClassCastException e) {
- throw new IllegalArgumentException(e);
+ throw new SignatureDecodeException(e);
}
// OpenSSL deviates from the DER spec by interpreting these values as unsigned, though they should not be
// Thus, we always use the positive versions. See: http://r6.ca/blog/20111119T211504Z.html
return new ECDSASignature(r.getPositiveValue(), s.getPositiveValue());
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new SignatureDecodeException(e);
} finally {
if (decoder != null)
try { decoder.close(); } catch (IOException x) {}
+ Properties.removeThreadOverride("org.bouncycastle.asn1.allow_unsafe_integer");
}
}
@@ -625,7 +627,7 @@ public int hashCode() {
/**
* Signs the given hash and returns the R and S components as BigIntegers. In the Bitcoin protocol, they are
- * usually encoded using ASN.1 format, so you want {@link org.bitcoinj.core.ECKey.ECDSASignature#toASN1()}
+ * usually encoded using ASN.1 format, so you want {@link ECKey.ECDSASignature#toASN1()}
* instead. However sometimes the independent components can be useful, for instance, if you're going to do
* further EC maths on them.
* @throws KeyCrypterException if this ECKey doesn't have a private part.
@@ -644,7 +646,7 @@ public ECDSASignature sign(Sha256Hash input) throws KeyCrypterException {
/**
* Signs the given hash and returns the R and S components as BigIntegers. In the Bitcoin protocol, they are
- * usually encoded using DER format, so you want {@link org.bitcoinj.core.ECKey.ECDSASignature#encodeToDER()}
+ * usually encoded using DER format, so you want {@link ECKey.ECDSASignature#encodeToDER()}
* instead. However sometimes the independent components can be useful, for instance, if you're doing to do further
* EC maths on them.
*
@@ -677,6 +679,8 @@ protected ECDSASignature doSign(Sha256Hash input, BigInteger privateKeyForSignin
} catch (NativeSecp256k1Util.AssertFailException e) {
log.error("Caught AssertFailException inside secp256k1", e);
throw new RuntimeException(e);
+ } catch (SignatureDecodeException e) {
+ throw new RuntimeException(e); // cannot happen
}
}
if (FAKE_SIGNATURES)
@@ -731,8 +735,9 @@ public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub)
* @param data Hash of the data to verify.
* @param signature ASN.1 encoded signature.
* @param pub The public key bytes to use.
+ * @throws SignatureDecodeException if the signature is unparseable in some way.
*/
- public static boolean verify(byte[] data, byte[] signature, byte[] pub) {
+ public static boolean verify(byte[] data, byte[] signature, byte[] pub) throws SignatureDecodeException {
if (Secp256k1Context.isEnabled()) {
try {
return NativeSecp256k1.verify(data, signature, pub);
@@ -749,8 +754,9 @@ public static boolean verify(byte[] data, byte[] signature, byte[] pub) {
*
* @param hash Hash of the data to verify.
* @param signature ASN.1 encoded signature.
+ * @throws SignatureDecodeException if the signature is unparseable in some way.
*/
- public boolean verify(byte[] hash, byte[] signature) {
+ public boolean verify(byte[] hash, byte[] signature) throws SignatureDecodeException {
return ECKey.verify(hash, signature, getPubKey());
}
@@ -764,9 +770,10 @@ public boolean verify(Sha256Hash sigHash, ECDSASignature signature) {
/**
* Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key, and throws an exception
* if the signature doesn't match
+ * @throws SignatureDecodeException if the signature is unparseable in some way.
* @throws java.security.SignatureException if the signature does not match.
*/
- public void verifyOrThrow(byte[] hash, byte[] signature) throws SignatureException {
+ public void verifyOrThrow(byte[] hash, byte[] signature) throws SignatureDecodeException, SignatureException {
if (!verify(hash, signature))
throw new SignatureException();
}
@@ -863,26 +870,16 @@ public String signMessage(String message) throws KeyCrypterException {
* @throws KeyCrypterException if this ECKey is encrypted and no AESKey is provided or it does not decrypt the ECKey.
*/
public String signMessage(String message, @Nullable KeyParameter aesKey) throws KeyCrypterException {
- byte[] data = Utils.formatMessageForSigning(message);
+ byte[] data = formatMessageForSigning(message);
Sha256Hash hash = Sha256Hash.twiceOf(data);
ECDSASignature sig = sign(hash, aesKey);
- // Now we have to work backwards to figure out the recId needed to recover the signature.
- int recId = -1;
- for (int i = 0; i < 4; i++) {
- ECKey k = ECKey.recoverFromSignature(i, sig, hash, isCompressed());
- if (k != null && k.pub.equals(pub)) {
- recId = i;
- break;
- }
- }
- if (recId == -1)
- throw new RuntimeException("Could not construct a recoverable key. This should never happen.");
+ byte recId = findRecoveryId(hash, sig);
int headerByte = recId + 27 + (isCompressed() ? 4 : 0);
byte[] sigData = new byte[65]; // 1 header + 32 bytes for R + 32 bytes for S
sigData[0] = (byte)headerByte;
System.arraycopy(Utils.bigIntegerToBytes(sig.r, 32), 0, sigData, 1, 32);
System.arraycopy(Utils.bigIntegerToBytes(sig.s, 32), 0, sigData, 33, 32);
- return new String(Base64.encode(sigData), Charset.forName("UTF-8"));
+ return new String(Base64.encode(sigData), StandardCharsets.UTF_8);
}
/**
@@ -915,7 +912,7 @@ public static ECKey signedMessageToKey(String message, String signatureBase64) t
BigInteger r = new BigInteger(1, Arrays.copyOfRange(signatureEncoded, 1, 33));
BigInteger s = new BigInteger(1, Arrays.copyOfRange(signatureEncoded, 33, 65));
ECDSASignature sig = new ECDSASignature(r, s);
- byte[] messageBytes = Utils.formatMessageForSigning(message);
+ byte[] messageBytes = formatMessageForSigning(message);
// Note that the C++ code doesn't actually seem to specify any character encoding. Presumably it's whatever
// JSON-SPIRIT hands back. Assume UTF-8 for now.
Sha256Hash messageHash = Sha256Hash.twiceOf(messageBytes);
@@ -941,6 +938,26 @@ public void verifyMessage(String message, String signatureBase64) throws Signatu
throw new SignatureException("Signature did not match for message");
}
+ /**
+ * Returns the recovery ID, a byte with value between 0 and 3, inclusive, that specifies which of 4 possible
+ * curve points was used to sign a message. This value is also referred to as "v".
+ *
+ * @throws RuntimeException if no recovery ID can be found.
+ */
+ public byte findRecoveryId(Sha256Hash hash, ECDSASignature sig) {
+ byte recId = -1;
+ for (byte i = 0; i < 4; i++) {
+ ECKey k = ECKey.recoverFromSignature(i, sig, hash, isCompressed());
+ if (k != null && k.pub.equals(pub)) {
+ recId = i;
+ break;
+ }
+ }
+ if (recId == -1)
+ throw new RuntimeException("Could not construct a recoverable key. This should never happen.");
+ return recId;
+ }
+
/**
* Given the components of a signature and a selector value, recover and return the public key
* that generated the signature according to the algorithm in SEC1v2 section 4.1.6. Given a textual message, returns a byte buffer formatted as follows: {@code [24] "Bitcoin Signed Message:\n" [message.length as a varint] message}