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="" -``` +Building apps with official releases of **bitcoinj** is covered in the [tutorial](https://bitcoinj.github.io/getting-started). -Note that this example app *does not use checkpointing*, so the initial chain sync will be pretty slow. You can make an app that starts up and does the initial sync much faster by including a checkpoints file; see the documentation for -more info on this technique. +If you want to develop or test your app with a [Jitpack](https://jitpack.io)-powered build of the latest `master` or `release-0.15` branch of **bitcoinj** follow the dynamically-generated instructions for that branch by following the correct link. -### Where next? -Now you are ready to [follow the tutorial](https://bitcoinj.github.io/getting-started). +* [master](https://jitpack.io/#bitcoinj/bitcoinj/master-SNAPSHOT) branch +* [release-0.15](https://jitpack.io/#bitcoinj/bitcoinj/release-0.15-SNAPSHOT) branch \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000000..d6a86ac222d --- /dev/null +++ b/build.gradle @@ -0,0 +1,17 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10' + } +} + +allprojects { + repositories { + jcenter() + } + + group = 'org.bitcoinj' +} diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 00000000000..cf9a6428fd3 --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,62 @@ +apply plugin: 'java' +apply plugin: 'com.google.protobuf' +apply plugin: 'maven' +apply plugin: 'eclipse' + +version = '0.15.8.bisq.14' +archivesBaseName = 'bitcoinj-core' +eclipse.project.name = 'bitcoinj-core' + +dependencies { + compile 'org.bouncycastle:bcprov-jdk15to18:1.63' + implementation 'com.google.guava:guava:28.2-android' + compile 'com.google.protobuf:protobuf-java:3.6.1' + implementation 'com.squareup.okhttp3:okhttp:3.12.8' + implementation 'org.slf4j:slf4j-api:1.7.30' + implementation 'net.jcip:jcip-annotations:1.0' + compileOnly 'org.fusesource.leveldbjni:leveldbjni-all:1.8' + testImplementation 'junit:junit:4.13' + testImplementation 'org.easymock:easymock:3.2' + testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.5.2' + testImplementation 'org.slf4j:slf4j-jdk14:1.7.30' + testImplementation 'com.h2database:h2:1.3.167' + testImplementation 'org.fusesource.leveldbjni:leveldbjni-all:1.8' +} + +sourceCompatibility = 1.7 +compileJava.options.encoding = 'UTF-8' +compileTestJava.options.encoding = 'UTF-8' +javadoc.options.encoding = 'UTF-8' + +protobuf { + protoc { + artifact = 'com.google.protobuf:protoc:3.6.1' + } + generatedFilesBaseDir = new File(projectDir, '/src') // workaround for '$projectDir/src' +} + +test { + exclude 'org/bitcoinj/core/PeerTest*' + exclude 'org/bitcoinj/core/TransactionBroadcastTest*' + exclude 'org/bitcoinj/net/NetworkAbstractionTests*' + exclude 'org/bitcoinj/protocols/channels/ChannelConnectionTest*' + testLogging { + events "failed" + exceptionFormat "full" + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +artifacts { + archives sourcesJar + archives javadocJar +} diff --git a/core/pom.xml b/core/pom.xml deleted file mode 100644 index 6e4f536edd9..00000000000 --- a/core/pom.xml +++ /dev/null @@ -1,441 +0,0 @@ - - - - - 4.0.0 - - org.bitcoinj - bitcoinj-parent - 0.14-SNAPSHOT - - - bitcoinj-core - - bitcoinj - A Java Bitcoin library - - jar - - https://bitcoinj.github.io - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - - The bitcoinj team - bitcoinj@googlegroups.com - - - - - - update-protobuf - - - updateProtobuf - true - - - - - - maven-antrun-plugin - - - compile-protoc - generate-sources - - - - - - - - - - - - - - - - - run - - - - - - - - - no-network - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/core/PeerTest.java - **/core/TransactionBroadcastTest.java - - - - - - - - - - - - - maven-compiler-plugin - - 1.6 - 1.6 - - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - verify - - jar-no-fork - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - - http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/ - - - true - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce - verify - - enforce - - - - - - - - true - - - - - - cglib:cglib-nodep:2.2:jar:null:test:59afed7ab65e7ec6585d5bc60556c3cbd203532b - com.fasterxml.jackson.core:jackson-annotations:2.5.0:jar:null:test:a2a55a3375bc1cef830ca426d68d2ea22961190e - com.fasterxml.jackson.core:jackson-core:2.5.1:jar:null:test:e2a00ad1d7e540ec395e9296a34da484c8888d4d - com.fasterxml.jackson.core:jackson-databind:2.5.2:jar:null:test:2b4dd13fbe6f8c6b146d4c3b7fd70862f136802d - com.google.code.findbugs:jsr305:2.0.1:jar:null:compile:516c03b21d50a644d538de0f0369c620989cd8f0 - com.google.guava:guava:18.0:jar:null:compile:cce0823396aa693798f8882e64213b1772032b09 - com.google.protobuf:protobuf-java:2.6.1:jar:null:compile:d9521f2aecb909835746b7a5facf612af5e890e8 - com.h2database:h2:1.3.167:jar:null:compile:d3867d586f087e53eb12fc65e5693d8ee9a5da17 - com.lambdaworks:scrypt:1.4.0:jar:null:compile:906506b74f30c8c20bccd9ed4a11112d8941fe87 - com.madgag.spongycastle:core:1.51.0.0:jar:null:compile:0f642963312ea0e615ad65f28adc5a5b3a2a0862 - junit:junit:4.12:jar:null:test:2973d150c0dc1fefe998f834810d68f278ea58ec - mysql:mysql-connector-java:5.1.33:jar:null:compile:8af455a9a3267e6664cafc87ace71a4e4ef02837 - net.jcip:jcip-annotations:1.0:jar:null:compile:afba4942caaeaf46aab0b976afd57cc7c181467e - org.apache.maven.plugins:maven-clean-plugin:2.6.1:maven-plugin:null:runtime:bfdf7d6c2f8fc8759457e9d54f458ba56ac7b30f - org.apache.maven.plugins:maven-compiler-plugin:3.2:maven-plugin:null:runtime:aec10f274ac07fafab8906cb1aa69669d753b2c2 - org.apache.maven.plugins:maven-deploy-plugin:2.8.2:maven-plugin:null:runtime:3c2d83ecd387e9843142ae92a0439792c1500319 - org.apache.maven.plugins:maven-enforcer-plugin:1.0:maven-plugin:null:runtime:ad032b7593576e9fe9305c73865633e163895b29 - org.apache.maven.plugins:maven-install-plugin:2.5.2:maven-plugin:null:runtime:8a67631619fc3c1d1f036e59362ddce71e1e496f - org.apache.maven.plugins:maven-jar-plugin:2.6:maven-plugin:null:runtime:618f08d0fcdd3929af846ef1b65503b5904f93e3 - org.apache.maven.plugins:maven-javadoc-plugin:2.10.2:maven-plugin:null:runtime:5f391697fa85cecc7e5bac7ce5a6f9d056a58ba3 - org.apache.maven.plugins:maven-resources-plugin:2.7:maven-plugin:null:runtime:94af11389943a480ecec7db01b4ded1b9cdf57c5 - org.apache.maven.plugins:maven-shade-plugin:2.3:maven-plugin:null:runtime:d136adc7abccc9c12adcad6ae7a9bc51b2b7184b - org.apache.maven.plugins:maven-site-plugin:3.4:maven-plugin:null:runtime:659cd5f1dd8bff554cf52603339494cbf7f283c5 - org.apache.maven.plugins:maven-source-plugin:2.4:maven-plugin:null:runtime:46f0d7f7823d729ba300d3f8929900c7e9cb5ac0 - org.apache.maven.plugins:maven-surefire-plugin:2.19.1:maven-plugin:null:runtime:e2ee016ce9183ffa9e86c543690cadda7b3aea15 - org.easymock:easymock:3.2:jar:null:test:00c82f7fa3ef377d8954b1db25123944b5af2ba4 - org.eluder.coveralls:coveralls-maven-plugin:3.1.0:maven-plugin:null:runtime:ca9d2915e2b1e99f15c9f54ad653eda893d42a69 - org.fusesource.leveldbjni:leveldbjni-all:1.8:jar:null:compile:707350a2eeb1fa2ed77a32ddb3893ed308e941db - org.hamcrest:hamcrest-core:1.3:jar:null:test:42a25dc3219429f0e5d060061f71acb49bf010a0 - org.jacoco:jacoco-maven-plugin:0.7.5.201505241946:maven-plugin:null:runtime:0a5e4dbbcd9b00e5ee42d928e10ab84f6f0b0835 - org.objenesis:objenesis:1.2:jar:null:test:bfcb0539a071a4c5a30690388903ac48c0667f2a - com.squareup.okhttp:okhttp:2.7.2:jar:null:runtime:20f6463eb19ac61960c5d91a094c2f4f0727dc2e - com.squareup.okio:okio:1.6.0:jar:null:runtime:98476622f10715998eacf9240d6b479f12c66143 - org.slf4j:slf4j-api:1.7.20:jar:null:compile:867d63093eff0a0cb527bf13d397d850af3dcae3 - org.slf4j:slf4j-jdk14:1.7.20:jar:null:test:b568c92eec50edc922c52b3e759982579170c2be - org.sonatype.plugins:nexus-staging-maven-plugin:1.6.5:maven-plugin:null:runtime:455ca2aa8cd14a06608f1538bd6a1efd09561563 - postgresql:postgresql:9.1-901.jdbc4:jar:null:compile:153f2f92a786f12fc111d0111f709012df87c808 - - uk.co.froot.maven.enforcer:digest-enforcer-rules:0.0.1:jar:null:runtime:16a9e04f3fe4bb143c42782d07d5faf65b32106f - - - - - - - - - - - uk.co.froot.maven.enforcer - digest-enforcer-rules - 0.0.1 - - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - - package - - shade - - - false - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - true - bundled - - - - - - - - org.jacoco - jacoco-maven-plugin - 0.7.5.201505241946 - - - **/Protos*.class - org/bitcoinj/jni/* - org/bitcoin/* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - surefireArgLine - - - - post-unit-test - test - - report - - - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.reporting.outputDirectory}/jacoco - - - - default-report - prepare-package - - report - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - -Xmx1024m ${surefireArgLine} - alphabetical - - - java.util.logging.config.file - src/test/resources/logging.properties - - - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 3.1.0 - - - - - - - junit - junit - 4.12 - test - - - org.easymock - easymock - 3.2 - test - - - - org.slf4j - slf4j-jdk14 - 1.7.20 - test - - - com.fasterxml.jackson.core - jackson-databind - 2.5.2 - test - - - com.h2database - h2 - 1.3.167 - true - - - com.madgag.spongycastle - core - 1.51.0.0 - - - com.google.protobuf - protobuf-java - 2.6.1 - - - com.google.guava - guava - 18.0 - - - com.google.code.findbugs - jsr305 - 2.0.1 - - - net.jcip - jcip-annotations - 1.0 - - - com.lambdaworks - scrypt - 1.4.0 - - - - - postgresql - postgresql - 9.1-901.jdbc4 - true - - - - - mysql - mysql-connector-java - 5.1.33 - true - - - org.fusesource.leveldbjni - leveldbjni-all - 1.8 - true - - - org.bitcoinj - orchid - 1.2 - - - com.squareup.okhttp - okhttp - 2.7.2 - - - - diff --git a/core/src/main/java/org/bitcoin/NativeSecp256k1.java b/core/src/main/java/org/bitcoin/NativeSecp256k1.java index 40ae76d7ce0..2b271bd9c26 100644 --- a/core/src/main/java/org/bitcoin/NativeSecp256k1.java +++ b/core/src/main/java/org/bitcoin/NativeSecp256k1.java @@ -42,7 +42,7 @@ public class NativeSecp256k1 { private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); private static final Lock r = rwl.readLock(); private static final Lock w = rwl.writeLock(); - private static ThreadLocal nativeECDSABuffer = new ThreadLocal(); + private static ThreadLocal nativeECDSABuffer = new ThreadLocal<>(); /** * Verifies the given secp256k1 signature in native code. Calling when enabled == false is undefined (probably @@ -78,7 +78,7 @@ public static boolean verify(byte[] data, byte[] signature, byte[] pub) throws A * libsecp256k1 Create an ECDSA signature. * * @param data Message hash, 32 bytes - * @param key Secret key, 32 bytes + * @param sec Secret key, 32 bytes * @return sig byte array of signature */ public static byte[] sign(byte[] data, byte[] sec) throws AssertFailException { @@ -200,7 +200,7 @@ public static long cloneContext() { * libsecp256k1 PrivKey Tweak-Mul - Tweak privkey by multiplying to it * * @param tweak some bytes to tweak with - * @param seckey 32-byte seckey + * @param privkey 32-byte seckey */ public static byte[] privKeyTweakMul(byte[] privkey, byte[] tweak) throws AssertFailException { Preconditions.checkArgument(privkey.length == 32); @@ -239,7 +239,7 @@ public static byte[] privKeyTweakMul(byte[] privkey, byte[] tweak) throws Assert * libsecp256k1 PrivKey Tweak-Add - Tweak privkey by adding to it * * @param tweak some bytes to tweak with - * @param seckey 32-byte seckey + * @param privkey 32-byte seckey */ public static byte[] privKeyTweakAdd(byte[] privkey, byte[] tweak) throws AssertFailException { Preconditions.checkArgument(privkey.length == 32); diff --git a/core/src/main/java/org/bitcoin/Secp256k1Context.java b/core/src/main/java/org/bitcoin/Secp256k1Context.java index c1d6484e4da..f545f7c64bd 100644 --- a/core/src/main/java/org/bitcoin/Secp256k1Context.java +++ b/core/src/main/java/org/bitcoin/Secp256k1Context.java @@ -19,6 +19,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.security.AccessControlException; + /** * This class holds the context reference used in native methods to handle ECDSA operations. */ @@ -35,8 +37,8 @@ public class Secp256k1Context { try { System.loadLibrary("secp256k1"); contextRef = secp256k1_init_context(); - } catch (UnsatisfiedLinkError e) { - log.info(e.toString()); + } catch (UnsatisfiedLinkError | AccessControlException e) { + log.debug(e.toString()); isEnabled = false; } enabled = isEnabled; diff --git a/core/src/main/java/org/bitcoin/crawler/PeerSeedProtos.java b/core/src/main/java/org/bitcoin/crawler/PeerSeedProtos.java index cb38034fbfc..8788a2a4818 100644 --- a/core/src/main/java/org/bitcoin/crawler/PeerSeedProtos.java +++ b/core/src/main/java/org/bitcoin/crawler/PeerSeedProtos.java @@ -5,8 +5,14 @@ public final class PeerSeedProtos { private PeerSeedProtos() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); } public interface PeerSeedDataOrBuilder extends // @@protoc_insertion_point(interface_extends:org.bitcoin.crawler.PeerSeedData) @@ -47,37 +53,34 @@ public interface PeerSeedDataOrBuilder extends /** * Protobuf type {@code org.bitcoin.crawler.PeerSeedData} */ - public static final class PeerSeedData extends - com.google.protobuf.GeneratedMessage implements + public static final class PeerSeedData extends + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:org.bitcoin.crawler.PeerSeedData) PeerSeedDataOrBuilder { + private static final long serialVersionUID = 0L; // Use PeerSeedData.newBuilder() to construct. - private PeerSeedData(com.google.protobuf.GeneratedMessage.Builder builder) { + private PeerSeedData(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); - this.unknownFields = builder.getUnknownFields(); } - private PeerSeedData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final PeerSeedData defaultInstance; - public static PeerSeedData getDefaultInstance() { - return defaultInstance; - } - - public PeerSeedData getDefaultInstanceForType() { - return defaultInstance; + private PeerSeedData() { + ipAddress_ = ""; + port_ = 0; + services_ = 0; } - private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { + getUnknownFields() { return this.unknownFields; } private PeerSeedData( 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(); @@ -89,13 +92,6 @@ private PeerSeedData( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; @@ -112,13 +108,20 @@ private PeerSeedData( services_ = input.readUInt32(); 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,31 +132,17 @@ private PeerSeedData( return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeedData_descriptor; } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeedData_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.class, org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public PeerSeedData parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PeerSeedData(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int IP_ADDRESS_FIELD_NUMBER = 1; - private java.lang.Object ipAddress_; + private volatile java.lang.Object ipAddress_; /** * 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:org.bitcoin.crawler.PeerSeedData) org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -374,7 +429,8 @@ public static final class Builder extends return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeedData_descriptor; } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeedData_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -387,18 +443,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); ipAddress_ = ""; @@ -410,19 +464,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeedData_descriptor; } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData getDefaultInstanceForType() { return org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData build() { org.bitcoin.crawler.PeerSeedProtos.PeerSeedData result = buildPartial(); if (!result.isInitialized()) { @@ -431,6 +484,7 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData build() { return result; } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData buildPartial() { org.bitcoin.crawler.PeerSeedProtos.PeerSeedData result = new org.bitcoin.crawler.PeerSeedProtos.PeerSeedData(this); int from_bitField0_ = bitField0_; @@ -452,6 +506,39 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.crawler.PeerSeedProtos.PeerSeedData) { return mergeFrom((org.bitcoin.crawler.PeerSeedProtos.PeerSeedData)other); @@ -474,26 +561,26 @@ public Builder mergeFrom(org.bitcoin.crawler.PeerSeedProtos.PeerSeedData other) if (other.hasServices()) { setServices(other.getServices()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasIpAddress()) { - return false; } if (!hasPort()) { - return false; } if (!hasServices()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -503,7 +590,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.crawler.PeerSeedProtos.PeerSeedData) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -652,16 +739,57 @@ public Builder clearServices() { 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.PeerSeedData) } + // @@protoc_insertion_point(class_scope:org.bitcoin.crawler.PeerSeedData) + private static final org.bitcoin.crawler.PeerSeedProtos.PeerSeedData DEFAULT_INSTANCE; static { - defaultInstance = new PeerSeedData(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.crawler.PeerSeedProtos.PeerSeedData(); + } + + public static org.bitcoin.crawler.PeerSeedProtos.PeerSeedData getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PeerSeedData parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PeerSeedData(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:org.bitcoin.crawler.PeerSeedData) } public interface PeerSeedsOrBuilder extends @@ -693,19 +821,19 @@ org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder getSeedOrBuilder( int index); /** - * required 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.ArrayList(); mutable_bitField0_ |= 0x00000001; } - seed_.add(input.readMessage(org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.PARSER, extensionRegistry)); + seed_.add( + input.readMessage(org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.PARSER, extensionRegistry)); break; } case 16: { @@ -794,13 +913,20 @@ private PeerSeeds( net_ = bs; 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 { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { seed_ = java.util.Collections.unmodifiableList(seed_); @@ -814,28 +940,14 @@ private PeerSeeds( return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeeds_descriptor; } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeeds_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.crawler.PeerSeedProtos.PeerSeeds.class, org.bitcoin.crawler.PeerSeedProtos.PeerSeeds.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public PeerSeeds parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PeerSeeds(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int SEED_FIELD_NUMBER = 1; private java.util.List seed_; @@ -875,28 +987,28 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder getSeedOrBuilder public static final int TIMESTAMP_FIELD_NUMBER = 2; private long timestamp_; /** - * required 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:org.bitcoin.crawler.PeerSeeds) org.bitcoin.crawler.PeerSeedProtos.PeerSeedsOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -1089,7 +1265,8 @@ public static final class Builder extends return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeeds_descriptor; } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeeds_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -1102,19 +1279,17 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { getSeedFieldBuilder(); } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); if (seedBuilder_ == null) { @@ -1130,19 +1305,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_PeerSeeds_descriptor; } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.PeerSeeds getDefaultInstanceForType() { return org.bitcoin.crawler.PeerSeedProtos.PeerSeeds.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.PeerSeeds build() { org.bitcoin.crawler.PeerSeedProtos.PeerSeeds result = buildPartial(); if (!result.isInitialized()) { @@ -1151,6 +1325,7 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeeds build() { return result; } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.PeerSeeds buildPartial() { org.bitcoin.crawler.PeerSeedProtos.PeerSeeds result = new org.bitcoin.crawler.PeerSeedProtos.PeerSeeds(this); int from_bitField0_ = bitField0_; @@ -1177,6 +1352,39 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeeds buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.crawler.PeerSeedProtos.PeerSeeds) { return mergeFrom((org.bitcoin.crawler.PeerSeedProtos.PeerSeeds)other); @@ -1207,7 +1415,7 @@ public Builder mergeFrom(org.bitcoin.crawler.PeerSeedProtos.PeerSeeds other) { seed_ = other.seed_; bitField0_ = (bitField0_ & ~0x00000001); seedBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getSeedFieldBuilder() : null; } else { seedBuilder_.addAllMessages(other.seed_); @@ -1222,28 +1430,28 @@ public Builder mergeFrom(org.bitcoin.crawler.PeerSeedProtos.PeerSeeds other) { net_ = other.net_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasTimestamp()) { - return false; } if (!hasNet()) { - return false; } for (int i = 0; i < getSeedCount(); i++) { if (!getSeed(i).isInitialized()) { - return false; } } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -1253,7 +1461,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.crawler.PeerSeedProtos.PeerSeeds) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -1272,7 +1480,7 @@ private void ensureSeedIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilder< + private com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.crawler.PeerSeedProtos.PeerSeedData, org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.Builder, org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder> seedBuilder_; /** @@ -1488,11 +1696,11 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.Builder addSeedBuilder( getSeedBuilderList() { return getSeedFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilder< + private com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.crawler.PeerSeedProtos.PeerSeedData, org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.Builder, org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder> getSeedFieldBuilder() { if (seedBuilder_ == null) { - seedBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + seedBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.crawler.PeerSeedProtos.PeerSeedData, org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.Builder, org.bitcoin.crawler.PeerSeedProtos.PeerSeedDataOrBuilder>( seed_, ((bitField0_ & 0x00000001) == 0x00000001), @@ -1505,31 +1713,31 @@ public org.bitcoin.crawler.PeerSeedProtos.PeerSeedData.Builder addSeedBuilder( private long timestamp_ ; /** - * required 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PeerSeeds parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PeerSeeds(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.crawler.PeerSeedProtos.PeerSeeds getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:org.bitcoin.crawler.PeerSeeds) } public interface SignedPeerSeedsOrBuilder extends @@ -1672,37 +1921,34 @@ public interface SignedPeerSeedsOrBuilder extends /** * Protobuf type {@code org.bitcoin.crawler.SignedPeerSeeds} */ - public static final class SignedPeerSeeds extends - com.google.protobuf.GeneratedMessage implements + public static final class SignedPeerSeeds extends + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:org.bitcoin.crawler.SignedPeerSeeds) SignedPeerSeedsOrBuilder { + private static final long serialVersionUID = 0L; // Use SignedPeerSeeds.newBuilder() to construct. - private SignedPeerSeeds(com.google.protobuf.GeneratedMessage.Builder builder) { + private SignedPeerSeeds(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private SignedPeerSeeds(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final SignedPeerSeeds defaultInstance; - public static SignedPeerSeeds getDefaultInstance() { - return defaultInstance; } - - public SignedPeerSeeds getDefaultInstanceForType() { - return defaultInstance; + private SignedPeerSeeds() { + peerSeeds_ = com.google.protobuf.ByteString.EMPTY; + signature_ = com.google.protobuf.ByteString.EMPTY; + pubkey_ = 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 SignedPeerSeeds( 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(); @@ -1714,13 +1960,6 @@ private SignedPeerSeeds( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 10: { bitField0_ |= 0x00000001; peerSeeds_ = input.readBytes(); @@ -1736,13 +1975,20 @@ private SignedPeerSeeds( pubkey_ = 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(); @@ -1753,28 +1999,14 @@ private SignedPeerSeeds( return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_SignedPeerSeeds_descriptor; } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_SignedPeerSeeds_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds.class, org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public SignedPeerSeeds parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SignedPeerSeeds(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int PEER_SEEDS_FIELD_NUMBER = 1; private com.google.protobuf.ByteString peerSeeds_; @@ -1821,12 +2053,8 @@ public com.google.protobuf.ByteString getPubkey() { return pubkey_; } - private void initFields() { - peerSeeds_ = com.google.protobuf.ByteString.EMPTY; - signature_ = com.google.protobuf.ByteString.EMPTY; - pubkey_ = com.google.protobuf.ByteString.EMPTY; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -1848,9 +2076,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, peerSeeds_); } @@ -1860,12 +2088,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, pubkey_); } - 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; @@ -1881,18 +2109,76 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, pubkey_); } - 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.SignedPeerSeeds)) { + return super.equals(obj); + } + org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds other = (org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds) obj; + + boolean result = true; + result = result && (hasPeerSeeds() == other.hasPeerSeeds()); + if (hasPeerSeeds()) { + result = result && getPeerSeeds() + .equals(other.getPeerSeeds()); + } + result = result && (hasSignature() == other.hasSignature()); + if (hasSignature()) { + result = result && getSignature() + .equals(other.getSignature()); + } + result = result && (hasPubkey() == other.hasPubkey()); + if (hasPubkey()) { + result = result && getPubkey() + .equals(other.getPubkey()); + } + 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 (hasPeerSeeds()) { + hash = (37 * hash) + PEER_SEEDS_FIELD_NUMBER; + hash = (53 * hash) + getPeerSeeds().hashCode(); + } + if (hasSignature()) { + hash = (37 * hash) + SIGNATURE_FIELD_NUMBER; + hash = (53 * hash) + getSignature().hashCode(); + } + if (hasPubkey()) { + hash = (37 * hash) + PUBKEY_FIELD_NUMBER; + hash = (53 * hash) + getPubkey().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } + public static org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds 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.SignedPeerSeeds parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -1916,46 +2202,59 @@ public static org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds parseFrom( } public static org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds 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.SignedPeerSeeds 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.SignedPeerSeeds 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.SignedPeerSeeds 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.SignedPeerSeeds 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.SignedPeerSeeds 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.SignedPeerSeeds 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; } @@ -1963,7 +2262,7 @@ protected Builder newBuilderForType( * Protobuf type {@code org.bitcoin.crawler.SignedPeerSeeds} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:org.bitcoin.crawler.SignedPeerSeeds) org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeedsOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -1971,7 +2270,8 @@ public static final class Builder extends return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_SignedPeerSeeds_descriptor; } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_SignedPeerSeeds_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -1984,18 +2284,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); peerSeeds_ = com.google.protobuf.ByteString.EMPTY; @@ -2007,19 +2305,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.crawler.PeerSeedProtos.internal_static_org_bitcoin_crawler_SignedPeerSeeds_descriptor; } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds getDefaultInstanceForType() { return org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds build() { org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds result = buildPartial(); if (!result.isInitialized()) { @@ -2028,6 +2325,7 @@ public org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds build() { return result; } + @java.lang.Override public org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds buildPartial() { org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds result = new org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds(this); int from_bitField0_ = bitField0_; @@ -2049,6 +2347,39 @@ public org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds) { return mergeFrom((org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds)other); @@ -2069,26 +2400,26 @@ public Builder mergeFrom(org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds othe if (other.hasPubkey()) { setPubkey(other.getPubkey()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasPeerSeeds()) { - return false; } if (!hasSignature()) { - return false; } if (!hasPubkey()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -2098,7 +2429,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -2212,39 +2543,80 @@ public Builder clearPubkey() { 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.SignedPeerSeeds) } + // @@protoc_insertion_point(class_scope:org.bitcoin.crawler.SignedPeerSeeds) + private static final org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds DEFAULT_INSTANCE; static { - defaultInstance = new SignedPeerSeeds(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds(); + } + + public static org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SignedPeerSeeds parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SignedPeerSeeds(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.crawler.PeerSeedProtos.SignedPeerSeeds getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:org.bitcoin.crawler.SignedPeerSeeds) } private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_bitcoin_crawler_PeerSeedData_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_bitcoin_crawler_PeerSeedData_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_bitcoin_crawler_PeerSeeds_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_bitcoin_crawler_PeerSeeds_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_bitcoin_crawler_SignedPeerSeeds_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_bitcoin_crawler_SignedPeerSeeds_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } - private static com.google.protobuf.Descriptors.FileDescriptor + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { @@ -2272,19 +2644,19 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_org_bitcoin_crawler_PeerSeedData_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_org_bitcoin_crawler_PeerSeedData_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_bitcoin_crawler_PeerSeedData_descriptor, new java.lang.String[] { "IpAddress", "Port", "Services", }); internal_static_org_bitcoin_crawler_PeerSeeds_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_org_bitcoin_crawler_PeerSeeds_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_bitcoin_crawler_PeerSeeds_descriptor, new java.lang.String[] { "Seed", "Timestamp", "Net", }); internal_static_org_bitcoin_crawler_SignedPeerSeeds_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_org_bitcoin_crawler_SignedPeerSeeds_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_bitcoin_crawler_SignedPeerSeeds_descriptor, new java.lang.String[] { "PeerSeeds", "Signature", "Pubkey", }); } diff --git a/core/src/main/java/org/bitcoin/paymentchannel/Protos.java b/core/src/main/java/org/bitcoin/paymentchannel/Protos.java index 22dfa808c69..cd79f9c2ba4 100644 --- a/core/src/main/java/org/bitcoin/paymentchannel/Protos.java +++ b/core/src/main/java/org/bitcoin/paymentchannel/Protos.java @@ -5,56 +5,62 @@ public final class Protos { private Protos() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); } public interface TwoWayChannelMessageOrBuilder extends // @@protoc_insertion_point(interface_extends:paymentchannels.TwoWayChannelMessage) com.google.protobuf.MessageOrBuilder { /** - * 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; */ 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public TwoWayChannelMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new TwoWayChannelMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - /** * Protobuf enum {@code paymentchannels.TwoWayChannelMessage.MessageType} */ @@ -421,30 +409,28 @@ public enum MessageType /** * CLIENT_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.EnumLiteMap - internalValueMap = + private static final com.google.protobuf.Internal.EnumLiteMap< + MessageType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { public MessageType findValueByNumber(int number) { - return MessageType.valueOf(number); + return MessageType.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - return getDescriptor().getValues().get(index); + return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { @@ -633,11 +631,9 @@ public static MessageType valueOf( return VALUES[desc.getIndex()]; } - private final int index; private final int value; - private MessageType(int index, int value) { - this.index = index; + private MessageType(int value) { this.value = value; } @@ -646,63 +642,65 @@ private MessageType(int index, int value) { private int bitField0_; public static final int TYPE_FIELD_NUMBER = 1; - private org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType type_; + private int type_; /** - * 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 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.TwoWayChannelMessage) org.bitcoin.paymentchannel.Protos.TwoWayChannelMessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -1154,7 +1282,8 @@ public static final class Builder extends 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( @@ -1167,12 +1296,13 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { getClientVersionFieldBuilder(); getServerVersionFieldBuilder(); getInitiateFieldBuilder(); @@ -1185,70 +1315,67 @@ private void maybeForceBuilderInitialization() { getErrorFieldBuilder(); } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); - type_ = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.CLIENT_VERSION; + type_ = 1; bitField0_ = (bitField0_ & ~0x00000001); if (clientVersionBuilder_ == null) { - clientVersion_ = org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance(); + clientVersion_ = null; } else { clientVersionBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); if (serverVersionBuilder_ == null) { - serverVersion_ = org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance(); + serverVersion_ = null; } else { serverVersionBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); if (initiateBuilder_ == null) { - initiate_ = org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance(); + initiate_ = null; } else { initiateBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); if (provideRefundBuilder_ == null) { - provideRefund_ = org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance(); + provideRefund_ = null; } else { provideRefundBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000010); if (returnRefundBuilder_ == null) { - returnRefund_ = org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance(); + returnRefund_ = null; } else { returnRefundBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000020); if (provideContractBuilder_ == null) { - provideContract_ = org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance(); + provideContract_ = null; } else { provideContractBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000040); if (updatePaymentBuilder_ == null) { - updatePayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance(); + updatePayment_ = null; } else { updatePaymentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000080); if (paymentAckBuilder_ == null) { - paymentAck_ = org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance(); + paymentAck_ = null; } else { paymentAckBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000100); if (settlementBuilder_ == null) { - settlement_ = org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance(); + settlement_ = null; } else { settlementBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000200); if (errorBuilder_ == null) { - error_ = org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance(); + error_ = null; } else { errorBuilder_.clear(); } @@ -1256,19 +1383,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_TwoWayChannelMessage_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage build() { org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage result = buildPartial(); if (!result.isInitialized()) { @@ -1277,6 +1403,7 @@ public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage buildPartial() { org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage result = new org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage(this); int from_bitField0_ = bitField0_; @@ -1370,6 +1497,39 @@ public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage) { return mergeFrom((org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage)other); @@ -1414,66 +1574,60 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage if (other.hasError()) { mergeError(other.getError()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasType()) { - return false; } if (hasClientVersion()) { if (!getClientVersion().isInitialized()) { - return false; } } if (hasServerVersion()) { if (!getServerVersion().isInitialized()) { - return false; } } if (hasInitiate()) { if (!getInitiate().isInitialized()) { - return false; } } if (hasProvideRefund()) { if (!getProvideRefund().isInitialized()) { - return false; } } if (hasReturnRefund()) { if (!getReturnRefund().isInitialized()) { - return false; } } if (hasProvideContract()) { if (!getProvideContract().isInitialized()) { - return false; } } if (hasUpdatePayment()) { if (!getUpdatePayment().isInitialized()) { - return false; } } if (hasSettlement()) { if (!getSettlement().isInitialized()) { - return false; } } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -1483,7 +1637,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -1493,98 +1647,100 @@ public Builder mergeFrom( } private int bitField0_; - private org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType type_ = org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType.CLIENT_VERSION; + private int type_ = 1; /** - * 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 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TwoWayChannelMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TwoWayChannelMessage(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.TwoWayChannelMessage) } public interface ClientVersionOrBuilder extends @@ -2782,86 +2999,84 @@ public interface ClientVersionOrBuilder extends int getMinor(); /** - * 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; */ 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public ClientVersion parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ClientVersion(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int MAJOR_FIELD_NUMBER = 1; private int major_; @@ -2973,27 +3174,27 @@ public int getMinor() { public static final int PREVIOUS_CHANNEL_CONTRACT_HASH_FIELD_NUMBER = 3; private com.google.protobuf.ByteString 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 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.ClientVersion) org.bitcoin.paymentchannel.Protos.ClientVersionOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -3179,7 +3456,8 @@ public static final class Builder extends 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( @@ -3192,18 +3470,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); major_ = 0; @@ -3217,19 +3493,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ClientVersion_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ClientVersion getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.ClientVersion.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ClientVersion build() { org.bitcoin.paymentchannel.Protos.ClientVersion result = buildPartial(); if (!result.isInitialized()) { @@ -3238,6 +3513,7 @@ public org.bitcoin.paymentchannel.Protos.ClientVersion build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ClientVersion buildPartial() { org.bitcoin.paymentchannel.Protos.ClientVersion result = new org.bitcoin.paymentchannel.Protos.ClientVersion(this); int from_bitField0_ = bitField0_; @@ -3263,6 +3539,39 @@ public org.bitcoin.paymentchannel.Protos.ClientVersion buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.ClientVersion) { return mergeFrom((org.bitcoin.paymentchannel.Protos.ClientVersion)other); @@ -3286,18 +3595,20 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.ClientVersion other) if (other.hasTimeWindowSecs()) { setTimeWindowSecs(other.getTimeWindowSecs()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasMajor()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -3307,7 +3618,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.ClientVersion) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -3383,40 +3694,40 @@ public Builder clearMinor() { private com.google.protobuf.ByteString previousChannelContractHash_ = com.google.protobuf.ByteString.EMPTY; /** - * 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 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 + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClientVersion parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClientVersion(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.ClientVersion getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.ClientVersion) } public interface ServerVersionOrBuilder extends @@ -3530,8 +3882,6 @@ public interface ServerVersionOrBuilder extends int getMinor(); } /** - * Protobuf type {@code paymentchannels.ServerVersion} - * *
    * 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 PARSER = - new com.google.protobuf.AbstractParser() { - public ServerVersion parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ServerVersion(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int MAJOR_FIELD_NUMBER = 1; private int major_; @@ -3671,11 +4005,8 @@ public int getMinor() { return minor_; } - private void initFields() { - major_ = 0; - minor_ = 0; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -3689,21 +4020,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.writeInt32(1, major_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, minor_); } - 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; @@ -3715,30 +4046,79 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, minor_); } - 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.ServerVersion)) { + return super.equals(obj); + } + org.bitcoin.paymentchannel.Protos.ServerVersion other = (org.bitcoin.paymentchannel.Protos.ServerVersion) 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 && 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(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } public static org.bitcoin.paymentchannel.Protos.ServerVersion parseFrom( - com.google.protobuf.ByteString data) + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.bitcoin.paymentchannel.Protos.ServerVersion parseFrom( - com.google.protobuf.ByteString data, + 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.ServerVersion parseFrom(byte[] data) + public static org.bitcoin.paymentchannel.Protos.ServerVersion parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.paymentchannel.Protos.ServerVersion parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.bitcoin.paymentchannel.Protos.ServerVersion parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } @@ -3750,52 +4130,63 @@ public static org.bitcoin.paymentchannel.Protos.ServerVersion parseFrom( } public static org.bitcoin.paymentchannel.Protos.ServerVersion 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.ServerVersion 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.ServerVersion 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.ServerVersion 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.ServerVersion 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.ServerVersion 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.ServerVersion 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.ServerVersion} - * *
      * 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.ServerVersion) org.bitcoin.paymentchannel.Protos.ServerVersionOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -3815,7 +4208,8 @@ public static final class Builder extends 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( @@ -3828,18 +4222,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); major_ = 0; @@ -3849,19 +4241,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ServerVersion_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ServerVersion getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.ServerVersion.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ServerVersion build() { org.bitcoin.paymentchannel.Protos.ServerVersion result = buildPartial(); if (!result.isInitialized()) { @@ -3870,6 +4261,7 @@ public org.bitcoin.paymentchannel.Protos.ServerVersion build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ServerVersion buildPartial() { org.bitcoin.paymentchannel.Protos.ServerVersion result = new org.bitcoin.paymentchannel.Protos.ServerVersion(this); int from_bitField0_ = bitField0_; @@ -3887,6 +4279,39 @@ public org.bitcoin.paymentchannel.Protos.ServerVersion buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.ServerVersion) { return mergeFrom((org.bitcoin.paymentchannel.Protos.ServerVersion)other); @@ -3904,18 +4329,20 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.ServerVersion other) if (other.hasMinor()) { setMinor(other.getMinor()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasMajor()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -3925,7 +4352,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.ServerVersion) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -3998,16 +4425,57 @@ public Builder clearMinor() { 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.ServerVersion) } + // @@protoc_insertion_point(class_scope:paymentchannels.ServerVersion) + private static final org.bitcoin.paymentchannel.Protos.ServerVersion DEFAULT_INSTANCE; static { - defaultInstance = new ServerVersion(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.ServerVersion(); + } + + public static org.bitcoin.paymentchannel.Protos.ServerVersion getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ServerVersion parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ServerVersion(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.ServerVersion getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.ServerVersion) } public interface InitiateOrBuilder extends @@ -4015,52 +4483,50 @@ public interface InitiateOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * 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; */ 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Initiate parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Initiate(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int MULTISIG_KEY_FIELD_NUMBER = 1; private com.google.protobuf.ByteString 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 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.Initiate) org.bitcoin.paymentchannel.Protos.InitiateOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -4520,7 +5050,8 @@ public static final class Builder extends 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( @@ -4533,18 +5064,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); multisigKey_ = com.google.protobuf.ByteString.EMPTY; @@ -4558,19 +5087,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Initiate_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Initiate getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.Initiate.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Initiate build() { org.bitcoin.paymentchannel.Protos.Initiate result = buildPartial(); if (!result.isInitialized()) { @@ -4579,6 +5107,7 @@ public org.bitcoin.paymentchannel.Protos.Initiate build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Initiate buildPartial() { org.bitcoin.paymentchannel.Protos.Initiate result = new org.bitcoin.paymentchannel.Protos.Initiate(this); int from_bitField0_ = bitField0_; @@ -4604,6 +5133,39 @@ public org.bitcoin.paymentchannel.Protos.Initiate buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.Initiate) { return mergeFrom((org.bitcoin.paymentchannel.Protos.Initiate)other); @@ -4627,30 +5189,29 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.Initiate other) { if (other.hasMinPayment()) { setMinPayment(other.getMinPayment()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasMultisigKey()) { - return false; } if (!hasMinAcceptedChannelSize()) { - return false; } if (!hasExpireTimeSecs()) { - return false; } if (!hasMinPayment()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -4660,7 +5221,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.Initiate) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -4672,37 +5233,37 @@ public Builder mergeFrom( private com.google.protobuf.ByteString multisigKey_ = com.google.protobuf.ByteString.EMPTY; /** - * 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 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Initiate parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Initiate(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.Initiate getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.Initiate) } public interface ProvideRefundOrBuilder extends @@ -4945,27 +5547,25 @@ public interface ProvideRefundOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * 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; */ 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public ProvideRefund parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ProvideRefund(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int MULTISIG_KEY_FIELD_NUMBER = 1; private com.google.protobuf.ByteString 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 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.ProvideRefund) org.bitcoin.paymentchannel.Protos.ProvideRefundOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -5304,7 +5947,8 @@ public static final class Builder extends 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( @@ -5317,18 +5961,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); multisigKey_ = com.google.protobuf.ByteString.EMPTY; @@ -5338,19 +5980,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ProvideRefund_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ProvideRefund getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.ProvideRefund.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ProvideRefund build() { org.bitcoin.paymentchannel.Protos.ProvideRefund result = buildPartial(); if (!result.isInitialized()) { @@ -5359,6 +6000,7 @@ public org.bitcoin.paymentchannel.Protos.ProvideRefund build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ProvideRefund buildPartial() { org.bitcoin.paymentchannel.Protos.ProvideRefund result = new org.bitcoin.paymentchannel.Protos.ProvideRefund(this); int from_bitField0_ = bitField0_; @@ -5376,6 +6018,39 @@ public org.bitcoin.paymentchannel.Protos.ProvideRefund buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.ProvideRefund) { return mergeFrom((org.bitcoin.paymentchannel.Protos.ProvideRefund)other); @@ -5393,22 +6068,23 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.ProvideRefund other) if (other.hasTx()) { setTx(other.getTx()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasMultisigKey()) { - return false; } if (!hasTx()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -5418,7 +6094,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.ProvideRefund) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -5430,34 +6106,34 @@ public Builder mergeFrom( private com.google.protobuf.ByteString multisigKey_ = com.google.protobuf.ByteString.EMPTY; /** - * 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 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 + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProvideRefund parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProvideRefund(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.ProvideRefund getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.ProvideRefund) } public interface ReturnRefundOrBuilder extends @@ -5587,8 +6304,6 @@ public interface ReturnRefundOrBuilder extends com.google.protobuf.ByteString getSignature(); } /** - * Protobuf type {@code paymentchannels.ReturnRefund} - * *
    * 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 PARSER = - new com.google.protobuf.AbstractParser() { - public ReturnRefund parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ReturnRefund(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int SIGNATURE_FIELD_NUMBER = 1; private com.google.protobuf.ByteString signature_; @@ -5706,10 +6404,8 @@ public com.google.protobuf.ByteString getSignature() { return signature_; } - private void initFields() { - signature_ = com.google.protobuf.ByteString.EMPTY; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -5723,18 +6419,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, signature_); } - 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; @@ -5742,30 +6438,70 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, signature_); } - 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.ReturnRefund)) { + return super.equals(obj); + } + org.bitcoin.paymentchannel.Protos.ReturnRefund other = (org.bitcoin.paymentchannel.Protos.ReturnRefund) obj; + + boolean result = true; + result = result && (hasSignature() == other.hasSignature()); + if (hasSignature()) { + result = result && getSignature() + .equals(other.getSignature()); + } + 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 (hasSignature()) { + hash = (37 * hash) + SIGNATURE_FIELD_NUMBER; + hash = (53 * hash) + getSignature().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } public static org.bitcoin.paymentchannel.Protos.ReturnRefund parseFrom( - com.google.protobuf.ByteString data) + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.bitcoin.paymentchannel.Protos.ReturnRefund parseFrom( - com.google.protobuf.ByteString data, + 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.ReturnRefund parseFrom(byte[] data) + public static org.bitcoin.paymentchannel.Protos.ReturnRefund parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.paymentchannel.Protos.ReturnRefund parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.bitcoin.paymentchannel.Protos.ReturnRefund parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } @@ -5777,52 +6513,63 @@ public static org.bitcoin.paymentchannel.Protos.ReturnRefund parseFrom( } public static org.bitcoin.paymentchannel.Protos.ReturnRefund 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.ReturnRefund 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.ReturnRefund 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.ReturnRefund 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.ReturnRefund 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.ReturnRefund 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.ReturnRefund 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.ReturnRefund} - * *
      * 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.ReturnRefund) org.bitcoin.paymentchannel.Protos.ReturnRefundOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -5840,7 +6589,8 @@ public static final class Builder extends 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( @@ -5853,18 +6603,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); signature_ = com.google.protobuf.ByteString.EMPTY; @@ -5872,19 +6620,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ReturnRefund_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ReturnRefund getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.ReturnRefund.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ReturnRefund build() { org.bitcoin.paymentchannel.Protos.ReturnRefund result = buildPartial(); if (!result.isInitialized()) { @@ -5893,6 +6640,7 @@ public org.bitcoin.paymentchannel.Protos.ReturnRefund build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ReturnRefund buildPartial() { org.bitcoin.paymentchannel.Protos.ReturnRefund result = new org.bitcoin.paymentchannel.Protos.ReturnRefund(this); int from_bitField0_ = bitField0_; @@ -5906,6 +6654,39 @@ public org.bitcoin.paymentchannel.Protos.ReturnRefund buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.ReturnRefund) { return mergeFrom((org.bitcoin.paymentchannel.Protos.ReturnRefund)other); @@ -5920,18 +6701,20 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.ReturnRefund other) { if (other.hasSignature()) { setSignature(other.getSignature()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasSignature()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -5941,7 +6724,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.ReturnRefund) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -5985,16 +6768,57 @@ public Builder clearSignature() { 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.ReturnRefund) } + // @@protoc_insertion_point(class_scope:paymentchannels.ReturnRefund) + private static final org.bitcoin.paymentchannel.Protos.ReturnRefund DEFAULT_INSTANCE; static { - defaultInstance = new ReturnRefund(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.paymentchannel.Protos.ReturnRefund(); + } + + public static org.bitcoin.paymentchannel.Protos.ReturnRefund getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReturnRefund parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReturnRefund(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.ReturnRefund getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.ReturnRefund) } public interface ProvideContractOrBuilder extends @@ -6002,8 +6826,6 @@ public interface ProvideContractOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * required 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public ProvideContract parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ProvideContract(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int TX_FIELD_NUMBER = 1; private com.google.protobuf.ByteString tx_; /** - * required bytes tx = 1; - * *
      * The serialized bytes of the transaction in Satoshi format.
      * For version 1:
@@ -6235,13 +7039,13 @@ public com.google.protobuf.Parser getParserForType() {
      * * 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:
@@ -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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.ProvideContract) org.bitcoin.paymentchannel.Protos.ProvideContractOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -6486,7 +7359,8 @@ public static final class Builder extends 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( @@ -6499,25 +7373,23 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { getInitialPaymentFieldBuilder(); } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); tx_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); if (initialPaymentBuilder_ == null) { - initialPayment_ = org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance(); + initialPayment_ = null; } else { initialPaymentBuilder_.clear(); } @@ -6527,19 +7399,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_ProvideContract_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ProvideContract getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.ProvideContract.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ProvideContract build() { org.bitcoin.paymentchannel.Protos.ProvideContract result = buildPartial(); if (!result.isInitialized()) { @@ -6548,6 +7419,7 @@ public org.bitcoin.paymentchannel.Protos.ProvideContract build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.ProvideContract buildPartial() { org.bitcoin.paymentchannel.Protos.ProvideContract result = new org.bitcoin.paymentchannel.Protos.ProvideContract(this); int from_bitField0_ = bitField0_; @@ -6573,6 +7445,39 @@ public org.bitcoin.paymentchannel.Protos.ProvideContract buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.ProvideContract) { return mergeFrom((org.bitcoin.paymentchannel.Protos.ProvideContract)other); @@ -6593,26 +7498,26 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.ProvideContract other if (other.hasClientKey()) { setClientKey(other.getClientKey()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasTx()) { - return false; } if (!hasInitialPayment()) { - return false; } if (!getInitialPayment().isInitialized()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -6622,7 +7527,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.ProvideContract) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -6634,8 +7539,6 @@ public Builder mergeFrom( private com.google.protobuf.ByteString tx_ = com.google.protobuf.ByteString.EMPTY; /** - * required 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProvideContract parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProvideContract(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.ProvideContract getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.ProvideContract) } public interface UpdatePaymentOrBuilder extends @@ -6985,67 +7933,65 @@ public interface UpdatePaymentOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * 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; */ 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public UpdatePayment parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new UpdatePayment(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int CLIENT_CHANGE_VALUE_FIELD_NUMBER = 1; private long 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 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.UpdatePayment) org.bitcoin.paymentchannel.Protos.UpdatePaymentOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -7405,7 +8404,8 @@ public static final class Builder extends 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( @@ -7418,18 +8418,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); clientChangeValue_ = 0L; @@ -7441,19 +8439,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_UpdatePayment_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.UpdatePayment getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.UpdatePayment.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.UpdatePayment build() { org.bitcoin.paymentchannel.Protos.UpdatePayment result = buildPartial(); if (!result.isInitialized()) { @@ -7462,6 +8459,7 @@ public org.bitcoin.paymentchannel.Protos.UpdatePayment build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.UpdatePayment buildPartial() { org.bitcoin.paymentchannel.Protos.UpdatePayment result = new org.bitcoin.paymentchannel.Protos.UpdatePayment(this); int from_bitField0_ = bitField0_; @@ -7483,6 +8481,39 @@ public org.bitcoin.paymentchannel.Protos.UpdatePayment buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.UpdatePayment) { return mergeFrom((org.bitcoin.paymentchannel.Protos.UpdatePayment)other); @@ -7503,22 +8534,23 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.UpdatePayment other) if (other.hasInfo()) { setInfo(other.getInfo()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasClientChangeValue()) { - return false; } if (!hasSignature()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -7528,7 +8560,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.UpdatePayment) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -7540,34 +8572,34 @@ public Builder mergeFrom( private long 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 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdatePayment parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdatePayment(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.UpdatePayment getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.UpdatePayment) } public interface PaymentAckOrBuilder extends @@ -7720,60 +8793,55 @@ public interface PaymentAckOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * optional 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public PaymentAck parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PaymentAck(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int INFO_FIELD_NUMBER = 1; private com.google.protobuf.ByteString info_; /** - * optional 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.PaymentAck) org.bitcoin.paymentchannel.Protos.PaymentAckOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -7986,7 +9091,8 @@ public static final class Builder extends 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( @@ -7999,18 +9105,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); info_ = com.google.protobuf.ByteString.EMPTY; @@ -8018,19 +9122,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_PaymentAck_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.PaymentAck getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.PaymentAck.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.PaymentAck build() { org.bitcoin.paymentchannel.Protos.PaymentAck result = buildPartial(); if (!result.isInitialized()) { @@ -8039,6 +9142,7 @@ public org.bitcoin.paymentchannel.Protos.PaymentAck build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.PaymentAck buildPartial() { org.bitcoin.paymentchannel.Protos.PaymentAck result = new org.bitcoin.paymentchannel.Protos.PaymentAck(this); int from_bitField0_ = bitField0_; @@ -8052,6 +9156,39 @@ public org.bitcoin.paymentchannel.Protos.PaymentAck buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.PaymentAck) { return mergeFrom((org.bitcoin.paymentchannel.Protos.PaymentAck)other); @@ -8066,14 +9203,17 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.PaymentAck other) { if (other.hasInfo()) { setInfo(other.getInfo()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -8083,7 +9223,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.PaymentAck) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -8095,31 +9235,31 @@ public Builder mergeFrom( private com.google.protobuf.ByteString info_ = com.google.protobuf.ByteString.EMPTY; /** - * optional 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PaymentAck parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PaymentAck(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.PaymentAck getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.PaymentAck) } public interface SettlementOrBuilder extends @@ -8160,58 +9341,53 @@ public interface SettlementOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * 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; */ 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Settlement parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Settlement(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int TX_FIELD_NUMBER = 3; private com.google.protobuf.ByteString 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 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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.Settlement) org.bitcoin.paymentchannel.Protos.SettlementOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -8426,7 +9639,8 @@ public static final class Builder extends 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( @@ -8439,18 +9653,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); tx_ = com.google.protobuf.ByteString.EMPTY; @@ -8458,19 +9670,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Settlement_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Settlement getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.Settlement.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Settlement build() { org.bitcoin.paymentchannel.Protos.Settlement result = buildPartial(); if (!result.isInitialized()) { @@ -8479,6 +9690,7 @@ public org.bitcoin.paymentchannel.Protos.Settlement build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Settlement buildPartial() { org.bitcoin.paymentchannel.Protos.Settlement result = new org.bitcoin.paymentchannel.Protos.Settlement(this); int from_bitField0_ = bitField0_; @@ -8492,6 +9704,39 @@ public org.bitcoin.paymentchannel.Protos.Settlement buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.Settlement) { return mergeFrom((org.bitcoin.paymentchannel.Protos.Settlement)other); @@ -8506,18 +9751,20 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.Settlement other) { if (other.hasTx()) { setTx(other.getTx()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasTx()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -8527,7 +9774,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.Settlement) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -8539,34 +9786,34 @@ public Builder mergeFrom( private com.google.protobuf.ByteString tx_ = com.google.protobuf.ByteString.EMPTY; /** - * 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 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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Settlement parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Settlement(input, extensionRegistry); + } + }; - // @@protoc_insertion_point(builder_scope:paymentchannels.Settlement) + public static com.google.protobuf.Parser parser() { + return PARSER; } - static { - defaultInstance = new Settlement(true); - defaultInstance.initFields(); + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.Settlement getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.Settlement) } public interface ErrorOrBuilder extends @@ -8617,88 +9905,85 @@ public interface ErrorOrBuilder extends org.bitcoin.paymentchannel.Protos.Error.ErrorCode getCode(); /** - * optional 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.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Error parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Error(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - /** * Protobuf enum {@code paymentchannels.Error.ErrorCode} */ public enum ErrorCode implements com.google.protobuf.ProtocolMessageEnum { /** - * TIMEOUT = 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.EnumLiteMap - internalValueMap = + private static final com.google.protobuf.Internal.EnumLiteMap< + ErrorCode> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { public ErrorCode findValueByNumber(int number) { - return ErrorCode.valueOf(number); + return ErrorCode.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - return getDescriptor().getValues().get(index); + return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { @@ -8961,11 +10243,9 @@ public static ErrorCode valueOf( return VALUES[desc.getIndex()]; } - private final int index; private final int value; - private ErrorCode(int index, int value) { - this.index = index; + private ErrorCode(int value) { this.value = value; } @@ -8974,7 +10254,7 @@ private ErrorCode(int index, int value) { private int bitField0_; public static final int CODE_FIELD_NUMBER = 1; - private org.bitcoin.paymentchannel.Protos.Error.ErrorCode code_; + private int code_; /** * optional .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.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:paymentchannels.Error) org.bitcoin.paymentchannel.Protos.ErrorOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -9209,7 +10557,8 @@ public static final class Builder extends 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( @@ -9222,21 +10571,19 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); - code_ = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.OTHER; + code_ = 8; bitField0_ = (bitField0_ & ~0x00000001); explanation_ = ""; bitField0_ = (bitField0_ & ~0x00000002); @@ -9245,19 +10592,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.paymentchannel.Protos.internal_static_paymentchannels_Error_descriptor; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Error getDefaultInstanceForType() { return org.bitcoin.paymentchannel.Protos.Error.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Error build() { org.bitcoin.paymentchannel.Protos.Error result = buildPartial(); if (!result.isInitialized()) { @@ -9266,6 +10612,7 @@ public org.bitcoin.paymentchannel.Protos.Error build() { return result; } + @java.lang.Override public org.bitcoin.paymentchannel.Protos.Error buildPartial() { org.bitcoin.paymentchannel.Protos.Error result = new org.bitcoin.paymentchannel.Protos.Error(this); int from_bitField0_ = bitField0_; @@ -9287,6 +10634,39 @@ public org.bitcoin.paymentchannel.Protos.Error buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.paymentchannel.Protos.Error) { return mergeFrom((org.bitcoin.paymentchannel.Protos.Error)other); @@ -9309,14 +10689,17 @@ public Builder mergeFrom(org.bitcoin.paymentchannel.Protos.Error other) { if (other.hasExpectedValue()) { setExpectedValue(other.getExpectedValue()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -9326,7 +10709,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.paymentchannel.Protos.Error) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -9336,7 +10719,7 @@ public Builder mergeFrom( } private int bitField0_; - private org.bitcoin.paymentchannel.Protos.Error.ErrorCode code_ = org.bitcoin.paymentchannel.Protos.Error.ErrorCode.OTHER; + private int code_ = 8; /** * optional .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.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Error parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Error(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.paymentchannel.Protos.Error getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:paymentchannels.Error) } private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_TwoWayChannelMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_TwoWayChannelMessage_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_ClientVersion_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_ClientVersion_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_ServerVersion_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_ServerVersion_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_Initiate_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_Initiate_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_ProvideRefund_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_ProvideRefund_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_ReturnRefund_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_ReturnRefund_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_ProvideContract_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_ProvideContract_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_UpdatePayment_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_UpdatePayment_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_PaymentAck_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_PaymentAck_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_Settlement_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_Settlement_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_paymentchannels_Error_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_paymentchannels_Error_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } - private static com.google.protobuf.Descriptors.FileDescriptor + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { @@ -9603,7 +11029,7 @@ public Builder clearExpectedValue() { "n\022+\n\010initiate\030\004 \001(\0132\031.paymentchannels.In" + "itiate\0226\n\016provide_refund\030\005 \001(\0132\036.payment" + "channels.ProvideRefund\0224\n\rreturn_refund\030" + - "\006 \001(\0132\035.paymentchannels.ReturnRefund\022:\n\020", + "\006 \001(\0132\035.paymentchannels.ReturnRefund\022:\n\020" + "provide_contract\030\007 \001(\0132 .paymentchannels" + ".ProvideContract\0226\n\016update_payment\030\010 \001(\013" + "2\036.paymentchannels.UpdatePayment\0220\n\013paym" + @@ -9613,7 +11039,7 @@ public Builder clearExpectedValue() { "nels.Error\"\315\001\n\013MessageType\022\022\n\016CLIENT_VER" + "SION\020\001\022\022\n\016SERVER_VERSION\020\002\022\014\n\010INITIATE\020\003" + "\022\022\n\016PROVIDE_REFUND\020\004\022\021\n\rRETURN_REFUND\020\005\022" + - "\024\n\020PROVIDE_CONTRACT\020\006\022\020\n\014CHANNEL_OPEN\020\007\022", + "\024\n\020PROVIDE_CONTRACT\020\006\022\020\n\014CHANNEL_OPEN\020\007\022" + "\022\n\016UPDATE_PAYMENT\020\010\022\017\n\013PAYMENT_ACK\020\013\022\t\n\005" + "CLOSE\020\t\022\t\n\005ERROR\020\n\"y\n\rClientVersion\022\r\n\005m" + "ajor\030\001 \002(\005\022\020\n\005minor\030\002 \001(\005:\0010\022&\n\036previous" + @@ -9623,7 +11049,7 @@ public Builder clearExpectedValue() { "ate\022\024\n\014multisig_key\030\001 \002(\014\022!\n\031min_accepte" + "d_channel_size\030\002 \002(\004\022\030\n\020expire_time_secs" + "\030\003 \002(\004\022\023\n\013min_payment\030\004 \002(\004\"1\n\rProvideRe" + - "fund\022\024\n\014multisig_key\030\001 \002(\014\022\n\n\002tx\030\002 \002(\014\"!", + "fund\022\024\n\014multisig_key\030\001 \002(\014\022\n\n\002tx\030\002 \002(\014\"!" + "\n\014ReturnRefund\022\021\n\tsignature\030\001 \002(\014\"j\n\017Pro" + "videContract\022\n\n\002tx\030\001 \002(\014\0227\n\017initial_paym" + "ent\030\002 \002(\0132\036.paymentchannels.UpdatePaymen" + @@ -9633,7 +11059,7 @@ public Builder clearExpectedValue() { "fo\030\001 \001(\014\"\030\n\nSettlement\022\n\n\002tx\030\003 \002(\014\"\251\002\n\005E" + "rror\0225\n\004code\030\001 \001(\0162 .paymentchannels.Err" + "or.ErrorCode:\005OTHER\022\023\n\013explanation\030\002 \001(\t" + - "\022\026\n\016expected_value\030\003 \001(\004\"\273\001\n\tErrorCode\022\013", + "\022\026\n\016expected_value\030\003 \001(\004\"\273\001\n\tErrorCode\022\013" + "\n\007TIMEOUT\020\001\022\020\n\014SYNTAX_ERROR\020\002\022\031\n\025NO_ACCE" + "PTABLE_VERSION\020\003\022\023\n\017BAD_TRANSACTION\020\004\022\034\n" + "\030TIME_WINDOW_UNACCEPTABLE\020\005\022\033\n\027CHANNEL_V" + @@ -9656,67 +11082,67 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_paymentchannels_TwoWayChannelMessage_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_paymentchannels_TwoWayChannelMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_TwoWayChannelMessage_descriptor, new java.lang.String[] { "Type", "ClientVersion", "ServerVersion", "Initiate", "ProvideRefund", "ReturnRefund", "ProvideContract", "UpdatePayment", "PaymentAck", "Settlement", "Error", }); internal_static_paymentchannels_ClientVersion_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_paymentchannels_ClientVersion_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_ClientVersion_descriptor, new java.lang.String[] { "Major", "Minor", "PreviousChannelContractHash", "TimeWindowSecs", }); internal_static_paymentchannels_ServerVersion_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_paymentchannels_ServerVersion_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_ServerVersion_descriptor, new java.lang.String[] { "Major", "Minor", }); internal_static_paymentchannels_Initiate_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_paymentchannels_Initiate_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_Initiate_descriptor, new java.lang.String[] { "MultisigKey", "MinAcceptedChannelSize", "ExpireTimeSecs", "MinPayment", }); internal_static_paymentchannels_ProvideRefund_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_paymentchannels_ProvideRefund_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_ProvideRefund_descriptor, new java.lang.String[] { "MultisigKey", "Tx", }); internal_static_paymentchannels_ReturnRefund_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_paymentchannels_ReturnRefund_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_ReturnRefund_descriptor, new java.lang.String[] { "Signature", }); internal_static_paymentchannels_ProvideContract_descriptor = getDescriptor().getMessageTypes().get(6); internal_static_paymentchannels_ProvideContract_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_ProvideContract_descriptor, new java.lang.String[] { "Tx", "InitialPayment", "ClientKey", }); internal_static_paymentchannels_UpdatePayment_descriptor = getDescriptor().getMessageTypes().get(7); internal_static_paymentchannels_UpdatePayment_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_UpdatePayment_descriptor, new java.lang.String[] { "ClientChangeValue", "Signature", "Info", }); internal_static_paymentchannels_PaymentAck_descriptor = getDescriptor().getMessageTypes().get(8); internal_static_paymentchannels_PaymentAck_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_PaymentAck_descriptor, new java.lang.String[] { "Info", }); internal_static_paymentchannels_Settlement_descriptor = getDescriptor().getMessageTypes().get(9); internal_static_paymentchannels_Settlement_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_Settlement_descriptor, new java.lang.String[] { "Tx", }); internal_static_paymentchannels_Error_descriptor = getDescriptor().getMessageTypes().get(10); internal_static_paymentchannels_Error_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_paymentchannels_Error_descriptor, new java.lang.String[] { "Code", "Explanation", "ExpectedValue", }); } diff --git a/core/src/main/java/org/bitcoin/protocols/payments/Protos.java b/core/src/main/java/org/bitcoin/protocols/payments/Protos.java index 7ffc24a072e..7cb2580875a 100644 --- a/core/src/main/java/org/bitcoin/protocols/payments/Protos.java +++ b/core/src/main/java/org/bitcoin/protocols/payments/Protos.java @@ -5,85 +5,87 @@ public final class Protos { private Protos() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); } public interface OutputOrBuilder extends // @@protoc_insertion_point(interface_extends:payments.Output) com.google.protobuf.MessageOrBuilder { /** - * optional 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 PARSER = - new com.google.protobuf.AbstractParser() { - public Output parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Output(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int AMOUNT_FIELD_NUMBER = 1; private long amount_; /** - * optional uint64 amount = 1 [default = 0]; - * *
      * amount is integer-number-of-satoshis
      * 
+ * + * optional uint64 amount = 1 [default = 0]; */ public boolean hasAmount() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional uint64 amount = 1 [default = 0]; - * *
      * amount is integer-number-of-satoshis
      * 
+ * + * optional uint64 amount = 1 [default = 0]; */ public long getAmount() { return amount_; @@ -178,31 +166,28 @@ public long getAmount() { public static final int SCRIPT_FIELD_NUMBER = 2; private com.google.protobuf.ByteString script_; /** - * required bytes script = 2; - * *
      * usually one of the standard Script forms
      * 
+ * + * required bytes script = 2; */ public boolean hasScript() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * required bytes script = 2; - * *
      * usually one of the standard Script forms
      * 
+ * + * required bytes script = 2; */ public com.google.protobuf.ByteString getScript() { return script_; } - private void initFields() { - amount_ = 0L; - script_ = com.google.protobuf.ByteString.EMPTY; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -216,21 +201,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.writeUInt64(1, amount_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, script_); } - 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; @@ -242,18 +227,68 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, script_); } - 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.protocols.payments.Protos.Output)) { + return super.equals(obj); + } + org.bitcoin.protocols.payments.Protos.Output other = (org.bitcoin.protocols.payments.Protos.Output) obj; + + boolean result = true; + result = result && (hasAmount() == other.hasAmount()); + if (hasAmount()) { + result = result && (getAmount() + == other.getAmount()); + } + result = result && (hasScript() == other.hasScript()); + if (hasScript()) { + result = result && getScript() + .equals(other.getScript()); + } + 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 (hasAmount()) { + hash = (37 * hash) + AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getAmount()); + } + if (hasScript()) { + hash = (37 * hash) + SCRIPT_FIELD_NUMBER; + hash = (53 * hash) + getScript().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.bitcoin.protocols.payments.Protos.Output parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.protocols.payments.Protos.Output parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.bitcoin.protocols.payments.Protos.Output parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -277,58 +312,71 @@ public static org.bitcoin.protocols.payments.Protos.Output parseFrom( } public static org.bitcoin.protocols.payments.Protos.Output 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.protocols.payments.Protos.Output 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.protocols.payments.Protos.Output 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.protocols.payments.Protos.Output 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.protocols.payments.Protos.Output 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.protocols.payments.Protos.Output 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.protocols.payments.Protos.Output 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 payments.Output} - * *
      * Generalized form of "send payment to this/these bitcoin addresses"
      * 
+ * + * Protobuf type {@code payments.Output} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:payments.Output) org.bitcoin.protocols.payments.Protos.OutputOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -336,7 +384,8 @@ public static final class Builder extends 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( @@ -349,18 +398,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); amount_ = 0L; @@ -370,19 +417,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_descriptor; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.Output getDefaultInstanceForType() { return org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.Output build() { org.bitcoin.protocols.payments.Protos.Output result = buildPartial(); if (!result.isInitialized()) { @@ -391,6 +437,7 @@ public org.bitcoin.protocols.payments.Protos.Output build() { return result; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.Output buildPartial() { org.bitcoin.protocols.payments.Protos.Output result = new org.bitcoin.protocols.payments.Protos.Output(this); int from_bitField0_ = bitField0_; @@ -408,6 +455,39 @@ public org.bitcoin.protocols.payments.Protos.Output buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.protocols.payments.Protos.Output) { return mergeFrom((org.bitcoin.protocols.payments.Protos.Output)other); @@ -425,18 +505,20 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.Output other) { if (other.hasScript()) { setScript(other.getScript()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasScript()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -446,7 +528,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.Output) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -458,31 +540,31 @@ public Builder mergeFrom( private long amount_ ; /** - * optional uint64 amount = 1 [default = 0]; - * *
        * amount is integer-number-of-satoshis
        * 
+ * + * optional uint64 amount = 1 [default = 0]; */ public boolean hasAmount() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional uint64 amount = 1 [default = 0]; - * *
        * amount is integer-number-of-satoshis
        * 
+ * + * optional uint64 amount = 1 [default = 0]; */ public long getAmount() { return amount_; } /** - * optional uint64 amount = 1 [default = 0]; - * *
        * amount is integer-number-of-satoshis
        * 
+ * + * optional uint64 amount = 1 [default = 0]; */ public Builder setAmount(long value) { bitField0_ |= 0x00000001; @@ -491,11 +573,11 @@ public Builder setAmount(long value) { return this; } /** - * optional uint64 amount = 1 [default = 0]; - * *
        * amount is integer-number-of-satoshis
        * 
+ * + * optional uint64 amount = 1 [default = 0]; */ public Builder clearAmount() { bitField0_ = (bitField0_ & ~0x00000001); @@ -506,31 +588,31 @@ public Builder clearAmount() { private com.google.protobuf.ByteString script_ = com.google.protobuf.ByteString.EMPTY; /** - * required bytes script = 2; - * *
        * usually one of the standard Script forms
        * 
+ * + * required bytes script = 2; */ public boolean hasScript() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * required bytes script = 2; - * *
        * usually one of the standard Script forms
        * 
+ * + * required bytes script = 2; */ public com.google.protobuf.ByteString getScript() { return script_; } /** - * required bytes script = 2; - * *
        * usually one of the standard Script forms
        * 
+ * + * required bytes script = 2; */ public Builder setScript(com.google.protobuf.ByteString value) { if (value == null) { @@ -542,11 +624,11 @@ public Builder setScript(com.google.protobuf.ByteString value) { return this; } /** - * required bytes script = 2; - * *
        * usually one of the standard Script forms
        * 
+ * + * required bytes script = 2; */ public Builder clearScript() { bitField0_ = (bitField0_ & ~0x00000002); @@ -554,16 +636,57 @@ public Builder clearScript() { 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:payments.Output) } + // @@protoc_insertion_point(class_scope:payments.Output) + private static final org.bitcoin.protocols.payments.Protos.Output DEFAULT_INSTANCE; static { - defaultInstance = new Output(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.protocols.payments.Protos.Output(); + } + + public static org.bitcoin.protocols.payments.Protos.Output getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Output parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Output(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.protocols.payments.Protos.Output getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:payments.Output) } public interface PaymentDetailsOrBuilder extends @@ -571,212 +694,213 @@ public interface PaymentDetailsOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * optional string network = 1 [default = "main"]; - * *
      * "main" or "test"
      * 
+ * + * optional string network = 1 [default = "main"]; */ boolean hasNetwork(); /** - * optional string network = 1 [default = "main"]; - * *
      * "main" or "test"
      * 
+ * + * optional string network = 1 [default = "main"]; */ java.lang.String getNetwork(); /** - * optional string network = 1 [default = "main"]; - * *
      * "main" or "test"
      * 
+ * + * optional string network = 1 [default = "main"]; */ com.google.protobuf.ByteString getNetworkBytes(); /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ java.util.List getOutputsList(); /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ org.bitcoin.protocols.payments.Protos.Output getOutputs(int index); /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ int getOutputsCount(); /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ java.util.List getOutputsOrBuilderList(); /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder( int index); /** - * required uint64 time = 3; - * *
      * Timestamp; when payment request created
      * 
+ * + * required uint64 time = 3; */ boolean hasTime(); /** - * required uint64 time = 3; - * *
      * Timestamp; when payment request created
      * 
+ * + * required uint64 time = 3; */ long getTime(); /** - * optional uint64 expires = 4; - * *
      * Timestamp; when this request should be considered invalid
      * 
+ * + * optional uint64 expires = 4; */ boolean hasExpires(); /** - * optional uint64 expires = 4; - * *
      * Timestamp; when this request should be considered invalid
      * 
+ * + * optional uint64 expires = 4; */ long getExpires(); /** - * optional string memo = 5; - * *
      * Human-readable description of request for the customer
      * 
+ * + * optional string memo = 5; */ boolean hasMemo(); /** - * optional string memo = 5; - * *
      * Human-readable description of request for the customer
      * 
+ * + * optional string memo = 5; */ java.lang.String getMemo(); /** - * optional string memo = 5; - * *
      * Human-readable description of request for the customer
      * 
+ * + * optional string memo = 5; */ com.google.protobuf.ByteString getMemoBytes(); /** - * optional string payment_url = 6; - * *
      * URL to send Payment and get PaymentACK
      * 
+ * + * optional string payment_url = 6; */ boolean hasPaymentUrl(); /** - * optional string payment_url = 6; - * *
      * URL to send Payment and get PaymentACK
      * 
+ * + * optional string payment_url = 6; */ java.lang.String getPaymentUrl(); /** - * optional string payment_url = 6; - * *
      * URL to send Payment and get PaymentACK
      * 
+ * + * optional string payment_url = 6; */ com.google.protobuf.ByteString getPaymentUrlBytes(); /** - * optional bytes merchant_data = 7; - * *
      * Arbitrary data to include in the Payment message
      * 
+ * + * optional bytes merchant_data = 7; */ boolean hasMerchantData(); /** - * optional bytes merchant_data = 7; - * *
      * Arbitrary data to include in the Payment message
      * 
+ * + * optional bytes merchant_data = 7; */ com.google.protobuf.ByteString getMerchantData(); } /** * Protobuf type {@code payments.PaymentDetails} */ - public static final class PaymentDetails extends - com.google.protobuf.GeneratedMessage implements + public static final class PaymentDetails extends + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:payments.PaymentDetails) PaymentDetailsOrBuilder { + private static final long serialVersionUID = 0L; // Use PaymentDetails.newBuilder() to construct. - private PaymentDetails(com.google.protobuf.GeneratedMessage.Builder builder) { + private PaymentDetails(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); - this.unknownFields = builder.getUnknownFields(); } - private PaymentDetails(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final PaymentDetails defaultInstance; - public static PaymentDetails getDefaultInstance() { - return defaultInstance; - } - - public PaymentDetails getDefaultInstanceForType() { - return defaultInstance; + private PaymentDetails() { + network_ = "main"; + outputs_ = java.util.Collections.emptyList(); + time_ = 0L; + expires_ = 0L; + memo_ = ""; + paymentUrl_ = ""; + merchantData_ = 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 PaymentDetails( 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(); @@ -788,13 +912,6 @@ private PaymentDetails( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; @@ -806,7 +923,8 @@ private PaymentDetails( outputs_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } - outputs_.add(input.readMessage(org.bitcoin.protocols.payments.Protos.Output.PARSER, extensionRegistry)); + outputs_.add( + input.readMessage(org.bitcoin.protocols.payments.Protos.Output.PARSER, extensionRegistry)); break; } case 24: { @@ -836,13 +954,20 @@ private PaymentDetails( merchantData_ = 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 { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { outputs_ = java.util.Collections.unmodifiableList(outputs_); @@ -856,47 +981,33 @@ private PaymentDetails( return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_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_PaymentDetails_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.protocols.payments.Protos.PaymentDetails.class, org.bitcoin.protocols.payments.Protos.PaymentDetails.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public PaymentDetails parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PaymentDetails(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int NETWORK_FIELD_NUMBER = 1; - private java.lang.Object network_; + private volatile java.lang.Object network_; /** - * optional string network = 1 [default = "main"]; - * *
      * "main" or "test"
      * 
+ * + * optional string network = 1 [default = "main"]; */ public boolean hasNetwork() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional string network = 1 [default = "main"]; - * *
      * "main" or "test"
      * 
+ * + * optional string network = 1 [default = "main"]; */ public java.lang.String getNetwork() { java.lang.Object ref = network_; @@ -913,11 +1024,11 @@ public java.lang.String getNetwork() { } } /** - * optional string network = 1 [default = "main"]; - * *
      * "main" or "test"
      * 
+ * + * optional string network = 1 [default = "main"]; */ public com.google.protobuf.ByteString getNetworkBytes() { @@ -935,53 +1046,53 @@ public java.lang.String getNetwork() { public static final int OUTPUTS_FIELD_NUMBER = 2; private java.util.List outputs_; - /** - * repeated .payments.Output outputs = 2; - * + /** *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ public java.util.List getOutputsList() { return outputs_; } /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ public java.util.List getOutputsOrBuilderList() { return outputs_; } /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ public int getOutputsCount() { return outputs_.size(); } /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.Output getOutputs(int index) { return outputs_.get(index); } /** - * repeated .payments.Output outputs = 2; - * *
      * Where payment should be sent
      * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder( int index) { @@ -991,21 +1102,21 @@ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder public static final int TIME_FIELD_NUMBER = 3; private long time_; /** - * required uint64 time = 3; - * *
      * Timestamp; when payment request created
      * 
+ * + * required uint64 time = 3; */ public boolean hasTime() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * required uint64 time = 3; - * *
      * Timestamp; when payment request created
      * 
+ * + * required uint64 time = 3; */ public long getTime() { return time_; @@ -1014,44 +1125,44 @@ public long getTime() { public static final int EXPIRES_FIELD_NUMBER = 4; private long expires_; /** - * optional uint64 expires = 4; - * *
      * Timestamp; when this request should be considered invalid
      * 
+ * + * optional uint64 expires = 4; */ public boolean hasExpires() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** - * optional uint64 expires = 4; - * *
      * Timestamp; when this request should be considered invalid
      * 
+ * + * optional uint64 expires = 4; */ public long getExpires() { return expires_; } public static final int MEMO_FIELD_NUMBER = 5; - private java.lang.Object memo_; + private volatile java.lang.Object memo_; /** - * optional string memo = 5; - * *
      * Human-readable description of request for the customer
      * 
+ * + * optional string memo = 5; */ public boolean hasMemo() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** - * optional string memo = 5; - * *
      * Human-readable description of request for the customer
      * 
+ * + * optional string memo = 5; */ public java.lang.String getMemo() { java.lang.Object ref = memo_; @@ -1068,11 +1179,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 5; - * *
      * Human-readable description of request for the customer
      * 
+ * + * optional string memo = 5; */ public com.google.protobuf.ByteString getMemoBytes() { @@ -1089,23 +1200,23 @@ public java.lang.String getMemo() { } public static final int PAYMENT_URL_FIELD_NUMBER = 6; - private java.lang.Object paymentUrl_; + private volatile java.lang.Object paymentUrl_; /** - * optional string payment_url = 6; - * *
      * URL to send Payment and get PaymentACK
      * 
+ * + * optional string payment_url = 6; */ public boolean hasPaymentUrl() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** - * optional string payment_url = 6; - * *
      * URL to send Payment and get PaymentACK
      * 
+ * + * optional string payment_url = 6; */ public java.lang.String getPaymentUrl() { java.lang.Object ref = paymentUrl_; @@ -1122,11 +1233,11 @@ public java.lang.String getPaymentUrl() { } } /** - * optional string payment_url = 6; - * *
      * URL to send Payment and get PaymentACK
      * 
+ * + * optional string payment_url = 6; */ public com.google.protobuf.ByteString getPaymentUrlBytes() { @@ -1145,36 +1256,28 @@ public java.lang.String getPaymentUrl() { public static final int MERCHANT_DATA_FIELD_NUMBER = 7; private com.google.protobuf.ByteString merchantData_; /** - * optional bytes merchant_data = 7; - * *
      * Arbitrary data to include in the Payment message
      * 
+ * + * optional bytes merchant_data = 7; */ public boolean hasMerchantData() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** - * optional bytes merchant_data = 7; - * *
      * Arbitrary data to include in the Payment message
      * 
+ * + * optional bytes merchant_data = 7; */ public com.google.protobuf.ByteString getMerchantData() { return merchantData_; } - private void initFields() { - network_ = "main"; - outputs_ = java.util.Collections.emptyList(); - time_ = 0L; - expires_ = 0L; - memo_ = ""; - paymentUrl_ = ""; - merchantData_ = com.google.protobuf.ByteString.EMPTY; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -1194,11 +1297,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, getNetworkBytes()); + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, network_); } for (int i = 0; i < outputs_.size(); i++) { output.writeMessage(2, outputs_.get(i)); @@ -1210,26 +1313,25 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) output.writeUInt64(4, expires_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(5, getMemoBytes()); + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, memo_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(6, getPaymentUrlBytes()); + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, paymentUrl_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(7, merchantData_); } - 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, getNetworkBytes()); + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, network_); } for (int i = 0; i < outputs_.size(); i++) { size += com.google.protobuf.CodedOutputStream @@ -1244,29 +1346,120 @@ public int getSerializedSize() { .computeUInt64Size(4, expires_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(5, getMemoBytes()); + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, memo_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(6, getPaymentUrlBytes()); + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, paymentUrl_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, merchantData_); } - 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.protocols.payments.Protos.PaymentDetails)) { + return super.equals(obj); + } + org.bitcoin.protocols.payments.Protos.PaymentDetails other = (org.bitcoin.protocols.payments.Protos.PaymentDetails) obj; + + boolean result = true; + result = result && (hasNetwork() == other.hasNetwork()); + if (hasNetwork()) { + result = result && getNetwork() + .equals(other.getNetwork()); + } + result = result && getOutputsList() + .equals(other.getOutputsList()); + result = result && (hasTime() == other.hasTime()); + if (hasTime()) { + result = result && (getTime() + == other.getTime()); + } + result = result && (hasExpires() == other.hasExpires()); + if (hasExpires()) { + result = result && (getExpires() + == other.getExpires()); + } + result = result && (hasMemo() == other.hasMemo()); + if (hasMemo()) { + result = result && getMemo() + .equals(other.getMemo()); + } + result = result && (hasPaymentUrl() == other.hasPaymentUrl()); + if (hasPaymentUrl()) { + result = result && getPaymentUrl() + .equals(other.getPaymentUrl()); + } + result = result && (hasMerchantData() == other.hasMerchantData()); + if (hasMerchantData()) { + result = result && getMerchantData() + .equals(other.getMerchantData()); + } + 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 (hasNetwork()) { + hash = (37 * hash) + NETWORK_FIELD_NUMBER; + hash = (53 * hash) + getNetwork().hashCode(); + } + if (getOutputsCount() > 0) { + hash = (37 * hash) + OUTPUTS_FIELD_NUMBER; + hash = (53 * hash) + getOutputsList().hashCode(); + } + if (hasTime()) { + hash = (37 * hash) + TIME_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTime()); + } + if (hasExpires()) { + hash = (37 * hash) + EXPIRES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getExpires()); + } + if (hasMemo()) { + hash = (37 * hash) + MEMO_FIELD_NUMBER; + hash = (53 * hash) + getMemo().hashCode(); + } + if (hasPaymentUrl()) { + hash = (37 * hash) + PAYMENT_URL_FIELD_NUMBER; + hash = (53 * hash) + getPaymentUrl().hashCode(); + } + if (hasMerchantData()) { + hash = (37 * hash) + MERCHANT_DATA_FIELD_NUMBER; + hash = (53 * hash) + getMerchantData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } + public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -1290,46 +1483,59 @@ public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom( } public static org.bitcoin.protocols.payments.Protos.PaymentDetails 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.protocols.payments.Protos.PaymentDetails 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.protocols.payments.Protos.PaymentDetails 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.protocols.payments.Protos.PaymentDetails 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.protocols.payments.Protos.PaymentDetails 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.protocols.payments.Protos.PaymentDetails 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.protocols.payments.Protos.PaymentDetails 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; } @@ -1337,7 +1543,7 @@ protected Builder newBuilderForType( * Protobuf type {@code payments.PaymentDetails} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:payments.PaymentDetails) org.bitcoin.protocols.payments.Protos.PaymentDetailsOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -1345,7 +1551,8 @@ public static final class Builder extends return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_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_PaymentDetails_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -1358,19 +1565,17 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { getOutputsFieldBuilder(); } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); network_ = "main"; @@ -1394,19 +1599,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_descriptor; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentDetails getDefaultInstanceForType() { return org.bitcoin.protocols.payments.Protos.PaymentDetails.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentDetails build() { org.bitcoin.protocols.payments.Protos.PaymentDetails result = buildPartial(); if (!result.isInitialized()) { @@ -1415,6 +1619,7 @@ public org.bitcoin.protocols.payments.Protos.PaymentDetails build() { return result; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentDetails buildPartial() { org.bitcoin.protocols.payments.Protos.PaymentDetails result = new org.bitcoin.protocols.payments.Protos.PaymentDetails(this); int from_bitField0_ = bitField0_; @@ -1457,6 +1662,39 @@ public org.bitcoin.protocols.payments.Protos.PaymentDetails buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.protocols.payments.Protos.PaymentDetails) { return mergeFrom((org.bitcoin.protocols.payments.Protos.PaymentDetails)other); @@ -1492,7 +1730,7 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentDetails ot outputs_ = other.outputs_; bitField0_ = (bitField0_ & ~0x00000002); outputsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getOutputsFieldBuilder() : null; } else { outputsBuilder_.addAllMessages(other.outputs_); @@ -1518,24 +1756,25 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentDetails ot if (other.hasMerchantData()) { setMerchantData(other.getMerchantData()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasTime()) { - return false; } for (int i = 0; i < getOutputsCount(); i++) { if (!getOutputs(i).isInitialized()) { - return false; } } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -1545,7 +1784,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.PaymentDetails) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -1557,21 +1796,21 @@ public Builder mergeFrom( private java.lang.Object network_ = "main"; /** - * optional string network = 1 [default = "main"]; - * *
        * "main" or "test"
        * 
+ * + * optional string network = 1 [default = "main"]; */ public boolean hasNetwork() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional string network = 1 [default = "main"]; - * *
        * "main" or "test"
        * 
+ * + * optional string network = 1 [default = "main"]; */ public java.lang.String getNetwork() { java.lang.Object ref = network_; @@ -1588,11 +1827,11 @@ public java.lang.String getNetwork() { } } /** - * optional string network = 1 [default = "main"]; - * *
        * "main" or "test"
        * 
+ * + * optional string network = 1 [default = "main"]; */ public com.google.protobuf.ByteString getNetworkBytes() { @@ -1608,11 +1847,11 @@ public java.lang.String getNetwork() { } } /** - * optional string network = 1 [default = "main"]; - * *
        * "main" or "test"
        * 
+ * + * optional string network = 1 [default = "main"]; */ public Builder setNetwork( java.lang.String value) { @@ -1625,11 +1864,11 @@ public Builder setNetwork( return this; } /** - * optional string network = 1 [default = "main"]; - * *
        * "main" or "test"
        * 
+ * + * optional string network = 1 [default = "main"]; */ public Builder clearNetwork() { bitField0_ = (bitField0_ & ~0x00000001); @@ -1638,11 +1877,11 @@ public Builder clearNetwork() { return this; } /** - * optional string network = 1 [default = "main"]; - * *
        * "main" or "test"
        * 
+ * + * optional string network = 1 [default = "main"]; */ public Builder setNetworkBytes( com.google.protobuf.ByteString value) { @@ -1664,15 +1903,15 @@ private void ensureOutputsIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilder< + private com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> outputsBuilder_; /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public java.util.List getOutputsList() { if (outputsBuilder_ == null) { @@ -1682,11 +1921,11 @@ public java.util.List getOutputsLi } } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public int getOutputsCount() { if (outputsBuilder_ == null) { @@ -1696,11 +1935,11 @@ public int getOutputsCount() { } } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.Output getOutputs(int index) { if (outputsBuilder_ == null) { @@ -1710,11 +1949,11 @@ public org.bitcoin.protocols.payments.Protos.Output getOutputs(int index) { } } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder setOutputs( int index, org.bitcoin.protocols.payments.Protos.Output value) { @@ -1731,11 +1970,11 @@ public Builder setOutputs( return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder setOutputs( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { @@ -1749,11 +1988,11 @@ public Builder setOutputs( return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder addOutputs(org.bitcoin.protocols.payments.Protos.Output value) { if (outputsBuilder_ == null) { @@ -1769,11 +2008,11 @@ public Builder addOutputs(org.bitcoin.protocols.payments.Protos.Output value) { return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder addOutputs( int index, org.bitcoin.protocols.payments.Protos.Output value) { @@ -1790,11 +2029,11 @@ public Builder addOutputs( return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder addOutputs( org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { @@ -1808,11 +2047,11 @@ public Builder addOutputs( return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder addOutputs( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { @@ -1826,11 +2065,11 @@ public Builder addOutputs( return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder addAllOutputs( java.lang.Iterable values) { @@ -1845,11 +2084,11 @@ public Builder addAllOutputs( return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder clearOutputs() { if (outputsBuilder_ == null) { @@ -1862,11 +2101,11 @@ public Builder clearOutputs() { return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public Builder removeOutputs(int index) { if (outputsBuilder_ == null) { @@ -1879,22 +2118,22 @@ public Builder removeOutputs(int index) { return this; } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.Output.Builder getOutputsBuilder( int index) { return getOutputsFieldBuilder().getBuilder(index); } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder( int index) { @@ -1904,11 +2143,11 @@ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder } } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public java.util.List getOutputsOrBuilderList() { @@ -1919,22 +2158,22 @@ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder } } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.Output.Builder addOutputsBuilder() { return getOutputsFieldBuilder().addBuilder( org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance()); } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public org.bitcoin.protocols.payments.Protos.Output.Builder addOutputsBuilder( int index) { @@ -1942,21 +2181,21 @@ public org.bitcoin.protocols.payments.Protos.Output.Builder addOutputsBuilder( index, org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance()); } /** - * repeated .payments.Output outputs = 2; - * *
        * Where payment should be sent
        * 
+ * + * repeated .payments.Output outputs = 2; */ public java.util.List getOutputsBuilderList() { return getOutputsFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilder< + private com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> getOutputsFieldBuilder() { if (outputsBuilder_ == null) { - outputsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + outputsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder>( outputs_, ((bitField0_ & 0x00000002) == 0x00000002), @@ -1969,31 +2208,31 @@ public org.bitcoin.protocols.payments.Protos.Output.Builder addOutputsBuilder( private long time_ ; /** - * required uint64 time = 3; - * *
        * Timestamp; when payment request created
        * 
+ * + * required uint64 time = 3; */ public boolean hasTime() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** - * required uint64 time = 3; - * *
        * Timestamp; when payment request created
        * 
+ * + * required uint64 time = 3; */ public long getTime() { return time_; } /** - * required uint64 time = 3; - * *
        * Timestamp; when payment request created
        * 
+ * + * required uint64 time = 3; */ public Builder setTime(long value) { bitField0_ |= 0x00000004; @@ -2002,11 +2241,11 @@ public Builder setTime(long value) { return this; } /** - * required uint64 time = 3; - * *
        * Timestamp; when payment request created
        * 
+ * + * required uint64 time = 3; */ public Builder clearTime() { bitField0_ = (bitField0_ & ~0x00000004); @@ -2017,31 +2256,31 @@ public Builder clearTime() { private long expires_ ; /** - * optional uint64 expires = 4; - * *
        * Timestamp; when this request should be considered invalid
        * 
+ * + * optional uint64 expires = 4; */ public boolean hasExpires() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** - * optional uint64 expires = 4; - * *
        * Timestamp; when this request should be considered invalid
        * 
+ * + * optional uint64 expires = 4; */ public long getExpires() { return expires_; } /** - * optional uint64 expires = 4; - * *
        * Timestamp; when this request should be considered invalid
        * 
+ * + * optional uint64 expires = 4; */ public Builder setExpires(long value) { bitField0_ |= 0x00000008; @@ -2050,11 +2289,11 @@ public Builder setExpires(long value) { return this; } /** - * optional uint64 expires = 4; - * *
        * Timestamp; when this request should be considered invalid
        * 
+ * + * optional uint64 expires = 4; */ public Builder clearExpires() { bitField0_ = (bitField0_ & ~0x00000008); @@ -2065,21 +2304,21 @@ public Builder clearExpires() { private java.lang.Object memo_ = ""; /** - * optional string memo = 5; - * *
        * Human-readable description of request for the customer
        * 
+ * + * optional string memo = 5; */ public boolean hasMemo() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** - * optional string memo = 5; - * *
        * Human-readable description of request for the customer
        * 
+ * + * optional string memo = 5; */ public java.lang.String getMemo() { java.lang.Object ref = memo_; @@ -2096,11 +2335,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 5; - * *
        * Human-readable description of request for the customer
        * 
+ * + * optional string memo = 5; */ public com.google.protobuf.ByteString getMemoBytes() { @@ -2116,11 +2355,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 5; - * *
        * Human-readable description of request for the customer
        * 
+ * + * optional string memo = 5; */ public Builder setMemo( java.lang.String value) { @@ -2133,11 +2372,11 @@ public Builder setMemo( return this; } /** - * optional string memo = 5; - * *
        * Human-readable description of request for the customer
        * 
+ * + * optional string memo = 5; */ public Builder clearMemo() { bitField0_ = (bitField0_ & ~0x00000010); @@ -2146,11 +2385,11 @@ public Builder clearMemo() { return this; } /** - * optional string memo = 5; - * *
        * Human-readable description of request for the customer
        * 
+ * + * optional string memo = 5; */ public Builder setMemoBytes( com.google.protobuf.ByteString value) { @@ -2165,21 +2404,21 @@ public Builder setMemoBytes( private java.lang.Object paymentUrl_ = ""; /** - * optional string payment_url = 6; - * *
        * URL to send Payment and get PaymentACK
        * 
+ * + * optional string payment_url = 6; */ public boolean hasPaymentUrl() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** - * optional string payment_url = 6; - * *
        * URL to send Payment and get PaymentACK
        * 
+ * + * optional string payment_url = 6; */ public java.lang.String getPaymentUrl() { java.lang.Object ref = paymentUrl_; @@ -2196,11 +2435,11 @@ public java.lang.String getPaymentUrl() { } } /** - * optional string payment_url = 6; - * *
        * URL to send Payment and get PaymentACK
        * 
+ * + * optional string payment_url = 6; */ public com.google.protobuf.ByteString getPaymentUrlBytes() { @@ -2216,11 +2455,11 @@ public java.lang.String getPaymentUrl() { } } /** - * optional string payment_url = 6; - * *
        * URL to send Payment and get PaymentACK
        * 
+ * + * optional string payment_url = 6; */ public Builder setPaymentUrl( java.lang.String value) { @@ -2233,11 +2472,11 @@ public Builder setPaymentUrl( return this; } /** - * optional string payment_url = 6; - * *
        * URL to send Payment and get PaymentACK
        * 
+ * + * optional string payment_url = 6; */ public Builder clearPaymentUrl() { bitField0_ = (bitField0_ & ~0x00000020); @@ -2246,11 +2485,11 @@ public Builder clearPaymentUrl() { return this; } /** - * optional string payment_url = 6; - * *
        * URL to send Payment and get PaymentACK
        * 
+ * + * optional string payment_url = 6; */ public Builder setPaymentUrlBytes( com.google.protobuf.ByteString value) { @@ -2265,31 +2504,31 @@ public Builder setPaymentUrlBytes( private com.google.protobuf.ByteString merchantData_ = com.google.protobuf.ByteString.EMPTY; /** - * optional bytes merchant_data = 7; - * *
        * Arbitrary data to include in the Payment message
        * 
+ * + * optional bytes merchant_data = 7; */ public boolean hasMerchantData() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** - * optional bytes merchant_data = 7; - * *
        * Arbitrary data to include in the Payment message
        * 
+ * + * optional bytes merchant_data = 7; */ public com.google.protobuf.ByteString getMerchantData() { return merchantData_; } /** - * optional bytes merchant_data = 7; - * *
        * Arbitrary data to include in the Payment message
        * 
+ * + * optional bytes merchant_data = 7; */ public Builder setMerchantData(com.google.protobuf.ByteString value) { if (value == null) { @@ -2301,11 +2540,11 @@ public Builder setMerchantData(com.google.protobuf.ByteString value) { return this; } /** - * optional bytes merchant_data = 7; - * *
        * Arbitrary data to include in the Payment message
        * 
+ * + * optional bytes merchant_data = 7; */ public Builder clearMerchantData() { bitField0_ = (bitField0_ & ~0x00000040); @@ -2313,16 +2552,57 @@ public Builder clearMerchantData() { 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:payments.PaymentDetails) } + // @@protoc_insertion_point(class_scope:payments.PaymentDetails) + private static final org.bitcoin.protocols.payments.Protos.PaymentDetails DEFAULT_INSTANCE; static { - defaultInstance = new PaymentDetails(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.protocols.payments.Protos.PaymentDetails(); + } + + public static org.bitcoin.protocols.payments.Protos.PaymentDetails getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PaymentDetails parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PaymentDetails(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.protocols.payments.Protos.PaymentDetails getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:payments.PaymentDetails) } public interface PaymentRequestOrBuilder extends @@ -2339,116 +2619,115 @@ public interface PaymentRequestOrBuilder extends int getPaymentDetailsVersion(); /** - * optional string pki_type = 2 [default = "none"]; - * *
      * none / x509+sha256 / x509+sha1
      * 
+ * + * optional string pki_type = 2 [default = "none"]; */ boolean hasPkiType(); /** - * optional string pki_type = 2 [default = "none"]; - * *
      * none / x509+sha256 / x509+sha1
      * 
+ * + * optional string pki_type = 2 [default = "none"]; */ java.lang.String getPkiType(); /** - * optional string pki_type = 2 [default = "none"]; - * *
      * none / x509+sha256 / x509+sha1
      * 
+ * + * optional string pki_type = 2 [default = "none"]; */ com.google.protobuf.ByteString getPkiTypeBytes(); /** - * optional bytes pki_data = 3; - * *
      * depends on pki_type
      * 
+ * + * optional bytes pki_data = 3; */ boolean hasPkiData(); /** - * optional bytes pki_data = 3; - * *
      * depends on pki_type
      * 
+ * + * optional bytes pki_data = 3; */ com.google.protobuf.ByteString getPkiData(); /** - * required bytes serialized_payment_details = 4; - * *
      * PaymentDetails
      * 
+ * + * required bytes serialized_payment_details = 4; */ boolean hasSerializedPaymentDetails(); /** - * required bytes serialized_payment_details = 4; - * *
      * PaymentDetails
      * 
+ * + * required bytes serialized_payment_details = 4; */ com.google.protobuf.ByteString getSerializedPaymentDetails(); /** - * optional bytes signature = 5; - * *
      * pki-dependent signature
      * 
+ * + * optional bytes signature = 5; */ boolean hasSignature(); /** - * optional bytes signature = 5; - * *
      * pki-dependent signature
      * 
+ * + * optional bytes signature = 5; */ com.google.protobuf.ByteString getSignature(); } /** * Protobuf type {@code payments.PaymentRequest} */ - public static final class PaymentRequest extends - com.google.protobuf.GeneratedMessage implements + public static final class PaymentRequest extends + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:payments.PaymentRequest) PaymentRequestOrBuilder { + private static final long serialVersionUID = 0L; // Use PaymentRequest.newBuilder() to construct. - private PaymentRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + private PaymentRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); - this.unknownFields = builder.getUnknownFields(); } - private PaymentRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final PaymentRequest defaultInstance; - public static PaymentRequest getDefaultInstance() { - return defaultInstance; - } - - public PaymentRequest getDefaultInstanceForType() { - return defaultInstance; + private PaymentRequest() { + paymentDetailsVersion_ = 1; + pkiType_ = "none"; + pkiData_ = com.google.protobuf.ByteString.EMPTY; + serializedPaymentDetails_ = com.google.protobuf.ByteString.EMPTY; + 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 PaymentRequest( 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(); @@ -2460,13 +2739,6 @@ private PaymentRequest( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 8: { bitField0_ |= 0x00000001; paymentDetailsVersion_ = input.readUInt32(); @@ -2493,13 +2765,20 @@ private PaymentRequest( 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(); @@ -2510,28 +2789,14 @@ private PaymentRequest( return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_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_PaymentRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.protocols.payments.Protos.PaymentRequest.class, org.bitcoin.protocols.payments.Protos.PaymentRequest.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public PaymentRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PaymentRequest(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int PAYMENT_DETAILS_VERSION_FIELD_NUMBER = 1; private int paymentDetailsVersion_; @@ -2549,23 +2814,23 @@ public int getPaymentDetailsVersion() { } public static final int PKI_TYPE_FIELD_NUMBER = 2; - private java.lang.Object pkiType_; + private volatile java.lang.Object pkiType_; /** - * optional string pki_type = 2 [default = "none"]; - * *
      * none / x509+sha256 / x509+sha1
      * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public boolean hasPkiType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional string pki_type = 2 [default = "none"]; - * *
      * none / x509+sha256 / x509+sha1
      * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public java.lang.String getPkiType() { java.lang.Object ref = pkiType_; @@ -2582,11 +2847,11 @@ public java.lang.String getPkiType() { } } /** - * optional string pki_type = 2 [default = "none"]; - * *
      * none / x509+sha256 / x509+sha1
      * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public com.google.protobuf.ByteString getPkiTypeBytes() { @@ -2605,21 +2870,21 @@ public java.lang.String getPkiType() { public static final int PKI_DATA_FIELD_NUMBER = 3; private com.google.protobuf.ByteString pkiData_; /** - * optional bytes pki_data = 3; - * *
      * depends on pki_type
      * 
+ * + * optional bytes pki_data = 3; */ public boolean hasPkiData() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** - * optional bytes pki_data = 3; - * *
      * depends on pki_type
      * 
+ * + * optional bytes pki_data = 3; */ public com.google.protobuf.ByteString getPkiData() { return pkiData_; @@ -2628,21 +2893,21 @@ public com.google.protobuf.ByteString getPkiData() { public static final int SERIALIZED_PAYMENT_DETAILS_FIELD_NUMBER = 4; private com.google.protobuf.ByteString serializedPaymentDetails_; /** - * required bytes serialized_payment_details = 4; - * *
      * PaymentDetails
      * 
+ * + * required bytes serialized_payment_details = 4; */ public boolean hasSerializedPaymentDetails() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** - * required bytes serialized_payment_details = 4; - * *
      * PaymentDetails
      * 
+ * + * required bytes serialized_payment_details = 4; */ public com.google.protobuf.ByteString getSerializedPaymentDetails() { return serializedPaymentDetails_; @@ -2651,34 +2916,28 @@ public com.google.protobuf.ByteString getSerializedPaymentDetails() { public static final int SIGNATURE_FIELD_NUMBER = 5; private com.google.protobuf.ByteString signature_; /** - * optional bytes signature = 5; - * *
      * pki-dependent signature
      * 
+ * + * optional bytes signature = 5; */ public boolean hasSignature() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** - * optional bytes signature = 5; - * *
      * pki-dependent signature
      * 
+ * + * optional bytes signature = 5; */ public com.google.protobuf.ByteString getSignature() { return signature_; } - private void initFields() { - paymentDetailsVersion_ = 1; - pkiType_ = "none"; - pkiData_ = com.google.protobuf.ByteString.EMPTY; - serializedPaymentDetails_ = com.google.protobuf.ByteString.EMPTY; - signature_ = com.google.protobuf.ByteString.EMPTY; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -2692,14 +2951,14 @@ 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.writeUInt32(1, paymentDetailsVersion_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getPkiTypeBytes()); + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, pkiType_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, pkiData_); @@ -2710,12 +2969,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, signature_); } - 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; @@ -2724,8 +2983,7 @@ public int getSerializedSize() { .computeUInt32Size(1, paymentDetailsVersion_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getPkiTypeBytes()); + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, pkiType_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream @@ -2739,18 +2997,94 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, signature_); } - 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.protocols.payments.Protos.PaymentRequest)) { + return super.equals(obj); + } + org.bitcoin.protocols.payments.Protos.PaymentRequest other = (org.bitcoin.protocols.payments.Protos.PaymentRequest) obj; + + boolean result = true; + result = result && (hasPaymentDetailsVersion() == other.hasPaymentDetailsVersion()); + if (hasPaymentDetailsVersion()) { + result = result && (getPaymentDetailsVersion() + == other.getPaymentDetailsVersion()); + } + result = result && (hasPkiType() == other.hasPkiType()); + if (hasPkiType()) { + result = result && getPkiType() + .equals(other.getPkiType()); + } + result = result && (hasPkiData() == other.hasPkiData()); + if (hasPkiData()) { + result = result && getPkiData() + .equals(other.getPkiData()); + } + result = result && (hasSerializedPaymentDetails() == other.hasSerializedPaymentDetails()); + if (hasSerializedPaymentDetails()) { + result = result && getSerializedPaymentDetails() + .equals(other.getSerializedPaymentDetails()); + } + result = result && (hasSignature() == other.hasSignature()); + if (hasSignature()) { + result = result && getSignature() + .equals(other.getSignature()); + } + 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 (hasPaymentDetailsVersion()) { + hash = (37 * hash) + PAYMENT_DETAILS_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getPaymentDetailsVersion(); + } + if (hasPkiType()) { + hash = (37 * hash) + PKI_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getPkiType().hashCode(); + } + if (hasPkiData()) { + hash = (37 * hash) + PKI_DATA_FIELD_NUMBER; + hash = (53 * hash) + getPkiData().hashCode(); + } + if (hasSerializedPaymentDetails()) { + hash = (37 * hash) + SERIALIZED_PAYMENT_DETAILS_FIELD_NUMBER; + hash = (53 * hash) + getSerializedPaymentDetails().hashCode(); + } + if (hasSignature()) { + hash = (37 * hash) + SIGNATURE_FIELD_NUMBER; + hash = (53 * hash) + getSignature().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } + public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -2774,46 +3108,59 @@ public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom( } public static org.bitcoin.protocols.payments.Protos.PaymentRequest 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.protocols.payments.Protos.PaymentRequest 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.protocols.payments.Protos.PaymentRequest 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.protocols.payments.Protos.PaymentRequest 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.protocols.payments.Protos.PaymentRequest 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.protocols.payments.Protos.PaymentRequest 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.protocols.payments.Protos.PaymentRequest 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; } @@ -2821,7 +3168,7 @@ protected Builder newBuilderForType( * Protobuf type {@code payments.PaymentRequest} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:payments.PaymentRequest) org.bitcoin.protocols.payments.Protos.PaymentRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -2829,7 +3176,8 @@ public static final class Builder extends return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_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_PaymentRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -2842,18 +3190,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); paymentDetailsVersion_ = 1; @@ -2869,19 +3215,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_descriptor; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentRequest getDefaultInstanceForType() { return org.bitcoin.protocols.payments.Protos.PaymentRequest.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentRequest build() { org.bitcoin.protocols.payments.Protos.PaymentRequest result = buildPartial(); if (!result.isInitialized()) { @@ -2890,6 +3235,7 @@ public org.bitcoin.protocols.payments.Protos.PaymentRequest build() { return result; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentRequest buildPartial() { org.bitcoin.protocols.payments.Protos.PaymentRequest result = new org.bitcoin.protocols.payments.Protos.PaymentRequest(this); int from_bitField0_ = bitField0_; @@ -2919,6 +3265,39 @@ public org.bitcoin.protocols.payments.Protos.PaymentRequest buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.protocols.payments.Protos.PaymentRequest) { return mergeFrom((org.bitcoin.protocols.payments.Protos.PaymentRequest)other); @@ -2947,18 +3326,20 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentRequest ot if (other.hasSignature()) { setSignature(other.getSignature()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasSerializedPaymentDetails()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -2968,7 +3349,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.PaymentRequest) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -3012,21 +3393,21 @@ public Builder clearPaymentDetailsVersion() { private java.lang.Object pkiType_ = "none"; /** - * optional string pki_type = 2 [default = "none"]; - * *
        * none / x509+sha256 / x509+sha1
        * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public boolean hasPkiType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional string pki_type = 2 [default = "none"]; - * *
        * none / x509+sha256 / x509+sha1
        * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public java.lang.String getPkiType() { java.lang.Object ref = pkiType_; @@ -3043,11 +3424,11 @@ public java.lang.String getPkiType() { } } /** - * optional string pki_type = 2 [default = "none"]; - * *
        * none / x509+sha256 / x509+sha1
        * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public com.google.protobuf.ByteString getPkiTypeBytes() { @@ -3063,11 +3444,11 @@ public java.lang.String getPkiType() { } } /** - * optional string pki_type = 2 [default = "none"]; - * *
        * none / x509+sha256 / x509+sha1
        * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public Builder setPkiType( java.lang.String value) { @@ -3080,11 +3461,11 @@ public Builder setPkiType( return this; } /** - * optional string pki_type = 2 [default = "none"]; - * *
        * none / x509+sha256 / x509+sha1
        * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public Builder clearPkiType() { bitField0_ = (bitField0_ & ~0x00000002); @@ -3093,11 +3474,11 @@ public Builder clearPkiType() { return this; } /** - * optional string pki_type = 2 [default = "none"]; - * *
        * none / x509+sha256 / x509+sha1
        * 
+ * + * optional string pki_type = 2 [default = "none"]; */ public Builder setPkiTypeBytes( com.google.protobuf.ByteString value) { @@ -3112,31 +3493,31 @@ public Builder setPkiTypeBytes( private com.google.protobuf.ByteString pkiData_ = com.google.protobuf.ByteString.EMPTY; /** - * optional bytes pki_data = 3; - * *
        * depends on pki_type
        * 
+ * + * optional bytes pki_data = 3; */ public boolean hasPkiData() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** - * optional bytes pki_data = 3; - * *
        * depends on pki_type
        * 
+ * + * optional bytes pki_data = 3; */ public com.google.protobuf.ByteString getPkiData() { return pkiData_; } /** - * optional bytes pki_data = 3; - * *
        * depends on pki_type
        * 
+ * + * optional bytes pki_data = 3; */ public Builder setPkiData(com.google.protobuf.ByteString value) { if (value == null) { @@ -3148,11 +3529,11 @@ public Builder setPkiData(com.google.protobuf.ByteString value) { return this; } /** - * optional bytes pki_data = 3; - * *
        * depends on pki_type
        * 
+ * + * optional bytes pki_data = 3; */ public Builder clearPkiData() { bitField0_ = (bitField0_ & ~0x00000004); @@ -3163,31 +3544,31 @@ public Builder clearPkiData() { private com.google.protobuf.ByteString serializedPaymentDetails_ = com.google.protobuf.ByteString.EMPTY; /** - * required bytes serialized_payment_details = 4; - * *
        * PaymentDetails
        * 
+ * + * required bytes serialized_payment_details = 4; */ public boolean hasSerializedPaymentDetails() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** - * required bytes serialized_payment_details = 4; - * *
        * PaymentDetails
        * 
+ * + * required bytes serialized_payment_details = 4; */ public com.google.protobuf.ByteString getSerializedPaymentDetails() { return serializedPaymentDetails_; } /** - * required bytes serialized_payment_details = 4; - * *
        * PaymentDetails
        * 
+ * + * required bytes serialized_payment_details = 4; */ public Builder setSerializedPaymentDetails(com.google.protobuf.ByteString value) { if (value == null) { @@ -3199,11 +3580,11 @@ public Builder setSerializedPaymentDetails(com.google.protobuf.ByteString value) return this; } /** - * required bytes serialized_payment_details = 4; - * *
        * PaymentDetails
        * 
+ * + * required bytes serialized_payment_details = 4; */ public Builder clearSerializedPaymentDetails() { bitField0_ = (bitField0_ & ~0x00000008); @@ -3214,31 +3595,31 @@ public Builder clearSerializedPaymentDetails() { private com.google.protobuf.ByteString signature_ = com.google.protobuf.ByteString.EMPTY; /** - * optional bytes signature = 5; - * *
        * pki-dependent signature
        * 
+ * + * optional bytes signature = 5; */ public boolean hasSignature() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** - * optional bytes signature = 5; - * *
        * pki-dependent signature
        * 
+ * + * optional bytes signature = 5; */ public com.google.protobuf.ByteString getSignature() { return signature_; } /** - * optional bytes signature = 5; - * *
        * pki-dependent signature
        * 
+ * + * optional bytes signature = 5; */ public Builder setSignature(com.google.protobuf.ByteString value) { if (value == null) { @@ -3250,11 +3631,11 @@ public Builder setSignature(com.google.protobuf.ByteString value) { return this; } /** - * optional bytes signature = 5; - * *
        * pki-dependent signature
        * 
+ * + * optional bytes signature = 5; */ public Builder clearSignature() { bitField0_ = (bitField0_ & ~0x00000010); @@ -3262,16 +3643,57 @@ public Builder clearSignature() { 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:payments.PaymentRequest) } + // @@protoc_insertion_point(class_scope:payments.PaymentRequest) + private static final org.bitcoin.protocols.payments.Protos.PaymentRequest DEFAULT_INSTANCE; static { - defaultInstance = new PaymentRequest(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.protocols.payments.Protos.PaymentRequest(); + } + + public static org.bitcoin.protocols.payments.Protos.PaymentRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PaymentRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PaymentRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.protocols.payments.Protos.PaymentRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:payments.PaymentRequest) } public interface X509CertificatesOrBuilder extends @@ -3279,64 +3701,59 @@ public interface X509CertificatesOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * repeated bytes certificate = 1; - * *
      * DER-encoded X.509 certificate chain
      * 
+ * + * repeated bytes certificate = 1; */ java.util.List getCertificateList(); /** - * repeated bytes certificate = 1; - * *
      * DER-encoded X.509 certificate chain
      * 
+ * + * repeated bytes certificate = 1; */ int getCertificateCount(); /** - * repeated bytes certificate = 1; - * *
      * DER-encoded X.509 certificate chain
      * 
+ * + * repeated bytes certificate = 1; */ com.google.protobuf.ByteString getCertificate(int index); } /** * Protobuf type {@code payments.X509Certificates} */ - public static final class X509Certificates extends - com.google.protobuf.GeneratedMessage implements + public static final class X509Certificates extends + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:payments.X509Certificates) X509CertificatesOrBuilder { + private static final long serialVersionUID = 0L; // Use X509Certificates.newBuilder() to construct. - private X509Certificates(com.google.protobuf.GeneratedMessage.Builder builder) { + private X509Certificates(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private X509Certificates(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final X509Certificates defaultInstance; - public static X509Certificates getDefaultInstance() { - return defaultInstance; } - - public X509Certificates getDefaultInstanceForType() { - return defaultInstance; + private X509Certificates() { + certificate_ = java.util.Collections.emptyList(); } - private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { + getUnknownFields() { return this.unknownFields; } private X509Certificates( 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(); @@ -3348,13 +3765,6 @@ private X509Certificates( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { certificate_ = new java.util.ArrayList(); @@ -3363,13 +3773,20 @@ private X509Certificates( certificate_.add(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 { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { certificate_ = java.util.Collections.unmodifiableList(certificate_); @@ -3383,66 +3800,50 @@ private X509Certificates( return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_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_X509Certificates_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.protocols.payments.Protos.X509Certificates.class, org.bitcoin.protocols.payments.Protos.X509Certificates.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public X509Certificates parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new X509Certificates(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - public static final int CERTIFICATE_FIELD_NUMBER = 1; private java.util.List certificate_; /** - * repeated bytes certificate = 1; - * *
      * DER-encoded X.509 certificate chain
      * 
+ * + * repeated bytes certificate = 1; */ public java.util.List getCertificateList() { return certificate_; } /** - * repeated bytes certificate = 1; - * *
      * DER-encoded X.509 certificate chain
      * 
+ * + * repeated bytes certificate = 1; */ public int getCertificateCount() { return certificate_.size(); } /** - * repeated bytes certificate = 1; - * *
      * DER-encoded X.509 certificate chain
      * 
+ * + * repeated bytes certificate = 1; */ public com.google.protobuf.ByteString getCertificate(int index) { return certificate_.get(index); } - private void initFields() { - certificate_ = java.util.Collections.emptyList(); - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -3452,18 +3853,18 @@ 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 < certificate_.size(); i++) { output.writeBytes(1, certificate_.get(i)); } - 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; @@ -3476,18 +3877,55 @@ public int getSerializedSize() { size += dataSize; size += 1 * getCertificateList().size(); } - 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.protocols.payments.Protos.X509Certificates)) { + return super.equals(obj); + } + org.bitcoin.protocols.payments.Protos.X509Certificates other = (org.bitcoin.protocols.payments.Protos.X509Certificates) obj; + + boolean result = true; + result = result && getCertificateList() + .equals(other.getCertificateList()); + 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 (getCertificateCount() > 0) { + hash = (37 * hash) + CERTIFICATE_FIELD_NUMBER; + hash = (53 * hash) + getCertificateList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } + public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -3511,46 +3949,59 @@ public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom( } public static org.bitcoin.protocols.payments.Protos.X509Certificates 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.protocols.payments.Protos.X509Certificates 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.protocols.payments.Protos.X509Certificates 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.protocols.payments.Protos.X509Certificates 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.protocols.payments.Protos.X509Certificates 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.protocols.payments.Protos.X509Certificates 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.protocols.payments.Protos.X509Certificates 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; } @@ -3558,7 +4009,7 @@ protected Builder newBuilderForType( * Protobuf type {@code payments.X509Certificates} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:payments.X509Certificates) org.bitcoin.protocols.payments.Protos.X509CertificatesOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -3566,7 +4017,8 @@ public static final class Builder extends return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_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_X509Certificates_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -3579,18 +4031,16 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); certificate_ = java.util.Collections.emptyList(); @@ -3598,19 +4048,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_descriptor; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.X509Certificates getDefaultInstanceForType() { return org.bitcoin.protocols.payments.Protos.X509Certificates.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.X509Certificates build() { org.bitcoin.protocols.payments.Protos.X509Certificates result = buildPartial(); if (!result.isInitialized()) { @@ -3619,6 +4068,7 @@ public org.bitcoin.protocols.payments.Protos.X509Certificates build() { return result; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.X509Certificates buildPartial() { org.bitcoin.protocols.payments.Protos.X509Certificates result = new org.bitcoin.protocols.payments.Protos.X509Certificates(this); int from_bitField0_ = bitField0_; @@ -3631,6 +4081,39 @@ public org.bitcoin.protocols.payments.Protos.X509Certificates buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.protocols.payments.Protos.X509Certificates) { return mergeFrom((org.bitcoin.protocols.payments.Protos.X509Certificates)other); @@ -3652,14 +4135,17 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.X509Certificates } onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -3669,7 +4155,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.X509Certificates) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -3687,42 +4173,42 @@ private void ensureCertificateIsMutable() { } } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public java.util.List getCertificateList() { return java.util.Collections.unmodifiableList(certificate_); } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public int getCertificateCount() { return certificate_.size(); } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public com.google.protobuf.ByteString getCertificate(int index) { return certificate_.get(index); } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public Builder setCertificate( int index, com.google.protobuf.ByteString value) { @@ -3735,11 +4221,11 @@ public Builder setCertificate( return this; } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public Builder addCertificate(com.google.protobuf.ByteString value) { if (value == null) { @@ -3751,11 +4237,11 @@ public Builder addCertificate(com.google.protobuf.ByteString value) { return this; } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public Builder addAllCertificate( java.lang.Iterable values) { @@ -3766,11 +4252,11 @@ public Builder addAllCertificate( return this; } /** - * repeated bytes certificate = 1; - * *
        * DER-encoded X.509 certificate chain
        * 
+ * + * repeated bytes certificate = 1; */ public Builder clearCertificate() { certificate_ = java.util.Collections.emptyList(); @@ -3778,16 +4264,57 @@ public Builder clearCertificate() { 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:payments.X509Certificates) } + // @@protoc_insertion_point(class_scope:payments.X509Certificates) + private static final org.bitcoin.protocols.payments.Protos.X509Certificates DEFAULT_INSTANCE; static { - defaultInstance = new X509Certificates(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.protocols.payments.Protos.X509Certificates(); + } + + public static org.bitcoin.protocols.payments.Protos.X509Certificates getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public X509Certificates parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new X509Certificates(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.protocols.payments.Protos.X509Certificates getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:payments.X509Certificates) } public interface PaymentOrBuilder extends @@ -3795,113 +4322,113 @@ public interface PaymentOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * optional bytes merchant_data = 1; - * *
      * From PaymentDetails.merchant_data
      * 
+ * + * optional bytes merchant_data = 1; */ boolean hasMerchantData(); /** - * optional bytes merchant_data = 1; - * *
      * From PaymentDetails.merchant_data
      * 
+ * + * optional bytes merchant_data = 1; */ com.google.protobuf.ByteString getMerchantData(); /** - * repeated bytes transactions = 2; - * *
      * Signed transactions that satisfy PaymentDetails.outputs
      * 
+ * + * repeated bytes transactions = 2; */ java.util.List getTransactionsList(); /** - * repeated bytes transactions = 2; - * *
      * Signed transactions that satisfy PaymentDetails.outputs
      * 
+ * + * repeated bytes transactions = 2; */ int getTransactionsCount(); /** - * repeated bytes transactions = 2; - * *
      * Signed transactions that satisfy PaymentDetails.outputs
      * 
+ * + * repeated bytes transactions = 2; */ com.google.protobuf.ByteString getTransactions(int index); /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ java.util.List getRefundToList(); /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index); /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ int getRefundToCount(); /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ java.util.List getRefundToOrBuilderList(); /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder( int index); /** - * optional string memo = 4; - * *
      * Human-readable message for the merchant
      * 
+ * + * optional string memo = 4; */ boolean hasMemo(); /** - * optional string memo = 4; - * *
      * Human-readable message for the merchant
      * 
+ * + * optional string memo = 4; */ java.lang.String getMemo(); /** - * optional string memo = 4; - * *
      * Human-readable message for the merchant
      * 
+ * + * optional string memo = 4; */ com.google.protobuf.ByteString getMemoBytes(); @@ -3909,37 +4436,35 @@ org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder( /** * Protobuf type {@code payments.Payment} */ - public static final class Payment extends - com.google.protobuf.GeneratedMessage implements + public static final class Payment extends + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:payments.Payment) PaymentOrBuilder { + private static final long serialVersionUID = 0L; // Use Payment.newBuilder() to construct. - private Payment(com.google.protobuf.GeneratedMessage.Builder builder) { + private Payment(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); - this.unknownFields = builder.getUnknownFields(); } - private Payment(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Payment defaultInstance; - public static Payment getDefaultInstance() { - return defaultInstance; - } - - public Payment getDefaultInstanceForType() { - return defaultInstance; + private Payment() { + merchantData_ = com.google.protobuf.ByteString.EMPTY; + transactions_ = java.util.Collections.emptyList(); + refundTo_ = java.util.Collections.emptyList(); + memo_ = ""; } - private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { + getUnknownFields() { return this.unknownFields; } private Payment( 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(); @@ -3951,13 +4476,6 @@ private Payment( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 10: { bitField0_ |= 0x00000001; merchantData_ = input.readBytes(); @@ -3976,7 +4494,8 @@ private Payment( refundTo_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } - refundTo_.add(input.readMessage(org.bitcoin.protocols.payments.Protos.Output.PARSER, extensionRegistry)); + refundTo_.add( + input.readMessage(org.bitcoin.protocols.payments.Protos.Output.PARSER, extensionRegistry)); break; } case 34: { @@ -3985,13 +4504,20 @@ private Payment( memo_ = bs; 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 { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { transactions_ = java.util.Collections.unmodifiableList(transactions_); @@ -4008,47 +4534,33 @@ private Payment( return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_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_Payment_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.protocols.payments.Protos.Payment.class, org.bitcoin.protocols.payments.Protos.Payment.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Payment parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Payment(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int MERCHANT_DATA_FIELD_NUMBER = 1; private com.google.protobuf.ByteString merchantData_; /** - * optional bytes merchant_data = 1; - * *
      * From PaymentDetails.merchant_data
      * 
+ * + * optional bytes merchant_data = 1; */ public boolean hasMerchantData() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional bytes merchant_data = 1; - * *
      * From PaymentDetails.merchant_data
      * 
+ * + * optional bytes merchant_data = 1; */ public com.google.protobuf.ByteString getMerchantData() { return merchantData_; @@ -4057,32 +4569,32 @@ public com.google.protobuf.ByteString getMerchantData() { public static final int TRANSACTIONS_FIELD_NUMBER = 2; private java.util.List transactions_; /** - * repeated bytes transactions = 2; - * *
      * Signed transactions that satisfy PaymentDetails.outputs
      * 
+ * + * repeated bytes transactions = 2; */ public java.util.List getTransactionsList() { return transactions_; } /** - * repeated bytes transactions = 2; - * *
      * Signed transactions that satisfy PaymentDetails.outputs
      * 
+ * + * repeated bytes transactions = 2; */ public int getTransactionsCount() { return transactions_.size(); } /** - * repeated bytes transactions = 2; - * *
      * Signed transactions that satisfy PaymentDetails.outputs
      * 
+ * + * repeated bytes transactions = 2; */ public com.google.protobuf.ByteString getTransactions(int index) { return transactions_.get(index); @@ -4091,52 +4603,52 @@ public com.google.protobuf.ByteString getTransactions(int index) { public static final int REFUND_TO_FIELD_NUMBER = 3; private java.util.List refundTo_; /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ public java.util.List getRefundToList() { return refundTo_; } /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ public java.util.List getRefundToOrBuilderList() { return refundTo_; } /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ public int getRefundToCount() { return refundTo_.size(); } /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index) { return refundTo_.get(index); } /** - * repeated .payments.Output refund_to = 3; - * *
      * Where to send refunds, if a refund is necessary
      * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder( int index) { @@ -4144,23 +4656,23 @@ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilde } public static final int MEMO_FIELD_NUMBER = 4; - private java.lang.Object memo_; + private volatile java.lang.Object memo_; /** - * optional string memo = 4; - * *
      * Human-readable message for the merchant
      * 
+ * + * optional string memo = 4; */ public boolean hasMemo() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional string memo = 4; - * *
      * Human-readable message for the merchant
      * 
+ * + * optional string memo = 4; */ public java.lang.String getMemo() { java.lang.Object ref = memo_; @@ -4177,11 +4689,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 4; - * *
      * Human-readable message for the merchant
      * 
+ * + * optional string memo = 4; */ public com.google.protobuf.ByteString getMemoBytes() { @@ -4197,13 +4709,8 @@ public java.lang.String getMemo() { } } - private void initFields() { - merchantData_ = com.google.protobuf.ByteString.EMPTY; - transactions_ = java.util.Collections.emptyList(); - refundTo_ = java.util.Collections.emptyList(); - memo_ = ""; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -4219,9 +4726,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, merchantData_); } @@ -4232,14 +4739,14 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) output.writeMessage(3, refundTo_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(4, getMemoBytes()); + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, memo_); } - 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; @@ -4261,21 +4768,81 @@ public int getSerializedSize() { .computeMessageSize(3, refundTo_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, getMemoBytes()); + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, memo_); } - 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.protocols.payments.Protos.Payment)) { + return super.equals(obj); + } + org.bitcoin.protocols.payments.Protos.Payment other = (org.bitcoin.protocols.payments.Protos.Payment) obj; + + boolean result = true; + result = result && (hasMerchantData() == other.hasMerchantData()); + if (hasMerchantData()) { + result = result && getMerchantData() + .equals(other.getMerchantData()); + } + result = result && getTransactionsList() + .equals(other.getTransactionsList()); + result = result && getRefundToList() + .equals(other.getRefundToList()); + result = result && (hasMemo() == other.hasMemo()); + if (hasMemo()) { + result = result && getMemo() + .equals(other.getMemo()); + } + 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 (hasMerchantData()) { + hash = (37 * hash) + MERCHANT_DATA_FIELD_NUMBER; + hash = (53 * hash) + getMerchantData().hashCode(); + } + if (getTransactionsCount() > 0) { + hash = (37 * hash) + TRANSACTIONS_FIELD_NUMBER; + hash = (53 * hash) + getTransactionsList().hashCode(); + } + if (getRefundToCount() > 0) { + hash = (37 * hash) + REFUND_TO_FIELD_NUMBER; + hash = (53 * hash) + getRefundToList().hashCode(); + } + if (hasMemo()) { + hash = (37 * hash) + MEMO_FIELD_NUMBER; + hash = (53 * hash) + getMemo().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } + public static org.bitcoin.protocols.payments.Protos.Payment parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.protocols.payments.Protos.Payment parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.bitcoin.protocols.payments.Protos.Payment parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -4299,46 +4866,59 @@ public static org.bitcoin.protocols.payments.Protos.Payment parseFrom( } public static org.bitcoin.protocols.payments.Protos.Payment 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.protocols.payments.Protos.Payment 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.protocols.payments.Protos.Payment 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.protocols.payments.Protos.Payment 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.protocols.payments.Protos.Payment 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.protocols.payments.Protos.Payment 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.protocols.payments.Protos.Payment 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; } @@ -4346,7 +4926,7 @@ protected Builder newBuilderForType( * Protobuf type {@code payments.Payment} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:payments.Payment) org.bitcoin.protocols.payments.Protos.PaymentOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -4354,7 +4934,8 @@ public static final class Builder extends return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_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_Payment_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -4367,19 +4948,17 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { getRefundToFieldBuilder(); } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); merchantData_ = com.google.protobuf.ByteString.EMPTY; @@ -4397,19 +4976,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_descriptor; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.Payment getDefaultInstanceForType() { return org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.Payment build() { org.bitcoin.protocols.payments.Protos.Payment result = buildPartial(); if (!result.isInitialized()) { @@ -4418,6 +4996,7 @@ public org.bitcoin.protocols.payments.Protos.Payment build() { return result; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.Payment buildPartial() { org.bitcoin.protocols.payments.Protos.Payment result = new org.bitcoin.protocols.payments.Protos.Payment(this); int from_bitField0_ = bitField0_; @@ -4449,6 +5028,39 @@ public org.bitcoin.protocols.payments.Protos.Payment buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.protocols.payments.Protos.Payment) { return mergeFrom((org.bitcoin.protocols.payments.Protos.Payment)other); @@ -4492,7 +5104,7 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.Payment other) { refundTo_ = other.refundTo_; bitField0_ = (bitField0_ & ~0x00000004); refundToBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getRefundToFieldBuilder() : null; } else { refundToBuilder_.addAllMessages(other.refundTo_); @@ -4504,20 +5116,22 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.Payment other) { memo_ = other.memo_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { for (int i = 0; i < getRefundToCount(); i++) { if (!getRefundTo(i).isInitialized()) { - return false; } } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -4527,7 +5141,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.Payment) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -4539,31 +5153,31 @@ public Builder mergeFrom( private com.google.protobuf.ByteString merchantData_ = com.google.protobuf.ByteString.EMPTY; /** - * optional bytes merchant_data = 1; - * *
        * From PaymentDetails.merchant_data
        * 
+ * + * optional bytes merchant_data = 1; */ public boolean hasMerchantData() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional bytes merchant_data = 1; - * *
        * From PaymentDetails.merchant_data
        * 
+ * + * optional bytes merchant_data = 1; */ public com.google.protobuf.ByteString getMerchantData() { return merchantData_; } /** - * optional bytes merchant_data = 1; - * *
        * From PaymentDetails.merchant_data
        * 
+ * + * optional bytes merchant_data = 1; */ public Builder setMerchantData(com.google.protobuf.ByteString value) { if (value == null) { @@ -4575,11 +5189,11 @@ public Builder setMerchantData(com.google.protobuf.ByteString value) { return this; } /** - * optional bytes merchant_data = 1; - * *
        * From PaymentDetails.merchant_data
        * 
+ * + * optional bytes merchant_data = 1; */ public Builder clearMerchantData() { bitField0_ = (bitField0_ & ~0x00000001); @@ -4596,42 +5210,42 @@ private void ensureTransactionsIsMutable() { } } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public java.util.List getTransactionsList() { return java.util.Collections.unmodifiableList(transactions_); } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public int getTransactionsCount() { return transactions_.size(); } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public com.google.protobuf.ByteString getTransactions(int index) { return transactions_.get(index); } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public Builder setTransactions( int index, com.google.protobuf.ByteString value) { @@ -4644,11 +5258,11 @@ public Builder setTransactions( return this; } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public Builder addTransactions(com.google.protobuf.ByteString value) { if (value == null) { @@ -4660,11 +5274,11 @@ public Builder addTransactions(com.google.protobuf.ByteString value) { return this; } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public Builder addAllTransactions( java.lang.Iterable values) { @@ -4675,11 +5289,11 @@ public Builder addAllTransactions( return this; } /** - * repeated bytes transactions = 2; - * *
        * Signed transactions that satisfy PaymentDetails.outputs
        * 
+ * + * repeated bytes transactions = 2; */ public Builder clearTransactions() { transactions_ = java.util.Collections.emptyList(); @@ -4697,15 +5311,15 @@ private void ensureRefundToIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilder< + private com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> refundToBuilder_; /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public java.util.List getRefundToList() { if (refundToBuilder_ == null) { @@ -4715,11 +5329,11 @@ public java.util.List getRefundToL } } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public int getRefundToCount() { if (refundToBuilder_ == null) { @@ -4729,11 +5343,11 @@ public int getRefundToCount() { } } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index) { if (refundToBuilder_ == null) { @@ -4743,11 +5357,11 @@ public org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index) { } } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder setRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output value) { @@ -4764,11 +5378,11 @@ public Builder setRefundTo( return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder setRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { @@ -4782,11 +5396,11 @@ public Builder setRefundTo( return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder addRefundTo(org.bitcoin.protocols.payments.Protos.Output value) { if (refundToBuilder_ == null) { @@ -4802,11 +5416,11 @@ public Builder addRefundTo(org.bitcoin.protocols.payments.Protos.Output value) { return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder addRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output value) { @@ -4823,11 +5437,11 @@ public Builder addRefundTo( return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder addRefundTo( org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { @@ -4841,11 +5455,11 @@ public Builder addRefundTo( return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder addRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { @@ -4859,11 +5473,11 @@ public Builder addRefundTo( return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder addAllRefundTo( java.lang.Iterable values) { @@ -4878,11 +5492,11 @@ public Builder addAllRefundTo( return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder clearRefundTo() { if (refundToBuilder_ == null) { @@ -4895,11 +5509,11 @@ public Builder clearRefundTo() { return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public Builder removeRefundTo(int index) { if (refundToBuilder_ == null) { @@ -4912,22 +5526,22 @@ public Builder removeRefundTo(int index) { return this; } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.Output.Builder getRefundToBuilder( int index) { return getRefundToFieldBuilder().getBuilder(index); } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder( int index) { @@ -4937,11 +5551,11 @@ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilde } } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public java.util.List getRefundToOrBuilderList() { @@ -4952,22 +5566,22 @@ public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilde } } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.Output.Builder addRefundToBuilder() { return getRefundToFieldBuilder().addBuilder( org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance()); } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public org.bitcoin.protocols.payments.Protos.Output.Builder addRefundToBuilder( int index) { @@ -4975,21 +5589,21 @@ public org.bitcoin.protocols.payments.Protos.Output.Builder addRefundToBuilder( index, org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance()); } /** - * repeated .payments.Output refund_to = 3; - * *
        * Where to send refunds, if a refund is necessary
        * 
+ * + * repeated .payments.Output refund_to = 3; */ public java.util.List getRefundToBuilderList() { return getRefundToFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilder< + private com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> getRefundToFieldBuilder() { if (refundToBuilder_ == null) { - refundToBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + refundToBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder>( refundTo_, ((bitField0_ & 0x00000004) == 0x00000004), @@ -5002,21 +5616,21 @@ public org.bitcoin.protocols.payments.Protos.Output.Builder addRefundToBuilder( private java.lang.Object memo_ = ""; /** - * optional string memo = 4; - * *
        * Human-readable message for the merchant
        * 
+ * + * optional string memo = 4; */ public boolean hasMemo() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** - * optional string memo = 4; - * *
        * Human-readable message for the merchant
        * 
+ * + * optional string memo = 4; */ public java.lang.String getMemo() { java.lang.Object ref = memo_; @@ -5033,11 +5647,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 4; - * *
        * Human-readable message for the merchant
        * 
+ * + * optional string memo = 4; */ public com.google.protobuf.ByteString getMemoBytes() { @@ -5053,11 +5667,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 4; - * *
        * Human-readable message for the merchant
        * 
+ * + * optional string memo = 4; */ public Builder setMemo( java.lang.String value) { @@ -5070,11 +5684,11 @@ public Builder setMemo( return this; } /** - * optional string memo = 4; - * *
        * Human-readable message for the merchant
        * 
+ * + * optional string memo = 4; */ public Builder clearMemo() { bitField0_ = (bitField0_ & ~0x00000008); @@ -5083,11 +5697,11 @@ public Builder clearMemo() { return this; } /** - * optional string memo = 4; - * *
        * Human-readable message for the merchant
        * 
+ * + * optional string memo = 4; */ public Builder setMemoBytes( com.google.protobuf.ByteString value) { @@ -5099,16 +5713,57 @@ public Builder setMemoBytes( 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:payments.Payment) } + // @@protoc_insertion_point(class_scope:payments.Payment) + private static final org.bitcoin.protocols.payments.Protos.Payment DEFAULT_INSTANCE; static { - defaultInstance = new Payment(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.protocols.payments.Protos.Payment(); + } + + public static org.bitcoin.protocols.payments.Protos.Payment getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Payment parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Payment(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.protocols.payments.Protos.Payment getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:payments.Payment) } public interface PaymentACKOrBuilder extends @@ -5116,52 +5771,52 @@ public interface PaymentACKOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * required .payments.Payment payment = 1; - * *
      * Payment message that triggered this ACK
      * 
+ * + * required .payments.Payment payment = 1; */ boolean hasPayment(); /** - * required .payments.Payment payment = 1; - * *
      * Payment message that triggered this ACK
      * 
+ * + * required .payments.Payment payment = 1; */ org.bitcoin.protocols.payments.Protos.Payment getPayment(); /** - * required .payments.Payment payment = 1; - * *
      * Payment message that triggered this ACK
      * 
+ * + * required .payments.Payment payment = 1; */ org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilder(); /** - * optional string memo = 2; - * *
      * human-readable message for customer
      * 
+ * + * optional string memo = 2; */ boolean hasMemo(); /** - * optional string memo = 2; - * *
      * human-readable message for customer
      * 
+ * + * optional string memo = 2; */ java.lang.String getMemo(); /** - * optional string memo = 2; - * *
      * human-readable message for customer
      * 
+ * + * optional string memo = 2; */ com.google.protobuf.ByteString getMemoBytes(); @@ -5169,37 +5824,32 @@ public interface PaymentACKOrBuilder extends /** * Protobuf type {@code payments.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:payments.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() { + memo_ = ""; } - 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(); @@ -5211,13 +5861,6 @@ private PaymentACK( case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } case 10: { org.bitcoin.protocols.payments.Protos.Payment.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { @@ -5237,13 +5880,20 @@ private PaymentACK( memo_ = bs; 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(); @@ -5254,80 +5904,66 @@ private PaymentACK( return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_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_PaymentACK_fieldAccessorTable .ensureFieldAccessorsInitialized( org.bitcoin.protocols.payments.Protos.PaymentACK.class, org.bitcoin.protocols.payments.Protos.PaymentACK.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public PaymentACK parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PaymentACK(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - private int bitField0_; public static final int PAYMENT_FIELD_NUMBER = 1; private org.bitcoin.protocols.payments.Protos.Payment payment_; /** - * required .payments.Payment payment = 1; - * *
      * Payment message that triggered this ACK
      * 
+ * + * required .payments.Payment payment = 1; */ public boolean hasPayment() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required .payments.Payment payment = 1; - * *
      * Payment message that triggered this ACK
      * 
+ * + * required .payments.Payment payment = 1; */ public org.bitcoin.protocols.payments.Protos.Payment getPayment() { - return payment_; + return payment_ == null ? org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance() : payment_; } /** - * required .payments.Payment payment = 1; - * *
      * Payment message that triggered this ACK
      * 
+ * + * required .payments.Payment payment = 1; */ public org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilder() { - return payment_; + return payment_ == null ? org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance() : payment_; } public static final int MEMO_FIELD_NUMBER = 2; - private java.lang.Object memo_; + private volatile java.lang.Object memo_; /** - * optional string memo = 2; - * *
      * human-readable message for customer
      * 
+ * + * optional string memo = 2; */ public boolean hasMemo() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional string memo = 2; - * *
      * human-readable message for customer
      * 
+ * + * optional string memo = 2; */ public java.lang.String getMemo() { java.lang.Object ref = memo_; @@ -5344,11 +5980,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 2; - * *
      * human-readable message for customer
      * 
+ * + * optional string memo = 2; */ public com.google.protobuf.ByteString getMemoBytes() { @@ -5364,11 +6000,8 @@ public java.lang.String getMemo() { } } - private void initFields() { - payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance(); - memo_ = ""; - } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -5386,44 +6019,92 @@ 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.writeMessage(1, payment_); + output.writeMessage(1, getPayment()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getMemoBytes()); + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, memo_); } - 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 - .computeMessageSize(1, payment_); + .computeMessageSize(1, getPayment()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getMemoBytes()); + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, memo_); } - 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.protocols.payments.Protos.PaymentACK)) { + return super.equals(obj); + } + org.bitcoin.protocols.payments.Protos.PaymentACK other = (org.bitcoin.protocols.payments.Protos.PaymentACK) obj; + + boolean result = true; + result = result && (hasPayment() == other.hasPayment()); + if (hasPayment()) { + result = result && getPayment() + .equals(other.getPayment()); + } + result = result && (hasMemo() == other.hasMemo()); + if (hasMemo()) { + result = result && getMemo() + .equals(other.getMemo()); + } + 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 (hasPayment()) { + hash = (37 * hash) + PAYMENT_FIELD_NUMBER; + hash = (53 * hash) + getPayment().hashCode(); + } + if (hasMemo()) { + hash = (37 * hash) + MEMO_FIELD_NUMBER; + hash = (53 * hash) + getMemo().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } + public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.bitcoin.protocols.payments.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.protocols.payments.Protos.PaymentACK parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -5447,46 +6128,59 @@ public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom( } public static org.bitcoin.protocols.payments.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.protocols.payments.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.protocols.payments.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.protocols.payments.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.protocols.payments.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.protocols.payments.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.protocols.payments.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; } @@ -5494,7 +6188,7 @@ protected Builder newBuilderForType( * Protobuf type {@code payments.PaymentACK} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:payments.PaymentACK) org.bitcoin.protocols.payments.Protos.PaymentACKOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -5502,7 +6196,8 @@ public static final class Builder extends return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_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_PaymentACK_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -5515,23 +6210,21 @@ private Builder() { } private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { getPaymentFieldBuilder(); } } - private static Builder create() { - return new Builder(); - } - + @java.lang.Override public Builder clear() { super.clear(); if (paymentBuilder_ == null) { - payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance(); + payment_ = null; } else { paymentBuilder_.clear(); } @@ -5541,19 +6234,18 @@ public Builder clear() { return this; } - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_descriptor; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentACK getDefaultInstanceForType() { return org.bitcoin.protocols.payments.Protos.PaymentACK.getDefaultInstance(); } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentACK build() { org.bitcoin.protocols.payments.Protos.PaymentACK result = buildPartial(); if (!result.isInitialized()) { @@ -5562,6 +6254,7 @@ public org.bitcoin.protocols.payments.Protos.PaymentACK build() { return result; } + @java.lang.Override public org.bitcoin.protocols.payments.Protos.PaymentACK buildPartial() { org.bitcoin.protocols.payments.Protos.PaymentACK result = new org.bitcoin.protocols.payments.Protos.PaymentACK(this); int from_bitField0_ = bitField0_; @@ -5583,6 +6276,39 @@ public org.bitcoin.protocols.payments.Protos.PaymentACK buildPartial() { return result; } + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.bitcoin.protocols.payments.Protos.PaymentACK) { return mergeFrom((org.bitcoin.protocols.payments.Protos.PaymentACK)other); @@ -5602,22 +6328,23 @@ public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentACK other) memo_ = other.memo_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasPayment()) { - return false; } if (!getPayment().isInitialized()) { - return false; } return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -5627,7 +6354,7 @@ public Builder mergeFrom( parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.PaymentACK) e.getUnfinishedMessage(); - throw e; + throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); @@ -5637,39 +6364,39 @@ public Builder mergeFrom( } private int bitField0_; - private org.bitcoin.protocols.payments.Protos.Payment payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< + private org.bitcoin.protocols.payments.Protos.Payment payment_ = null; + private com.google.protobuf.SingleFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Payment, org.bitcoin.protocols.payments.Protos.Payment.Builder, org.bitcoin.protocols.payments.Protos.PaymentOrBuilder> paymentBuilder_; /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public boolean hasPayment() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public org.bitcoin.protocols.payments.Protos.Payment getPayment() { if (paymentBuilder_ == null) { - return payment_; + return payment_ == null ? org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance() : payment_; } else { return paymentBuilder_.getMessage(); } } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public Builder setPayment(org.bitcoin.protocols.payments.Protos.Payment value) { if (paymentBuilder_ == null) { @@ -5685,11 +6412,11 @@ public Builder setPayment(org.bitcoin.protocols.payments.Protos.Payment value) { return this; } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public Builder setPayment( org.bitcoin.protocols.payments.Protos.Payment.Builder builderForValue) { @@ -5703,15 +6430,16 @@ public Builder setPayment( return this; } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public Builder mergePayment(org.bitcoin.protocols.payments.Protos.Payment value) { if (paymentBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && + payment_ != null && payment_ != org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance()) { payment_ = org.bitcoin.protocols.payments.Protos.Payment.newBuilder(payment_).mergeFrom(value).buildPartial(); @@ -5726,15 +6454,15 @@ public Builder mergePayment(org.bitcoin.protocols.payments.Protos.Payment value) return this; } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public Builder clearPayment() { if (paymentBuilder_ == null) { - payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance(); + payment_ = null; onChanged(); } else { paymentBuilder_.clear(); @@ -5743,11 +6471,11 @@ public Builder clearPayment() { return this; } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public org.bitcoin.protocols.payments.Protos.Payment.Builder getPaymentBuilder() { bitField0_ |= 0x00000001; @@ -5755,31 +6483,32 @@ public org.bitcoin.protocols.payments.Protos.Payment.Builder getPaymentBuilder() return getPaymentFieldBuilder().getBuilder(); } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ public org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilder() { if (paymentBuilder_ != null) { return paymentBuilder_.getMessageOrBuilder(); } else { - return payment_; + return payment_ == null ? + org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance() : payment_; } } /** - * required .payments.Payment payment = 1; - * *
        * Payment message that triggered this ACK
        * 
+ * + * required .payments.Payment payment = 1; */ - private com.google.protobuf.SingleFieldBuilder< + private com.google.protobuf.SingleFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Payment, org.bitcoin.protocols.payments.Protos.Payment.Builder, org.bitcoin.protocols.payments.Protos.PaymentOrBuilder> getPaymentFieldBuilder() { if (paymentBuilder_ == null) { - paymentBuilder_ = new com.google.protobuf.SingleFieldBuilder< + paymentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< org.bitcoin.protocols.payments.Protos.Payment, org.bitcoin.protocols.payments.Protos.Payment.Builder, org.bitcoin.protocols.payments.Protos.PaymentOrBuilder>( getPayment(), getParentForChildren(), @@ -5791,21 +6520,21 @@ public org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilde private java.lang.Object memo_ = ""; /** - * optional string memo = 2; - * *
        * human-readable message for customer
        * 
+ * + * optional string memo = 2; */ public boolean hasMemo() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional string memo = 2; - * *
        * human-readable message for customer
        * 
+ * + * optional string memo = 2; */ public java.lang.String getMemo() { java.lang.Object ref = memo_; @@ -5822,11 +6551,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 2; - * *
        * human-readable message for customer
        * 
+ * + * optional string memo = 2; */ public com.google.protobuf.ByteString getMemoBytes() { @@ -5842,11 +6571,11 @@ public java.lang.String getMemo() { } } /** - * optional string memo = 2; - * *
        * human-readable message for customer
        * 
+ * + * optional string memo = 2; */ public Builder setMemo( java.lang.String value) { @@ -5859,11 +6588,11 @@ public Builder setMemo( return this; } /** - * optional string memo = 2; - * *
        * human-readable message for customer
        * 
+ * + * optional string memo = 2; */ public Builder clearMemo() { bitField0_ = (bitField0_ & ~0x00000002); @@ -5872,11 +6601,11 @@ public Builder clearMemo() { return this; } /** - * optional string memo = 2; - * *
        * human-readable message for customer
        * 
+ * + * optional string memo = 2; */ public Builder setMemoBytes( com.google.protobuf.ByteString value) { @@ -5888,54 +6617,95 @@ public Builder setMemoBytes( 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:payments.PaymentACK) } + // @@protoc_insertion_point(class_scope:payments.PaymentACK) + private static final org.bitcoin.protocols.payments.Protos.PaymentACK DEFAULT_INSTANCE; static { - defaultInstance = new PaymentACK(true); - defaultInstance.initFields(); + DEFAULT_INSTANCE = new org.bitcoin.protocols.payments.Protos.PaymentACK(); + } + + public static org.bitcoin.protocols.payments.Protos.PaymentACK getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PaymentACK parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PaymentACK(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.bitcoin.protocols.payments.Protos.PaymentACK getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - // @@protoc_insertion_point(class_scope:payments.PaymentACK) } private static final com.google.protobuf.Descriptors.Descriptor internal_static_payments_Output_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_payments_Output_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_payments_PaymentDetails_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_payments_PaymentDetails_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_payments_PaymentRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_payments_PaymentRequest_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_payments_X509Certificates_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_payments_X509Certificates_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_payments_Payment_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_payments_Payment_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_payments_PaymentACK_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_payments_PaymentACK_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } - private static com.google.protobuf.Descriptors.FileDescriptor + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { @@ -5948,7 +6718,7 @@ public Builder setMemoBytes( "\001(\014\"\225\001\n\016PaymentRequest\022\"\n\027payment_detail" + "s_version\030\001 \001(\r:\0011\022\026\n\010pki_type\030\002 \001(\t:\004no" + "ne\022\020\n\010pki_data\030\003 \001(\014\022\"\n\032serialized_payme" + - "nt_details\030\004 \002(\014\022\021\n\tsignature\030\005 \001(\014\"\'\n\020X", + "nt_details\030\004 \002(\014\022\021\n\tsignature\030\005 \001(\014\"\'\n\020X" + "509Certificates\022\023\n\013certificate\030\001 \003(\014\"i\n\007" + "Payment\022\025\n\rmerchant_data\030\001 \001(\014\022\024\n\014transa" + "ctions\030\002 \003(\014\022#\n\trefund_to\030\003 \003(\0132\020.paymen" + @@ -5972,37 +6742,37 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_payments_Output_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_payments_Output_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_payments_Output_descriptor, new java.lang.String[] { "Amount", "Script", }); internal_static_payments_PaymentDetails_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_payments_PaymentDetails_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_payments_PaymentDetails_descriptor, new java.lang.String[] { "Network", "Outputs", "Time", "Expires", "Memo", "PaymentUrl", "MerchantData", }); internal_static_payments_PaymentRequest_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_payments_PaymentRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_payments_PaymentRequest_descriptor, new java.lang.String[] { "PaymentDetailsVersion", "PkiType", "PkiData", "SerializedPaymentDetails", "Signature", }); internal_static_payments_X509Certificates_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_payments_X509Certificates_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_payments_X509Certificates_descriptor, new java.lang.String[] { "Certificate", }); internal_static_payments_Payment_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_payments_Payment_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_payments_Payment_descriptor, new java.lang.String[] { "MerchantData", "Transactions", "RefundTo", "Memo", }); internal_static_payments_PaymentACK_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_payments_PaymentACK_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_payments_PaymentACK_descriptor, new java.lang.String[] { "Payment", "Memo", }); } diff --git a/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java b/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java index 49d83ed975a..0ecfcfd91c1 100644 --- a/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java +++ b/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java @@ -21,6 +21,7 @@ import com.google.common.collect.*; import com.google.common.util.concurrent.*; import org.bitcoinj.core.listeners.*; +import org.bitcoinj.script.ScriptException; import org.bitcoinj.store.*; import org.bitcoinj.utils.*; import org.bitcoinj.wallet.Wallet; @@ -43,7 +44,7 @@ *

An AbstractBlockChain implementation must be connected to a {@link BlockStore} implementation. The chain object * by itself doesn't store any data, that's delegated to the store. Which store you use is a decision best made by * reading the getting started guide, but briefly, fully validating block chains need fully validating stores. In - * the lightweight SPV mode, a {@link org.bitcoinj.store.SPVBlockStore} is the right choice.

+ * the lightweight SPV mode, a {@link SPVBlockStore} is the right choice.

* *

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 LinkedHashMap orphanBlocks = new LinkedHashMap(); + private final LinkedHashMap orphanBlocks = new LinkedHashMap<>(); /** False positive estimation uses a double exponential moving average. */ public static final double FP_ESTIMATOR_ALPHA = 0.0001; @@ -150,9 +151,9 @@ public AbstractBlockChain(Context context, List wallets, log.info("chain head is at height {}:\n{}", chainHead.getHeight(), chainHead.getHeader()); this.params = context.getParams(); - this.newBestBlockListeners = new CopyOnWriteArrayList>(); - this.reorganizeListeners = new CopyOnWriteArrayList>(); - this.transactionReceivedListeners = new CopyOnWriteArrayList>(); + this.newBestBlockListeners = new CopyOnWriteArrayList<>(); + this.reorganizeListeners = new CopyOnWriteArrayList<>(); + this.transactionReceivedListeners = new CopyOnWriteArrayList<>(); for (NewBestBlockListener l : wallets) addNewBestBlockListener(Threading.SAME_THREAD, l); for (ReorganizeListener l : wallets) addReorganizeListener(Threading.SAME_THREAD, l); for (TransactionReceivedInBlockListener l : wallets) addTransactionReceivedListener(Threading.SAME_THREAD, l); @@ -173,14 +174,14 @@ public final void addWallet(Wallet wallet) { addTransactionReceivedListener(Threading.SAME_THREAD, wallet); int walletHeight = wallet.getLastBlockSeenHeight(); int chainHeight = getBestChainHeight(); - if (walletHeight != chainHeight) { + if (walletHeight != chainHeight && walletHeight > 0) { log.warn("Wallet/chain height mismatch: {} vs {}", walletHeight, chainHeight); log.warn("Hashes: {} vs {}", wallet.getLastBlockSeenHash(), getChainHead().getHeader().getHash()); // This special case happens when the VM crashes because of a transaction received. It causes the updated // block store to persist, but not the wallet. In order to fix the issue, we roll back the block store to // the wallet height to make it look like as if the block has never been received. - if (walletHeight < chainHeight && walletHeight > 0) { + if (walletHeight < chainHeight) { try { rollbackBlockStore(walletHeight); log.info("Rolled back block store to height {}.", walletHeight); @@ -198,27 +199,6 @@ public void removeWallet(Wallet wallet) { removeTransactionReceivedListener(wallet); } - /** Replaced with more specific listener methods: use them instead. */ - @Deprecated @SuppressWarnings("deprecation") - public void addListener(BlockChainListener listener) { - addListener(listener, Threading.USER_THREAD); - } - - /** Replaced with more specific listener methods: use them instead. */ - @Deprecated - public void addListener(BlockChainListener listener, Executor executor) { - addReorganizeListener(executor, listener); - addNewBestBlockListener(executor, listener); - addTransactionReceivedListener(executor, listener); - } - - @Deprecated - public void removeListener(BlockChainListener listener) { - removeReorganizeListener(listener); - removeNewBestBlockListener(listener); - removeTransactionReceivedListener(listener); - } - /** * Adds a {@link NewBestBlockListener} listener to the chain. */ @@ -230,7 +210,7 @@ public void addNewBestBlockListener(NewBestBlockListener listener) { * Adds a {@link NewBestBlockListener} listener to the chain. */ public final void addNewBestBlockListener(Executor executor, NewBestBlockListener listener) { - newBestBlockListeners.add(new ListenerRegistration(listener, executor)); + newBestBlockListeners.add(new ListenerRegistration<>(listener, executor)); } /** @@ -244,7 +224,7 @@ public void addReorganizeListener(ReorganizeListener listener) { * Adds a generic {@link ReorganizeListener} listener to the chain. */ public final void addReorganizeListener(Executor executor, ReorganizeListener listener) { - reorganizeListeners.add(new ListenerRegistration(listener, executor)); + reorganizeListeners.add(new ListenerRegistration<>(listener, executor)); } /** @@ -258,7 +238,7 @@ public void addTransactionReceivedListener(TransactionReceivedInBlockListener li * Adds a generic {@link TransactionReceivedInBlockListener} listener to the chain. */ public final void addTransactionReceivedListener(Executor executor, TransactionReceivedInBlockListener listener) { - transactionReceivedListeners.add(new ListenerRegistration(listener, executor)); + transactionReceivedListeners.add(new ListenerRegistration<>(listener, executor)); } /** @@ -454,7 +434,7 @@ private boolean add(Block block, boolean tryConnecting, // Prove the block is internally valid: hash is lower than target, etc. This only checks the block contents // if there is a tx sending or receiving coins using an address in one of our wallets. And those transactions // are only lightly verified: presence in a valid connecting block is taken as proof of validity. See the - // article here for more details: http://code.google.com/p/bitcoinj/wiki/SecurityModel + // article here for more details: https://bitcoinj.github.io/security-model try { block.verifyHeader(); storedPrev = getStoredBlockInCurrentScope(block.getPrevBlockHash()); @@ -506,7 +486,7 @@ private boolean add(Block block, boolean tryConnecting, public Set drainOrphanBlocks() { lock.lock(); try { - Set hashes = new HashSet(orphanBlocks.keySet()); + Set hashes = new HashSet<>(orphanBlocks.keySet()); orphanBlocks.clear(); return hashes; } finally { @@ -551,6 +531,7 @@ private void connectBlock(final Block block, StoredBlock storedPrev, boolean exp final Integer count = versionTally.getCountAtOrAbove(block.getVersion() + 1); if (count != null && count >= params.getMajorityRejectBlockOutdated()) { + log.error("Block with hash {} has outdated version: version # = {}" , block.getHashAsString(), block.getVersion()); throw new VerificationException.BlockVersionOutOfDate(block.getVersion()); } } @@ -563,7 +544,8 @@ private void connectBlock(final Block block, StoredBlock storedPrev, boolean exp block.transactions == null ? block : block.cloneAsHeader(), txOutChanges); versionTally.add(block.getVersion()); setChainHead(newStoredBlock); - log.debug("Chain is now {} blocks high, running listeners", newStoredBlock.getHeight()); + if (log.isDebugEnabled()) + log.debug("Chain is now {} blocks high, running listeners", newStoredBlock.getHeight()); informListenersForNewBlock(block, NewBlockType.BEST_CHAIN, filteredTxHashList, filteredTxn, newStoredBlock); } else { // This block connects to somewhere other than the top of the best known chain. We treat these differently. @@ -580,7 +562,7 @@ private void connectBlock(final Block block, StoredBlock storedPrev, boolean exp // newStoredBlock is a part of the same chain, there's no fork. This happens when we receive a block // that we already saw and linked into the chain previously, which isn't the chain head. // Re-processing it is confusing for the wallet so just skip. - log.warn("Saw duplicated block in main chain at height {}: {}", + log.warn("Saw duplicated block in best chain at height {}: {}", newBlock.getHeight(), newBlock.getHeader().getHash()); return; } @@ -756,7 +738,7 @@ private void handleNewBestChain(StoredBlock storedPrev, StoredBlock newChainHead // Then build a list of all blocks in the old part of the chain and the new part. final LinkedList oldBlocks = getPartialChain(head, splitPoint, blockStore); final LinkedList newBlocks = getPartialChain(newChainHead, splitPoint, blockStore); - // Disconnect each transaction in the previous main chain that is no longer in the new main chain + // Disconnect each transaction in the previous best chain that is no longer in the new best chain StoredBlock storedNewHead = splitPoint; if (shouldVerifyTransactions()) { for (StoredBlock oldBlock : oldBlocks) { @@ -818,7 +800,7 @@ public void run() { */ private static LinkedList getPartialChain(StoredBlock higher, StoredBlock lower, BlockStore store) throws BlockStoreException { checkArgument(higher.getHeight() > lower.getHeight(), "higher and lower are reversed"); - LinkedList results = new LinkedList(); + LinkedList results = new LinkedList<>(); StoredBlock cursor = higher; while (true) { results.add(cursor); @@ -856,7 +838,7 @@ private static StoredBlock findSplit(StoredBlock newChainHead, StoredBlock oldCh } /** - * @return the height of the best known chain, convenience for getChainHead().getHeight(). + * @return the height of the best known chain, convenience for {@code getChainHead().getHeight()}. */ public final int getBestChainHeight() { return getChainHead().getHeight(); @@ -875,7 +857,7 @@ private static void sendTransactionsToListener(StoredBlock block, NewBlockType b Set falsePositives) throws VerificationException { for (Transaction tx : transactions) { try { - falsePositives.remove(tx.getHash()); + falsePositives.remove(tx.getTxId()); if (clone) tx = tx.params.getDefaultSerializer().makeTransaction(tx.bitcoinSerialize()); listener.receiveFromBlock(tx, block, blockType, relativityOffset++); @@ -918,7 +900,8 @@ private void tryConnectingOrphans() throws VerificationException, BlockStoreExce StoredBlock prev = getStoredBlockInCurrentScope(orphanBlock.block.getPrevBlockHash()); if (prev == null) { // This is still an unconnected/orphan block. - log.debug("Orphan block {} is not connectable right now", orphanBlock.block.getHash()); + if (log.isDebugEnabled()) + log.debug("Orphan block {} is not connectable right now", orphanBlock.block.getHash()); continue; } // Otherwise we can connect it now. @@ -1062,7 +1045,7 @@ void trackFalsePositives(int count) { // Track false positives in batch by adding alpha to the false positive estimate once per count. // Each false positive counts as 1.0 towards the estimate. falsePositiveRate += FP_ESTIMATOR_ALPHA * count; - if (count > 0) + if (count > 0 && log.isDebugEnabled()) log.debug("{} false positives, current rate = {} trend = {}", count, falsePositiveRate, falsePositiveTrend); } diff --git a/core/src/main/java/org/bitcoinj/core/Address.java b/core/src/main/java/org/bitcoinj/core/Address.java index 2b9d6a12701..9437a041905 100644 --- a/core/src/main/java/org/bitcoinj/core/Address.java +++ b/core/src/main/java/org/bitcoinj/core/Address.java @@ -1,7 +1,5 @@ /* - * Copyright 2011 Google Inc. - * Copyright 2014 Giannis Dzegoutanis - * Copyright 2015 Andreas Schildbach + * 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. @@ -18,186 +16,89 @@ package org.bitcoinj.core; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.bitcoinj.params.Networks; -import org.bitcoinj.script.Script; - import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; +import org.bitcoinj.script.Script; +import org.bitcoinj.script.Script.ScriptType; /** - *

A 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 addresses; /** - * Contruct a new 'addr' message. + * Construct a new 'addr' message. * @param params NetworkParameters object. * @param offset The location of the first payload byte within the array. - * @param parseRetain Whether to retain the backing byte array for quick reserialization. - * If true and the backing byte array is invalidated due to modification of a field then - * the cached bytes may be repopulated and retained if the message is serialized again in the future. + * @param serializer the serializer to use for this block. * @param length The length of message if known. Usually this is provided when deserializing of the wire * as the length will be provided as part of the header. If unknown then set to Message.UNKNOWN_LENGTH * @throws ProtocolException */ - AddressMessage(NetworkParameters params, byte[] payload, int offset, MessageSerializer setSerializer, int length) throws ProtocolException { - super(params, payload, offset, setSerializer, length); + AddressMessage(NetworkParameters params, byte[] payload, int offset, MessageSerializer serializer, int length) throws ProtocolException { + super(params, payload, offset, serializer, length); } /** - * Contruct a new 'addr' message. + * Construct a new 'addr' message. * @param params NetworkParameters object. * @param serializer the serializer to use for this block. * @param length The length of message if known. Usually this is provided when deserializing of the wire @@ -76,7 +74,7 @@ protected void parse() throws ProtocolException { // Guard against ultra large messages that will crash us. if (numAddresses > MAX_ADDRESSES) throw new ProtocolException("Address message too large."); - addresses = new ArrayList((int) numAddresses); + addresses = new ArrayList<>((int) numAddresses); for (int i = 0; i < numAddresses; i++) { PeerAddress addr = new PeerAddress(params, payload, cursor, protocolVersion, this, serializer); addresses.add(addr); @@ -126,6 +124,6 @@ public void removeAddress(int index) { @Override public String toString() { - return "addr: " + Utils.join(addresses); + return "addr: " + Utils.SPACE_JOINER.join(addresses); } } diff --git a/core/src/main/java/org/bitcoinj/core/AlertMessage.java b/core/src/main/java/org/bitcoinj/core/AlertMessage.java index 2e6e9e419a1..b4e1131265f 100644 --- a/core/src/main/java/org/bitcoinj/core/AlertMessage.java +++ b/core/src/main/java/org/bitcoinj/core/AlertMessage.java @@ -31,7 +31,7 @@ * log, email), or if you decide to use alerts for notifications that are specific to your app in some way, to parse it. * For example, you could treat it as an upgrade notification specific to your app. Satoshi designed alerts to ensure * that software upgrades could be distributed independently of a hard-coded website, in order to allow everything to - * be purely peer-to-peer. You don't have to use this of course, and indeed it often makes more sense not to.

+ * 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 cancelSet = new HashSet((int) cancelSetSize); + Set cancelSet = new HashSet<>((int) cancelSetSize); for (long i = 0; i < cancelSetSize; i++) { cancelSet.add(readUint32()); } @@ -98,7 +98,7 @@ protected void parse() throws ProtocolException { if (subverSetSize < 0 || subverSetSize > MAX_SET_SIZE) { throw new ProtocolException("Bad subver set size: " + subverSetSize); } - Set matchingSubVers = new HashSet((int) subverSetSize); + Set matchingSubVers = new HashSet<>((int) subverSetSize); for (long i = 0; i < subverSetSize; i++) { matchingSubVers.add(readStr()); } @@ -115,7 +115,11 @@ protected void parse() throws ProtocolException { * doesn't verify, because that would allow arbitrary attackers to spam your users. */ public boolean isSignatureValid() { - return ECKey.verify(Sha256Hash.hashTwice(content), signature, params.getAlertSigningKey()); + try { + return ECKey.verify(Sha256Hash.hashTwice(content), signature, params.getAlertSigningKey()); + } catch (SignatureDecodeException e) { + return false; + } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/org/bitcoinj/core/Base58.java b/core/src/main/java/org/bitcoinj/core/Base58.java index dc07b0236ed..6ec2c47ac13 100644 --- a/core/src/main/java/org/bitcoinj/core/Base58.java +++ b/core/src/main/java/org/bitcoinj/core/Base58.java @@ -1,5 +1,6 @@ /* * Copyright 2011 Google Inc. + * Copyright 2018 Andreas Schildbach * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ *

* 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, String> names = new HashMap, String>(); + private static final Map, String> names = new HashMap<>(); static { names.put(VersionMessage.class, "version"); @@ -71,12 +72,13 @@ public class BitcoinSerializer extends MessageSerializer { names.put(RejectMessage.class, "reject"); names.put(GetUTXOsMessage.class, "getutxos"); names.put(UTXOsMessage.class, "utxos"); + names.put(SendHeadersMessage.class, "sendheaders"); } /** * Constructs a BitcoinSerializer with the given behavior. * - * @param params networkParams used to create Messages instances and termining packetMagic + * @param params networkParams used to create Messages instances and determining packetMagic * @param parseRetain retain the backing byte array of a message for fast reserialization. */ public BitcoinSerializer(NetworkParameters params, boolean parseRetain) { @@ -229,6 +231,8 @@ private Message makeMessage(String command, int length, byte[] payloadBytes, byt return new UTXOsMessage(params, payloadBytes); } else if (command.equals("getutxos")) { return new GetUTXOsMessage(params, payloadBytes); + } else if (command.equals("sendheaders")) { + return new SendHeadersMessage(params, payloadBytes); } else { log.warn("No support for deserializing message with name {}", command); return new UnknownMessage(params, command, payloadBytes); @@ -302,12 +306,9 @@ public InventoryMessage makeInventoryMessage(byte[] payloadBytes, int length) th * serialization format support. */ @Override - public Transaction makeTransaction(byte[] payloadBytes, int offset, - int length, byte[] hash) throws ProtocolException { - Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length); - if (hash != null) - tx.setHash(Sha256Hash.wrapReversed(hash)); - return tx; + public Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hashFromHeader) + throws ProtocolException { + return new Transaction(params, payloadBytes, offset, null, this, length, hashFromHeader); } @Override @@ -361,7 +362,7 @@ public BitcoinPacketHeader(ByteBuffer in) throws ProtocolException, BufferUnderf for (; header[cursor] != 0 && cursor < COMMAND_LEN; cursor++) ; byte[] commandBytes = new byte[cursor]; System.arraycopy(header, 0, commandBytes, 0, cursor); - command = Utils.toString(commandBytes, "US-ASCII"); + command = new String(commandBytes, StandardCharsets.US_ASCII); cursor = COMMAND_LEN; size = (int) readUint32(header, cursor); diff --git a/core/src/main/java/org/bitcoinj/core/Block.java b/core/src/main/java/org/bitcoinj/core/Block.java index c97879dca1f..9de445a7784 100644 --- a/core/src/main/java/org/bitcoinj/core/Block.java +++ b/core/src/main/java/org/bitcoinj/core/Block.java @@ -28,6 +28,7 @@ import java.math.*; import java.util.*; +import static com.google.common.base.Preconditions.checkState; import static org.bitcoinj.core.Coin.*; import static org.bitcoinj.core.Sha256Hash.*; @@ -36,7 +37,7 @@ * It records a set of {@link Transaction}s together with some data that links it into a place in the global block * chain, and proves that a difficult calculation was done over its contents. See * the Bitcoin technical paper for - * more detail on blocks.

+ * more detail on blocks.

* *

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 LinkedList(); + this.transactions = new LinkedList<>(); this.transactions.addAll(transactions); } @@ -212,7 +213,7 @@ public Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, S * the system it was 50 coins per block, in late 2012 it went to 25 coins per block, and so on. The size of * a coinbase transaction is inflation plus fees.

* - *

The 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 ArrayList(numTransactions); + transactions = new ArrayList<>(Math.min(numTransactions, Utils.MAX_INITIAL_ARRAY_LENGTH)); for (int i = 0; i < numTransactions; i++) { - Transaction tx = new Transaction(params, payload, cursor, this, serializer, UNKNOWN_LENGTH); + Transaction tx = new Transaction(params, payload, cursor, this, serializer, UNKNOWN_LENGTH, null); // Label the transaction as coming from the P2P network, so code that cares where we first saw it knows. tx.getConfidence().setSource(TransactionConfidence.Source.NETWORK); transactions.add(tx); @@ -314,8 +315,6 @@ private void writeTransactions(OutputStream stream) throws IOException { /** * Special handling to check if we have a valid byte array for both header * and transactions - * - * @throws IOException */ @Override public byte[] bitcoinSerialize() { @@ -486,14 +485,15 @@ public String toString() { s.append(" (").append(bips).append(')'); s.append('\n'); s.append(" previous block: ").append(getPrevBlockHash()).append("\n"); - s.append(" merkle root: ").append(getMerkleRoot()).append("\n"); s.append(" time: ").append(time).append(" (").append(Utils.dateTimeFormat(time * 1000)).append(")\n"); s.append(" difficulty target (nBits): ").append(difficultyTarget).append("\n"); s.append(" nonce: ").append(nonce).append("\n"); if (transactions != null && transactions.size() > 0) { + s.append(" merkle root: ").append(getMerkleRoot()).append("\n"); + s.append(" witness root: ").append(getWitnessRoot()).append("\n"); s.append(" with ").append(transactions.size()).append(" transaction(s):\n"); for (Transaction tx : transactions) { - s.append(tx); + s.append(tx).append('\n'); } } return s.toString(); @@ -541,7 +541,7 @@ protected boolean checkProofOfWork(boolean throwException) throws VerificationEx // ridiculously easy difficulty and this function would accept them. // // To prevent this attack from being possible, elsewhere we check that the difficultyTarget - // field is of the right value. This requires us to have the preceeding blocks. + // field is of the right value. This requires us to have the preceding blocks. BigInteger target = getDifficultyTargetAsInteger(); BigInteger h = getHash().toBigInteger(); @@ -557,10 +557,11 @@ protected boolean checkProofOfWork(boolean throwException) throws VerificationEx } private void checkTimestamp() throws VerificationException { - // Allow injection of a fake clock to allow unit testing. - long currentTime = Utils.currentTimeSeconds(); - if (time > currentTime + ALLOWED_TIME_DRIFT) - throw new VerificationException(String.format(Locale.US, "Block too far in future: %d vs %d", time, currentTime + ALLOWED_TIME_DRIFT)); + final long allowedTime = Utils.currentTimeSeconds() + ALLOWED_TIME_DRIFT; + if (time > allowedTime) + throw new VerificationException(String.format(Locale.US, + "Block too far in future: %s (%d) vs allowed %s (%d)", Utils.dateTimeFormat(time * 1000), time, + Utils.dateTimeFormat(allowedTime * 1000), allowedTime)); } private void checkSigOps() throws VerificationException { @@ -582,12 +583,43 @@ private void checkMerkleRoot() throws VerificationException { } } + @VisibleForTesting + void checkWitnessRoot() throws VerificationException { + Transaction coinbase = transactions.get(0); + checkState(coinbase.isCoinBase()); + Sha256Hash witnessCommitment = coinbase.findWitnessCommitment(); + if (witnessCommitment != null) { + byte[] witnessReserved = null; + TransactionWitness witness = coinbase.getInput(0).getWitness(); + if (witness.getPushCount() != 1) + throw new VerificationException("Coinbase witness reserved invalid: push count"); + witnessReserved = witness.getPush(0); + if (witnessReserved.length != 32) + throw new VerificationException("Coinbase witness reserved invalid: length"); + + Sha256Hash witnessRootHash = Sha256Hash.twiceOf(getWitnessRoot().getReversedBytes(), witnessReserved); + if (!witnessRootHash.equals(witnessCommitment)) + throw new VerificationException("Witness merkle root invalid. Expected " + witnessCommitment.toString() + + " but got " + witnessRootHash.toString()); + } else { + for (Transaction tx : transactions) { + if (tx.hasWitnesses()) + throw new VerificationException("Transaction witness found but no witness commitment present"); + } + } + } + private Sha256Hash calculateMerkleRoot() { - List tree = buildMerkleTree(); + List tree = buildMerkleTree(false); + return Sha256Hash.wrap(tree.get(tree.size() - 1)); + } + + private Sha256Hash calculateWitnessRoot() { + List tree = buildMerkleTree(true); return Sha256Hash.wrap(tree.get(tree.size() - 1)); } - private List buildMerkleTree() { + private List buildMerkleTree(boolean useWTxId) { // The Merkle root is based on a tree of hashes calculated from the transactions: // // root @@ -600,7 +632,7 @@ private List buildMerkleTree() { // entry is a hash. // // The hashing algorithm is double SHA-256. The leaves are a hash of the serialized contents of the transaction. - // The interior nodes are hashes of the concenation of the two child hashes. + // The interior nodes are hashes of the concatenation of the two child hashes. // // This structure allows the creation of proof that a transaction was included into a block without having to // provide the full block contents. Instead, you can provide only a Merkle branch. For example to prove tx2 was @@ -618,10 +650,15 @@ private List buildMerkleTree() { // 2 3 4 4 // / \ / \ / \ // t1 t2 t3 t4 t5 t5 - ArrayList tree = new ArrayList(); + ArrayList tree = new ArrayList<>(transactions.size()); // Start by adding all the hashes of the transactions as leaves of the tree. - for (Transaction t : transactions) { - tree.add(t.getHash().getBytes()); + for (Transaction tx : transactions) { + final Sha256Hash id; + if (useWTxId && tx.isCoinBase()) + id = Sha256Hash.ZERO_HASH; + else + id = useWTxId ? tx.getWTxId() : tx.getTxId(); + tree.add(id.getBytes()); } int levelOffset = 0; // Offset in the list where the currently processed level starts. // Step through each level, stopping when we reach the root (levelSize == 1). @@ -633,7 +670,7 @@ private List buildMerkleTree() { int right = Math.min(left + 1, levelSize - 1); byte[] leftBytes = Utils.reverseBytes(tree.get(levelOffset + left)); byte[] rightBytes = Utils.reverseBytes(tree.get(levelOffset + right)); - tree.add(Utils.reverseBytes(hashTwice(leftBytes, 0, 32, rightBytes, 0, 32))); + tree.add(Utils.reverseBytes(hashTwice(leftBytes, rightBytes))); } // Move to the next level. levelOffset += levelSize; @@ -694,7 +731,7 @@ public void verifyTransactions(final int height, final EnumSet flags // Now we need to check that the body of the block actually matches the headers. The network won't generate // an invalid block, but if we didn't validate this then an untrusted man-in-the-middle could obtain the next // valid block from the network and simply replace the transactions in it with their own fictional - // transactions that reference spent or non-existant inputs. + // transactions that reference spent or non-existent inputs. if (transactions.isEmpty()) throw new VerificationException("Block had no transactions"); if (this.getOptimalEncodingMessageSize() > MAX_BLOCK_SIZE) @@ -750,6 +787,15 @@ void setMerkleRoot(Sha256Hash value) { hash = null; } + /** + * Returns the witness root in big endian form, calculating it from transactions if necessary. + */ + public Sha256Hash getWitnessRoot() { + if (witnessRoot == null) + witnessRoot = calculateWitnessRoot(); + return witnessRoot; + } + /** Adds a transaction to this block. The nonce and merkle root are invalid after this. */ public void addTransaction(Transaction t) { addTransaction(t, true); @@ -759,7 +805,7 @@ public void addTransaction(Transaction t) { void addTransaction(Transaction t, boolean runSanityChecks) { unCacheTransactions(); if (transactions == null) { - transactions = new ArrayList(); + transactions = new ArrayList<>(); } t.setParent(this); if (runSanityChecks && transactions.size() == 0 && !t.isCoinBase()) @@ -816,7 +862,7 @@ public void setTime(long time) { * Returns the difficulty of the proof of work that this block should meet encoded in compact form. The {@link * BlockChain} verifies that this is not too easy by looking at the length of the chain when the block is added. * To find the actual value the hash should be compared against, use - * {@link org.bitcoinj.core.Block#getDifficultyTargetAsInteger()}. Note that this is not the same as + * {@link Block#getDifficultyTargetAsInteger()}. Note that this is not the same as * the difficulty value reported by the Bitcoin "getdifficulty" RPC that you may see on various block explorers. * That number is the result of applying a formula to the underlying difficulty to normalize the minimum to 1. * Calculating the difficulty that way is currently unsupported. @@ -866,7 +912,7 @@ public List getTransactions() { @VisibleForTesting void addCoinbaseTransaction(byte[] pubKeyTo, Coin value, final int height) { unCacheTransactions(); - transactions = new ArrayList(); + transactions = new ArrayList<>(); Transaction coinbase = new Transaction(params); final ScriptBuilder inputBuilder = new ScriptBuilder(); @@ -883,7 +929,7 @@ void addCoinbaseTransaction(byte[] pubKeyTo, Coin value, final int height) { coinbase.addInput(new TransactionInput(params, coinbase, inputBuilder.build().getProgram())); coinbase.addOutput(new TransactionOutput(params, coinbase, value, - ScriptBuilder.createOutputScript(ECKey.fromPublicOnly(pubKeyTo)).getProgram())); + ScriptBuilder.createP2PKOutputScript(ECKey.fromPublicOnly(pubKeyTo)).getProgram())); transactions.add(coinbase); coinbase.setParent(this); coinbase.length = coinbase.unsafeBitcoinSerialize().length; @@ -1004,7 +1050,7 @@ boolean isTransactionBytesValid() { * purely a header). */ public boolean hasTransactions() { - return !this.transactions.isEmpty(); + return (this.transactions != null) && !this.transactions.isEmpty(); } /** diff --git a/core/src/main/java/org/bitcoinj/core/BlockChain.java b/core/src/main/java/org/bitcoinj/core/BlockChain.java index 6fd6ca2237e..bb49547d2bc 100644 --- a/core/src/main/java/org/bitcoinj/core/BlockChain.java +++ b/core/src/main/java/org/bitcoinj/core/BlockChain.java @@ -21,8 +21,12 @@ import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.BlockStoreException; +import org.bitcoinj.store.MemoryBlockStore; +import org.bitcoinj.store.SPVBlockStore; import org.bitcoinj.wallet.Wallet; +import org.bitcoinj.wallet.WalletExtension; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -40,10 +44,10 @@ public class BlockChain extends AbstractBlockChain { /** *

Constructs 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 ImmutableList hashes; + + public BlockLocator() { + hashes = ImmutableList.of(); + } + + /** + * Creates a Block locator with defined list of hashes. + */ + public BlockLocator(ImmutableList hashes) { + this.hashes = hashes; + } + + /** + * Add a {@link Sha256Hash} to a newly created block locator. + */ + public BlockLocator add(Sha256Hash hash) { + return new BlockLocator(new ImmutableList.Builder().addAll(this.hashes).add(hash).build()); + } + + /** + * Returns the number of hashes in this block locator. + */ + public int size() { + return hashes.size(); + } + + /** + * Returns List of Block locator hashes. + */ + public List getHashes() { + return hashes; + } + + /** + * Get hash by index from this block locator. + */ + public Sha256Hash get(int i) { + return hashes.get(i); + } + + @Override + public String toString() { + return "Block locator with " + size() + " blocks\n " + Utils.SPACE_JOINER.join(hashes); + } + + @Override + public int hashCode() { + int hashCode = 0; + for (Sha256Hash i : hashes) { + hashCode ^= i.hashCode(); + } + return hashCode; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + return ((BlockLocator) o).getHashes().equals(hashes); + } +} diff --git a/core/src/main/java/org/bitcoinj/core/BloomFilter.java b/core/src/main/java/org/bitcoinj/core/BloomFilter.java index 7a149ea8e6c..69fffe64654 100644 --- a/core/src/main/java/org/bitcoinj/core/BloomFilter.java +++ b/core/src/main/java/org/bitcoinj/core/BloomFilter.java @@ -19,6 +19,9 @@ import org.bitcoinj.script.Script; import org.bitcoinj.script.ScriptChunk; +import org.bitcoinj.script.ScriptPattern; + +import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.collect.Lists; @@ -45,11 +48,11 @@ */ public class BloomFilter extends Message { /** The BLOOM_UPDATE_* constants control when the bloom filter is auto-updated by the peer using - it as a filter, either never, for all outputs or only for pay-2-pubkey outputs (default) */ + it as a filter, either never, for all outputs or only for P2PK outputs (default) */ public enum BloomUpdate { UPDATE_NONE, // 0 UPDATE_ALL, // 1 - /** Only adds outpoints to the filter if the output is a pay-to-pubkey/pay-to-multisig script */ + /** Only adds outpoints to the filter if the output is a P2PK/pay-to-multisig script */ UPDATE_P2PUBKEY_ONLY //2 } @@ -72,7 +75,7 @@ public BloomFilter(NetworkParameters params, byte[] payloadBytes) throws Protoco } /** - * Constructs a filter with the given parameters which is updated on pay2pubkey outputs only. + * Constructs a filter with the given parameters which is updated on P2PK outputs only. */ public BloomFilter(int elements, double falsePositiveRate, long randomNonce) { this(elements, falsePositiveRate, randomNonce, BloomUpdate.UPDATE_P2PUBKEY_ONLY); @@ -103,7 +106,7 @@ public BloomFilter(int elements, double falsePositiveRate, long randomNonce) { * It should be a random value, however secureness of the random value is of no great consequence.

* *

updateFlag 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) { List txns = block.getTransactions(); - List txHashes = new ArrayList(txns.size()); + List txHashes = new ArrayList<>(txns.size()); List matched = Lists.newArrayList(); byte[] bits = new byte[(int) Math.ceil(txns.size() / 8.0)]; for (int i = 0; i < txns.size(); i++) { Transaction tx = txns.get(i); - txHashes.add(tx.getHash()); + txHashes.add(tx.getTxId()); if (applyAndUpdate(tx)) { Utils.setBitLE(bits, i); matched.add(tx); @@ -320,7 +332,7 @@ public synchronized FilteredBlock applyAndUpdate(Block block) { } public synchronized boolean applyAndUpdate(Transaction tx) { - if (contains(tx.getHash().getBytes())) + if (contains(tx.getTxId().getBytes())) return true; boolean found = false; BloomUpdate flag = getUpdateFlag(); @@ -330,9 +342,9 @@ public synchronized boolean applyAndUpdate(Transaction tx) { if (!chunk.isPushData()) continue; if (contains(chunk.data)) { - boolean isSendingToPubKeys = script.isSentToRawPubKey() || script.isSentToMultiSig(); + boolean isSendingToPubKeys = ScriptPattern.isP2PK(script) || ScriptPattern.isSentToMultisig(script); if (flag == BloomUpdate.UPDATE_ALL || (flag == BloomUpdate.UPDATE_P2PUBKEY_ONLY && isSendingToPubKeys)) - insert(output.getOutPointFor().unsafeBitcoinSerialize()); + insert(output.getOutPointFor()); found = true; } } diff --git a/core/src/main/java/org/bitcoinj/core/CheckpointManager.java b/core/src/main/java/org/bitcoinj/core/CheckpointManager.java index c9d3628c61f..8b8db387dfd 100644 --- a/core/src/main/java/org/bitcoinj/core/CheckpointManager.java +++ b/core/src/main/java/org/bitcoinj/core/CheckpointManager.java @@ -19,12 +19,12 @@ import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.BlockStoreException; import org.bitcoinj.store.FullPrunedBlockStore; -import com.google.common.base.Charsets; import com.google.common.hash.HashCode; import com.google.common.hash.Hasher; import com.google.common.hash.Hashing; import com.google.common.io.BaseEncoding; +import org.bitcoinj.store.SPVBlockStore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,6 +37,7 @@ import java.io.InputStreamReader; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import java.nio.charset.StandardCharsets; import java.security.DigestInputStream; import java.security.MessageDigest; import java.util.Arrays; @@ -55,7 +56,7 @@ * * *

Checkpoints 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 TreeMap checkpoints = new TreeMap(); + // Map of block header time (in seconds) to data. + protected final TreeMap checkpoints = new TreeMap<>(); protected final NetworkParameters params; protected final Sha256Hash dataHash; @@ -120,7 +121,7 @@ private Sha256Hash readBinary(InputStream inputStream) throws IOException { digestInputStream.on(false); byte[] header = new byte[BINARY_MAGIC.length()]; dis.readFully(header); - if (!Arrays.equals(header, BINARY_MAGIC.getBytes("US-ASCII"))) + if (!Arrays.equals(header, BINARY_MAGIC.getBytes(StandardCharsets.US_ASCII))) throw new IOException("Header bytes did not match expected version"); int numSignatures = checkPositionIndex(dis.readInt(), MAX_SIGNATURES, "Num signatures out of range"); for (int i = 0; i < numSignatures; i++) { @@ -141,7 +142,8 @@ private Sha256Hash readBinary(InputStream inputStream) throws IOException { checkpoints.put(block.getHeader().getTimeSeconds(), block); } Sha256Hash dataHash = Sha256Hash.wrap(digest.digest()); - log.info("Read {} checkpoints, hash is {}", checkpoints.size(), dataHash); + log.info("Read {} checkpoints up to time {}, hash is {}", checkpoints.size(), + Utils.dateTimeFormat(checkpoints.lastEntry().getKey() * 1000), dataHash); return dataHash; } catch (ProtocolException e) { throw new IOException(e); @@ -155,7 +157,7 @@ private Sha256Hash readTextual(InputStream inputStream) throws IOException { Hasher hasher = Hashing.sha256().newHasher(); BufferedReader reader = null; try { - reader = new BufferedReader(new InputStreamReader(inputStream, Charsets.US_ASCII)); + reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.US_ASCII)); String magic = reader.readLine(); if (!TEXTUAL_MAGIC.equals(magic)) throw new IOException("unexpected magic: " + magic); @@ -178,7 +180,8 @@ private Sha256Hash readTextual(InputStream inputStream) throws IOException { checkpoints.put(block.getHeader().getTimeSeconds(), block); } HashCode hash = hasher.hash(); - log.info("Read {} checkpoints, hash is {}", checkpoints.size(), hash); + log.info("Read {} checkpoints up to time {}, hash is {}", checkpoints.size(), + Utils.dateTimeFormat(checkpoints.lastEntry().getKey() * 1000), hash); return Sha256Hash.wrap(hash.asBytes()); } finally { if (reader != null) reader.close(); @@ -189,11 +192,11 @@ private Sha256Hash readTextual(InputStream inputStream) throws IOException { * Returns a {@link StoredBlock} representing the last checkpoint before the given time, for example, normally * you would want to know the checkpoint before the earliest wallet birthday. */ - public StoredBlock getCheckpointBefore(long time) { + public StoredBlock getCheckpointBefore(long timeSecs) { try { - checkArgument(time > params.getGenesisBlock().getTimeSeconds()); + checkArgument(timeSecs > params.getGenesisBlock().getTimeSeconds()); // This is thread safe because the map never changes after creation. - Map.Entry entry = checkpoints.floorEntry(time); + Map.Entry entry = checkpoints.floorEntry(timeSecs); if (entry != null) return entry.getValue(); Block genesis = params.getGenesisBlock().cloneAsHeader(); return new StoredBlock(genesis, genesis.getWork(), 0); @@ -217,22 +220,23 @@ public Sha256Hash getDataHash() { * time, then inserts it into the store and sets that to be the chain head. Useful when you have just created * a new store from scratch and want to use configure it all in one go.

* - *

Note 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 slot = new ThreadLocal(); + private static final ThreadLocal slot = new ThreadLocal<>(); /** * Returns the current context that is associated with the calling thread. BitcoinJ is an API that has thread @@ -115,7 +120,7 @@ public static Context get() { } /** - * Require that new threads use {@link #propagate(Context)} or {@link org.bitcoinj.utils.ContextPropagatingThreadFactory}, + * Require that new threads use {@link #propagate(Context)} or {@link ContextPropagatingThreadFactory}, * rather than using a heuristic for the desired context. */ public static void enableStrictMode() { @@ -141,7 +146,7 @@ public static Context getOrCreate(NetworkParameters params) { * Sets the given context as the current thread context. You should use this if you create your own threads that * want to create core BitcoinJ objects. Generally, if a class can accept a Context in its constructor and might * be used (even indirectly) by a thread, you will want to call this first. Your task may be simplified by using - * a {@link org.bitcoinj.utils.ContextPropagatingThreadFactory}. + * a {@link ContextPropagatingThreadFactory}. */ public static void propagate(Context context) { slot.set(checkNotNull(context)); @@ -158,7 +163,7 @@ public TxConfidenceTable getConfidenceTable() { } /** - * Returns the {@link org.bitcoinj.core.NetworkParameters} specified when this context was (auto) created. The + * Returns the {@link NetworkParameters} specified when this context was (auto) created. The * network parameters defines various hard coded constants for a specific instance of a Bitcoin network, such as * main net, testnet, etc. */ @@ -176,7 +181,7 @@ public int getEventHorizon() { } /** - * The default fee per 1000 bytes of transaction data to pay when completing transactions. For details, see {@link SendRequest#feePerKb}. + * The default fee per 1000 virtual bytes of transaction data to pay when completing transactions. For details, see {@link SendRequest#feePerKb}. */ public Coin getFeePerKb() { return feePerKb; diff --git a/core/src/main/java/org/bitcoinj/core/DumpedPrivateKey.java b/core/src/main/java/org/bitcoinj/core/DumpedPrivateKey.java index 7c9895c242a..3594daaa149 100644 --- a/core/src/main/java/org/bitcoinj/core/DumpedPrivateKey.java +++ b/core/src/main/java/org/bitcoinj/core/DumpedPrivateKey.java @@ -17,20 +17,20 @@ package org.bitcoinj.core; -import com.google.common.base.Objects; import com.google.common.base.Preconditions; import java.util.Arrays; import javax.annotation.Nullable; +import org.bitcoinj.params.Networks; + /** * Parses and generates private keys in the form used by the Bitcoin "dumpprivkey" command. This is the private key * bytes with a header byte and 4 checksum bytes at the end. If there are 33 private key bytes instead of 32, then * the last byte is a discriminator value for the compressed pubkey. */ -public class DumpedPrivateKey extends VersionedChecksummedBytes { - private boolean compressed; +public class DumpedPrivateKey extends PrefixedChecksummedBytes { /** * Construct a private key from its Base58 representation. @@ -40,17 +40,45 @@ public class DumpedPrivateKey extends VersionedChecksummedBytes { * The textual form of the private key. * @throws AddressFormatException * if the given base58 doesn't parse or the checksum is invalid - * @throws WrongNetworkException + * @throws AddressFormatException.WrongNetwork * if the given private key is valid but for a different chain (eg testnet vs mainnet) */ - public static DumpedPrivateKey fromBase58(@Nullable NetworkParameters params,String base58) throws AddressFormatException { - return new DumpedPrivateKey(params, base58); + public static DumpedPrivateKey fromBase58(@Nullable NetworkParameters params, String base58) + throws AddressFormatException, AddressFormatException.WrongNetwork { + byte[] versionAndDataBytes = Base58.decodeChecked(base58); + int version = versionAndDataBytes[0] & 0xFF; + byte[] bytes = Arrays.copyOfRange(versionAndDataBytes, 1, versionAndDataBytes.length); + if (params == null) { + for (NetworkParameters p : Networks.get()) + if (version == p.getDumpedPrivateKeyHeader()) + return new DumpedPrivateKey(p, bytes); + throw new AddressFormatException.InvalidPrefix("No network found for version " + version); + } else { + if (version == params.getDumpedPrivateKeyHeader()) + return new DumpedPrivateKey(params, bytes); + throw new AddressFormatException.WrongNetwork(version); + } + } + + private DumpedPrivateKey(NetworkParameters params, byte[] bytes) { + super(params, bytes); + if (bytes.length != 32 && bytes.length != 33) + throw new AddressFormatException.InvalidDataLength( + "Wrong number of bytes for a private key (32 or 33): " + bytes.length); } // Used by ECKey.getPrivateKeyEncoded() DumpedPrivateKey(NetworkParameters params, byte[] keyBytes, boolean compressed) { - super(params.getDumpedPrivateKeyHeader(), encode(keyBytes, compressed)); - this.compressed = compressed; + this(params, encode(keyBytes, compressed)); + } + + /** + * Returns the base58-encoded textual form, including version and checksum bytes. + * + * @return textual form + */ + public String toBase58() { + return Base58.encodeChecked(params.getDumpedPrivateKeyHeader(), bytes); } private static byte[] encode(byte[] keyBytes, boolean compressed) { @@ -66,40 +94,22 @@ private static byte[] encode(byte[] keyBytes, boolean compressed) { } } - /** @deprecated Use {@link #fromBase58(NetworkParameters, String)} */ - @Deprecated - public DumpedPrivateKey(@Nullable NetworkParameters params, String encoded) throws AddressFormatException { - super(encoded); - if (params != null && version != params.getDumpedPrivateKeyHeader()) - throw new WrongNetworkException(version, new int[]{ params.getDumpedPrivateKeyHeader() }); - if (bytes.length == 33 && bytes[32] == 1) { - compressed = true; - bytes = Arrays.copyOf(bytes, 32); // Chop off the additional marker byte. - } else if (bytes.length == 32) { - compressed = false; - } else { - throw new AddressFormatException("Wrong number of bytes for a private key, not 32 or 33"); - } - } - /** * Returns an ECKey created from this encoded private key. */ public ECKey getKey() { - final ECKey key = ECKey.fromPrivate(bytes); - return compressed ? key : key.decompress(); + return ECKey.fromPrivate(Arrays.copyOf(bytes, 32), isPubKeyCompressed()); } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - DumpedPrivateKey other = (DumpedPrivateKey) o; - return version == other.version && compressed == other.compressed && Arrays.equals(bytes, other.bytes); + /** + * Returns true if the public key corresponding to this private key is compressed. + */ + public boolean isPubKeyCompressed() { + return bytes.length == 33 && bytes[32] == 1; } @Override - public int hashCode() { - return Objects.hashCode(version, compressed, Arrays.hashCode(bytes)); + public String toString() { + return toBase58(); } } diff --git a/core/src/main/java/org/bitcoinj/core/ECKey.java b/core/src/main/java/org/bitcoinj/core/ECKey.java index 7334a208ab0..926936e36a0 100644 --- a/core/src/main/java/org/bitcoinj/core/ECKey.java +++ b/core/src/main/java/org/bitcoinj/core/ECKey.java @@ -19,11 +19,12 @@ package org.bitcoinj.core; import org.bitcoinj.crypto.*; +import org.bitcoinj.script.Script; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.base.Preconditions; -import com.google.common.primitives.Ints; import com.google.common.primitives.UnsignedBytes; import org.bitcoin.NativeSecp256k1; import org.bitcoin.NativeSecp256k1Util; @@ -32,28 +33,29 @@ import org.bitcoinj.wallet.Wallet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.spongycastle.asn1.*; -import org.spongycastle.asn1.x9.X9ECParameters; -import org.spongycastle.asn1.x9.X9IntegerConverter; -import org.spongycastle.crypto.AsymmetricCipherKeyPair; -import org.spongycastle.crypto.digests.SHA256Digest; -import org.spongycastle.crypto.ec.CustomNamedCurves; -import org.spongycastle.crypto.generators.ECKeyPairGenerator; -import org.spongycastle.crypto.params.*; -import org.spongycastle.crypto.signers.ECDSASigner; -import org.spongycastle.crypto.signers.HMacDSAKCalculator; -import org.spongycastle.math.ec.ECAlgorithms; -import org.spongycastle.math.ec.ECPoint; -import org.spongycastle.math.ec.FixedPointCombMultiplier; -import org.spongycastle.math.ec.FixedPointUtil; -import org.spongycastle.math.ec.custom.sec.SecP256K1Curve; -import org.spongycastle.util.encoders.Base64; +import org.bouncycastle.asn1.*; +import org.bouncycastle.asn1.x9.X9ECParameters; +import org.bouncycastle.asn1.x9.X9IntegerConverter; +import org.bouncycastle.crypto.AsymmetricCipherKeyPair; +import org.bouncycastle.crypto.digests.SHA256Digest; +import org.bouncycastle.crypto.ec.CustomNamedCurves; +import org.bouncycastle.crypto.generators.ECKeyPairGenerator; +import org.bouncycastle.crypto.params.*; +import org.bouncycastle.crypto.signers.ECDSASigner; +import org.bouncycastle.crypto.signers.HMacDSAKCalculator; +import org.bouncycastle.math.ec.ECAlgorithms; +import org.bouncycastle.math.ec.ECPoint; +import org.bouncycastle.math.ec.FixedPointCombMultiplier; +import org.bouncycastle.math.ec.FixedPointUtil; +import org.bouncycastle.math.ec.custom.sec.SecP256K1Curve; +import org.bouncycastle.util.Properties; +import org.bouncycastle.util.encoders.Base64; import javax.annotation.Nullable; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.math.BigInteger; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.security.SecureRandom; import java.security.SignatureException; import java.util.Arrays; @@ -62,7 +64,7 @@ import static com.google.common.base.Preconditions.*; // TODO: Move this class to tracking compression state itself. -// The Bouncy Castle guys are deprecating their own tracking of the compression state. +// The Bouncy Castle developers are deprecating their own tracking of the compression state. /** *

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.

@@ -975,7 +992,7 @@ public static ECKey recoverFromSignature(int recId, ECDSASignature sig, Sha256Ha // 1.2. Convert the integer x to an octet string X of length mlen using the conversion routine // specified in Section 2.3.7, where mlen = ⌈(log2 p)/8⌉ or mlen = ⌈m/8⌉. // 1.3. Convert the octet string (16 set binary digits)||X to an elliptic curve point R using the - // conversion routine specified in Section 2.3.4. If this conversion routine outputs “invalid”, then + // conversion routine specified in Section 2.3.4. If this conversion routine outputs "invalid", then // do another iteration of Step 1. // // More concisely, what these points mean is to use X as a compressed public key. @@ -1029,7 +1046,7 @@ public byte[] getPrivKeyBytes() { /** * Exports the private key in the form used by Bitcoin Core's "dumpprivkey" and "importprivkey" commands. Use - * the {@link org.bitcoinj.core.DumpedPrivateKey#toString()} method to get the string. + * the {@link DumpedPrivateKey#toString()} method to get the string. * * @param params The network this key is intended for use on. * @return Private key bytes as a {@link DumpedPrivateKey}. @@ -1090,6 +1107,9 @@ public ECKey decrypt(KeyCrypter keyCrypter, KeyParameter aesKey) throws KeyCrypt throw new KeyCrypterException("The keyCrypter being used to decrypt the key is different to the one that was used to encrypt it"); checkState(encryptedPrivateKey != null, "This key is not encrypted"); byte[] unencryptedPrivateKey = keyCrypter.decrypt(encryptedPrivateKey, aesKey); + if (unencryptedPrivateKey.length != 32) + throw new KeyCrypterException.InvalidCipherText( + "Decrypted key must be 32 bytes long, but is " + unencryptedPrivateKey.length); ECKey key = ECKey.fromPrivate(unencryptedPrivateKey); if (!isCompressed()) key = key.decompress(); @@ -1219,23 +1239,20 @@ public boolean equals(Object o) { @Override public int hashCode() { - // Public keys are random already so we can just use a part of them as the hashcode. Read from the start to - // avoid picking up the type code (compressed vs uncompressed) which is tacked on the end. - byte[] bits = getPubKey(); - return Ints.fromBytes(bits[0], bits[1], bits[2], bits[3]); + return pub.hashCode(); } @Override public String toString() { - return toString(false, null); + return toString(false, null, null); } /** * Produce a string rendering of the ECKey INCLUDING the private key. * Unless you absolutely need the private key it is better for security reasons to just use {@link #toString()}. */ - public String toStringWithPrivate(NetworkParameters params) { - return toString(true, params); + public String toStringWithPrivate(@Nullable KeyParameter aesKey, NetworkParameters params) { + return toString(true, aesKey, params); } public String getPrivateKeyAsHex() { @@ -1250,15 +1267,19 @@ public String getPrivateKeyAsWiF(NetworkParameters params) { return getPrivateKeyEncoded(params).toString(); } - private String toString(boolean includePrivate, NetworkParameters params) { + private String toString(boolean includePrivate, @Nullable KeyParameter aesKey, @Nullable NetworkParameters params) { final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); helper.add("pub HEX", getPublicKeyAsHex()); if (includePrivate) { + ECKey decryptedKey = isEncrypted() ? decrypt(checkNotNull(aesKey)) : this; try { - helper.add("priv HEX", getPrivateKeyAsHex()); - helper.add("priv WIF", getPrivateKeyAsWiF(params)); + helper.add("priv HEX", decryptedKey.getPrivateKeyAsHex()); + helper.add("priv WIF", decryptedKey.getPrivateKeyAsWiF(params)); } catch (IllegalStateException e) { // TODO: Make hasPrivKey() work for deterministic keys and fix this. + } catch (Exception e) { + final String message = e.getMessage(); + helper.add("priv EXCEPTION", e.getClass().getName() + (message != null ? ": " + message : "")); } } if (creationTimeSeconds > 0) @@ -1271,19 +1292,53 @@ private String toString(boolean includePrivate, NetworkParameters params) { return helper.toString(); } - public void formatKeyWithAddress(boolean includePrivateKeys, StringBuilder builder, NetworkParameters params) { - final Address address = toAddress(params); + public void formatKeyWithAddress(boolean includePrivateKeys, @Nullable KeyParameter aesKey, StringBuilder builder, + NetworkParameters params, Script.ScriptType outputScriptType, @Nullable String comment) { builder.append(" addr:"); - builder.append(address.toString()); + if (outputScriptType != null) { + builder.append(Address.fromKey(params, this, outputScriptType)); + } else { + builder.append(LegacyAddress.fromKey(params, this)); + if (isCompressed()) + builder.append(',').append(SegwitAddress.fromKey(params, this)); + } + if (!isCompressed()) + builder.append(" UNCOMPRESSED"); builder.append(" hash160:"); builder.append(Utils.HEX.encode(getPubKeyHash())); if (creationTimeSeconds > 0) - builder.append(" creationTimeSeconds:").append(creationTimeSeconds); + builder.append(" creationTimeSeconds:").append(creationTimeSeconds).append(" [") + .append(Utils.dateTimeFormat(creationTimeSeconds * 1000)).append("]"); + if (comment != null) + builder.append(" (").append(comment).append(")"); builder.append("\n"); if (includePrivateKeys) { builder.append(" "); - builder.append(toStringWithPrivate(params)); + builder.append(toStringWithPrivate(aesKey, params)); builder.append("\n"); } } + + /** The string that prefixes all text messages signed using Bitcoin keys. */ + private static final String BITCOIN_SIGNED_MESSAGE_HEADER = "Bitcoin Signed Message:\n"; + private static final byte[] BITCOIN_SIGNED_MESSAGE_HEADER_BYTES = BITCOIN_SIGNED_MESSAGE_HEADER.getBytes(StandardCharsets.UTF_8); + + /** + *

Given a textual message, returns a byte buffer formatted as follows:

+ *

{@code [24] "Bitcoin Signed Message:\n" [message.length as a varint] message}

+ */ + private static byte[] formatMessageForSigning(String message) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + bos.write(BITCOIN_SIGNED_MESSAGE_HEADER_BYTES.length); + bos.write(BITCOIN_SIGNED_MESSAGE_HEADER_BYTES); + byte[] messageBytes = message.getBytes(StandardCharsets.UTF_8); + VarInt size = new VarInt(messageBytes.length); + bos.write(size.encode()); + bos.write(messageBytes); + return bos.toByteArray(); + } catch (IOException e) { + throw new RuntimeException(e); // Cannot happen. + } + } } diff --git a/core/src/main/java/org/bitcoinj/core/FilteredBlock.java b/core/src/main/java/org/bitcoinj/core/FilteredBlock.java index 84def7e4d83..bb570617a09 100644 --- a/core/src/main/java/org/bitcoinj/core/FilteredBlock.java +++ b/core/src/main/java/org/bitcoinj/core/FilteredBlock.java @@ -36,7 +36,7 @@ public class FilteredBlock extends Message { // A set of transactions whose hashes are a subset of getTransactionHashes() // These were relayed as a part of the filteredblock getdata, ie likely weren't previously received as loose transactions - private Map associatedTransactions = new HashMap(); + private Map associatedTransactions = new HashMap<>(); public FilteredBlock(NetworkParameters params, byte[] payloadBytes) throws ProtocolException { super(params, payloadBytes, 0); @@ -70,13 +70,13 @@ protected void parse() throws ProtocolException { /** * Gets a list of leaf hashes which are contained in the partial merkle tree in this filtered block - * - * @throws ProtocolException If the partial merkle block is invalid or the merkle root of the partial merkle block doesnt match the block header + * + * @throws ProtocolException If the partial merkle block is invalid or the merkle root of the partial merkle block doesn't match the block header */ public List getTransactionHashes() throws VerificationException { if (cachedTransactionHashes != null) return Collections.unmodifiableList(cachedTransactionHashes); - List hashesMatched = new LinkedList(); + List hashesMatched = new LinkedList<>(); if (header.getMerkleRoot().equals(merkleTree.getTxnHashAndMerkleRoot(hashesMatched))) { cachedTransactionHashes = hashesMatched; return Collections.unmodifiableList(cachedTransactionHashes); @@ -102,7 +102,7 @@ public Sha256Hash getHash() { * @return false if the tx is not relevant to this FilteredBlock */ public boolean provideTransaction(Transaction tx) throws VerificationException { - Sha256Hash hash = tx.getHash(); + Sha256Hash hash = tx.getTxId(); if (getTransactionHashes().contains(hash)) { associatedTransactions.put(hash, tx); return true; diff --git a/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java b/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java index 4bdebbce2db..1d39e7dc5ae 100644 --- a/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java +++ b/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java @@ -19,14 +19,17 @@ import org.bitcoinj.script.Script; import org.bitcoinj.script.Script.VerifyFlag; +import org.bitcoinj.script.ScriptPattern; import org.bitcoinj.store.BlockStoreException; import org.bitcoinj.store.FullPrunedBlockStore; import org.bitcoinj.utils.*; import org.bitcoinj.wallet.Wallet; +import org.bitcoinj.wallet.WalletExtension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nullable; +import java.io.File; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -58,7 +61,7 @@ public class FullPrunedBlockChain extends AbstractBlockChain { /** * Constructs a block chain 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...)} */ public FullPrunedBlockChain(Context context, Wallet wallet, FullPrunedBlockStore blockStore) throws BlockStoreException { this(context, new ArrayList(), blockStore); @@ -68,7 +71,7 @@ public FullPrunedBlockChain(Context context, Wallet wallet, FullPrunedBlockStore /** * Constructs a block chain 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...)} */ public FullPrunedBlockChain(NetworkParameters params, Wallet wallet, FullPrunedBlockStore blockStore) throws BlockStoreException { this(Context.getOrCreate(params), wallet, blockStore); @@ -217,14 +220,14 @@ protected TransactionOutputChanges connectTransactions(int height, Block block) blockStore.beginDatabaseBatchWrite(); - LinkedList txOutsSpent = new LinkedList(); - LinkedList txOutsCreated = new LinkedList(); + LinkedList txOutsSpent = new LinkedList<>(); + LinkedList txOutsCreated = new LinkedList<>(); long sigOps = 0; if (scriptVerificationExecutor.isShutdown()) scriptVerificationExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); - List> listScriptVerificationResults = new ArrayList>(block.transactions.size()); + List> listScriptVerificationResults = new ArrayList<>(block.transactions.size()); try { if (!params.isCheckpoint(height)) { // BIP30 violator blocks are ones that contain a duplicated transaction. They are all in the @@ -232,7 +235,7 @@ protected TransactionOutputChanges connectTransactions(int height, Block block) // BIP30 document for more details on this: https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki for (Transaction tx : block.transactions) { final Set verifyFlags = params.getTransactionVerificationFlags(block, tx, getVersionTally(), height); - Sha256Hash hash = tx.getHash(); + Sha256Hash hash = tx.getTxId(); // If we already have unspent outputs for this hash, we saw the tx already. Either the block is // being added twice (bug) or the block is a BIP30 violator. if (blockStore.hasUnspentOutputs(hash, tx.getOutputs().size())) @@ -247,7 +250,7 @@ protected TransactionOutputChanges connectTransactions(int height, Block block) boolean isCoinBase = tx.isCoinBase(); Coin valueIn = Coin.ZERO; Coin valueOut = Coin.ZERO; - final List