From dc0479af91934977dba5a54264ff01d03d389f30 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 22 Sep 2020 17:05:26 +0100 Subject: [PATCH] Fix update-sapling-tree binary The generated gRPC files were updated using protoc-rust-grpc 0.8.2 and protoc 3.13.0. --- Cargo.lock | 611 ++++---- Cargo.toml | 19 +- src/main/rust/bin/service.rs | 1712 ++++++++++++++++++---- src/main/rust/bin/service_grpc.rs | 223 ++- src/main/rust/bin/update_sapling_tree.rs | 58 +- 5 files changed, 1819 insertions(+), 804 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53c62045..9c93f10a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,7 +71,7 @@ dependencies = [ "android_log-sys", "env_logger", "lazy_static", - "log 0.4.11", + "log", ] [[package]] @@ -128,6 +128,12 @@ dependencies = [ "safemem", ] +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + [[package]] name = "base64" version = "0.12.3" @@ -151,12 +157,12 @@ dependencies = [ "byteorder", "crossbeam", "ff", - "futures", + "futures 0.1.29", "futures-cpupool", "group", "num_cpus", "pairing", - "rand_core", + "rand_core 0.5.1", "subtle", ] @@ -264,7 +270,7 @@ dependencies = [ "ff", "group", "pairing", - "rand_core", + "rand_core 0.5.1", "subtle", ] @@ -295,16 +301,6 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - [[package]] name = "bytes" version = "0.5.6" @@ -344,7 +340,7 @@ version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2809f67365382d65fd2b6d9c22577231b954ed27400efeafbe687bda75abcc0b" dependencies = [ - "bytes 0.5.6", + "bytes", "memchr", "pin-project-lite", ] @@ -504,7 +500,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.11", + "log", "regex", ] @@ -574,16 +570,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01646e077d4ebda82b73f1bca002ea1e91561a77df2431a9e79729bcc31950ef" dependencies = [ "bitvec", - "rand_core", + "rand_core 0.5.1", "subtle", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "fpe" version = "0.3.1" @@ -597,6 +587,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -625,16 +621,111 @@ version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + [[package]] name = "futures-cpupool" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" dependencies = [ - "futures", + "futures 0.1.29", "num_cpus", ] +[[package]] +name = "futures-executor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -679,28 +770,36 @@ checksum = "cc11f9f5fbf1943b48ae7c2bf6846e7d827a512d1be4f23af708f5ca5d01dde1" dependencies = [ "byteorder", "ff", - "rand_core", + "rand_core 0.5.1", "subtle", ] [[package]] name = "grpc" -version = "0.6.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e530ef7894a104a1c8525ce68787b3491efa2098ce5e5454e8324ea78893548" +checksum = "f61e21f9181e4f3732976a62a81f2b53f1195867d99325b5b9408b19219137e2" dependencies = [ "base64 0.9.3", - "bytes 0.4.12", - "futures", - "futures-cpupool", + "bytes", + "futures 0.3.5", "httpbis", - "log 0.4.11", - "protobuf", + "log", + "log-ndc", "tls-api", "tls-api-stub", - "tokio-core", - "tokio-io", - "tokio-tls-api", + "tokio", +] + +[[package]] +name = "grpc-protobuf" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c784adad59f85a308c690bbfd8863001750f3e01929dcc6fba0bfc2f13e3192" +dependencies = [ + "bytes", + "grpc", + "protobuf", ] [[package]] @@ -710,7 +809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b15cc3c181a2aace485d56c784568a4ae6e34322287a2499549d4cda7af3e1" dependencies = [ "lazy_static", - "rand", + "rand 0.7.3", "ring", "secp256k1", ] @@ -738,22 +837,19 @@ checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" [[package]] name = "httpbis" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7689cfa896b2a71da4f16206af167542b75d242b6906313e53857972a92d5614" +checksum = "3d3e4404f8f87938a2db89336609bde64363f5a556b15af936343e7252c9648d" dependencies = [ - "bytes 0.4.12", - "futures", - "futures-cpupool", - "log 0.4.11", + "bytes", + "futures 0.3.5", + "log", + "log-ndc", "net2", + "rand 0.5.6", "tls-api", "tls-api-stub", - "tokio-core", - "tokio-io", - "tokio-timer 0.1.2", - "tokio-tls-api", - "tokio-uds 0.1.7", + "tokio", "unix_socket", "void", ] @@ -783,7 +879,7 @@ dependencies = [ "combine", "error-chain", "jni-sys", - "log 0.4.11", + "log", "walkdir", ] @@ -812,7 +908,7 @@ dependencies = [ "bls12_381", "ff", "group", - "rand_core", + "rand_core 0.5.1", "subtle", ] @@ -855,24 +951,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.11", -] - [[package]] name = "log" version = "0.4.11" @@ -882,13 +960,22 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "log-ndc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb09057c7b58b7d27498b528eaee9a1e661b2974a733fcabbbc3350360bc8bd" +dependencies = [ + "log", +] + [[package]] name = "log-panics" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef" dependencies = [ - "log 0.4.11", + "log", ] [[package]] @@ -943,10 +1030,10 @@ dependencies = [ "iovec", "kernel32-sys", "libc", - "log 0.4.11", + "log", "miow", "net2", - "slab 0.4.2", + "slab", "winapi 0.2.8", ] @@ -1030,6 +1117,12 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" +[[package]] +name = "once_cell" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" + [[package]] name = "opaque-debug" version = "0.2.3" @@ -1053,29 +1146,23 @@ dependencies = [ ] [[package]] -name = "parking_lot" -version = "0.9.0" +name = "pin-project" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" dependencies = [ - "lock_api", - "parking_lot_core", - "rustc_version", + "pin-project-internal", ] [[package]] -name = "parking_lot_core" -version = "0.6.2" +name = "pin-project-internal" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" dependencies = [ - "cfg-if", - "cloudabi", - "libc", - "redox_syscall", - "rustc_version", - "smallvec 0.6.13", - "winapi 0.3.9", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1084,6 +1171,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.18" @@ -1102,6 +1195,12 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + [[package]] name = "proc-macro2" version = "1.0.21" @@ -1117,7 +1216,7 @@ version = "2.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb14183cc7f213ee2410067e1ceeadba2a7478a59432ff0747a335202798b1e2" dependencies = [ - "bytes 0.5.6", + "bytes", ] [[package]] @@ -1154,6 +1253,19 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64de9a0c5361e034f1aefc9f71a86871ec870e766fe31a009734a989b329286a" +[[package]] +name = "rand" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", +] + [[package]] name = "rand" version = "0.7.3" @@ -1163,7 +1275,7 @@ dependencies = [ "getrandom", "libc", "rand_chacha", - "rand_core", + "rand_core 0.5.1", "rand_hc", ] @@ -1174,9 +1286,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", ] +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.5.1" @@ -1192,7 +1319,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -1268,7 +1395,7 @@ dependencies = [ "libsqlite3-sys", "lru-cache", "memchr", - "smallvec 1.4.2", + "smallvec", "time", ] @@ -1301,12 +1428,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.18.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" dependencies = [ - "base64 0.12.3", - "log 0.4.11", + "base64 0.11.0", + "log", "ring", "sct", "webpki", @@ -1333,12 +1460,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scoped-tls" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" - [[package]] name = "scopeguard" version = "1.1.0" @@ -1447,27 +1568,12 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "slab" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" - [[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -[[package]] -name = "smallvec" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.4.2" @@ -1616,272 +1722,53 @@ dependencies = [ [[package]] name = "tls-api" -version = "0.1.22" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049c03787a0595182357fbd487577947f4351b78ce20c3668f6d49f17feb13d1" +checksum = "4ebb4107c167a4087349fcf08aea4debc358fe69d60fe1df991781842cfe98a3" dependencies = [ - "log 0.4.11", + "log", + "tokio", ] [[package]] name = "tls-api-rustls" -version = "0.1.9" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445f73888f803ef983ae667b3edcffbccdb276373dc2be62ea9e36dfd0bbc5af" +checksum = "17e236b7cea18986a1fd8d3247e8fdb5515ad43d8ab254920cc86f4a160a7910" dependencies = [ "rustls", "tls-api", + "tokio", "webpki", "webpki-roots", ] [[package]] name = "tls-api-stub" -version = "0.1.22" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a0cc8c149724db9de7d73a0e1bc80b1a74f5394f08c6f301e11f9c35fa061e" +checksum = "6f8ff269def04f25ae84b9aac156a400b92c97018a184036548c91cedaafd783" dependencies = [ "tls-api", + "tokio", "void", ] [[package]] name = "tokio" -version = "0.1.22" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ - "bytes 0.4.12", - "futures", - "mio", - "num_cpus", - "tokio-codec", - "tokio-current-thread", - "tokio-executor", - "tokio-fs", - "tokio-io", - "tokio-reactor", - "tokio-sync", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer 0.2.13", - "tokio-udp", - "tokio-uds 0.2.7", -] - -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes 0.4.12", - "futures", - "tokio-io", -] - -[[package]] -name = "tokio-core" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71" -dependencies = [ - "bytes 0.4.12", - "futures", + "bytes", "iovec", - "log 0.4.11", - "mio", - "scoped-tls", - "tokio", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-timer 0.2.13", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" -dependencies = [ - "futures", - "tokio-executor", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils", - "futures", -] - -[[package]] -name = "tokio-fs" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" -dependencies = [ - "futures", - "tokio-io", - "tokio-threadpool", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures", - "log 0.4.11", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils", - "futures", "lazy_static", - "log 0.4.11", - "mio", - "num_cpus", - "parking_lot", - "slab 0.4.2", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes 0.4.12", - "futures", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils", - "futures", - "lazy_static", - "log 0.4.11", - "num_cpus", - "slab 0.4.2", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6131e780037787ff1b3f8aad9da83bca02438b72277850dd6ad0d455e0e20efc" -dependencies = [ - "futures", - "slab 0.3.0", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils", - "futures", - "slab 0.4.2", - "tokio-executor", -] - -[[package]] -name = "tokio-tls-api" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68d0e040d5b1f4cfca70ec4f371229886a5de5bb554d272a4a8da73004a7b2c9" -dependencies = [ - "futures", - "tls-api", - "tokio-io", -] - -[[package]] -name = "tokio-udp" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" -dependencies = [ - "bytes 0.4.12", - "futures", - "log 0.4.11", - "mio", - "tokio-codec", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-uds" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ae5d255ce739e8537221ed2942e0445f4b3b813daebac1c0050ddaaa3587f9" -dependencies = [ - "bytes 0.4.12", - "futures", - "iovec", "libc", - "log 0.3.9", + "memchr", "mio", "mio-uds", - "tokio-core", - "tokio-io", -] - -[[package]] -name = "tokio-uds" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" -dependencies = [ - "bytes 0.4.12", - "futures", - "iovec", - "libc", - "log 0.4.11", - "mio", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "pin-project-lite", + "slab", ] [[package]] @@ -1965,7 +1852,7 @@ checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.11", + "log", "proc-macro2", "quote", "syn", @@ -2023,9 +1910,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.20.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" dependencies = [ "webpki", ] @@ -2095,15 +1982,17 @@ version = "0.0.4" dependencies = [ "android_logger", "base58", + "bls12_381", "bs58", "failure", - "futures", + "futures 0.3.5", "grpc", + "grpc-protobuf", "hdwallet", "hex 0.3.2", "httpbis", "jni", - "log 0.4.11", + "log", "log-panics", "protobuf", "protobuf-codegen-pure", @@ -2149,7 +2038,7 @@ dependencies = [ "group", "jubjub", "protobuf", - "rand_core", + "rand_core 0.5.1", "rusqlite", "time", "zcash_client_backend", @@ -2176,9 +2065,9 @@ dependencies = [ "hex 0.4.2", "jubjub", "lazy_static", - "log 0.4.11", - "rand", - "rand_core", + "log", + "rand 0.7.3", + "rand_core 0.5.1", "sha2 0.9.1", "subtle", ] @@ -2198,6 +2087,6 @@ dependencies = [ "group", "jubjub", "lazy_static", - "rand_core", + "rand_core 0.5.1", "zcash_primitives", ] diff --git a/Cargo.toml b/Cargo.toml index fa7e742c..e75ba4ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,14 +21,6 @@ zcash_client_sqlite = "0.2" zcash_primitives = "0.4" zcash_proofs = "0.4" -# update-sapling-tree dependencies -futures = { version = "0.1", optional = true } -grpc = { version = "0.6", optional = true } -httpbis = { version = "0.7", optional = true } -#protobuf = { version = "2", optional = true } -tls-api = { version = "0.1", optional = true } -tls-api-rustls = { version = "0.1", optional = true } - #### Temporary additions: #################################### base58 = "0.1.0" protobuf = "2" @@ -39,6 +31,15 @@ ripemd160 = "0.8.0" secp256k1 = "0.17.2" ############################################################## +# update-sapling-tree dependencies +bls12_381 = { version = "0.3", optional = true } +futures = { version = "0.3", optional = true } +grpc = { version = "0.8", optional = true } +grpc-protobuf = { version = "0.8", optional = true } +httpbis = { version = "0.9", optional = true } +tls-api = { version = "0.4", optional = true } +tls-api-rustls = { version = "0.4", optional = true } + [build-dependencies] protobuf-codegen-pure = "2.14" @@ -51,7 +52,7 @@ protobuf-codegen-pure = "2.14" [features] mainnet = ["zcash_client_sqlite/mainnet"] -#updater = ["futures", "grpc", "httpbis", "protobuf", "tls-api", "tls-api-rustls"] +updater = ["bls12_381", "futures", "grpc", "grpc-protobuf", "httpbis", "tls-api", "tls-api-rustls"] [lib] name = "zcashwalletsdk" diff --git a/src/main/rust/bin/service.rs b/src/main/rust/bin/service.rs index cced6b53..18159599 100644 --- a/src/main/rust/bin/service.rs +++ b/src/main/rust/bin/service.rs @@ -1,11 +1,12 @@ -// This file is generated by rust-protobuf 2.3.0. Do not edit +// This file is generated by rust-protobuf 2.17.0. Do not edit // @generated -// https://github.com/Manishearth/rust-clippy/issues/702 +// https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] -#![allow(clippy)] +#![allow(clippy::all)] -#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_attributes)] +#![rustfmt::skip] #![allow(box_pointers)] #![allow(dead_code)] @@ -14,12 +15,13 @@ #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] -#![allow(unsafe_code)] #![allow(unused_imports)] #![allow(unused_results)] +//! Generated file from `service.proto` -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_17_0; #[derive(PartialEq,Clone,Default)] pub struct BlockID { @@ -31,6 +33,12 @@ pub struct BlockID { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a BlockID { + fn default() -> &'a BlockID { + ::default_instance() + } +} + impl BlockID { pub fn new() -> BlockID { ::std::default::Default::default() @@ -38,6 +46,10 @@ impl BlockID { // uint64 height = 1; + + pub fn get_height(&self) -> u64 { + self.height + } pub fn clear_height(&mut self) { self.height = 0; } @@ -47,12 +59,12 @@ impl BlockID { self.height = v; } - pub fn get_height(&self) -> u64 { - self.height - } - // bytes hash = 2; + + pub fn get_hash(&self) -> &[u8] { + &self.hash + } pub fn clear_hash(&mut self) { self.hash.clear(); } @@ -72,10 +84,6 @@ impl BlockID { pub fn take_hash(&mut self) -> ::std::vec::Vec { ::std::mem::replace(&mut self.hash, ::std::vec::Vec::new()) } - - pub fn get_hash(&self) -> &[u8] { - &self.hash - } } impl ::protobuf::Message for BlockID { @@ -83,7 +91,7 @@ impl ::protobuf::Message for BlockID { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { @@ -120,7 +128,7 @@ impl ::protobuf::Message for BlockID { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { if self.height != 0 { os.write_uint64(1, self.height)?; } @@ -143,13 +151,13 @@ impl ::protobuf::Message for BlockID { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { self } @@ -162,60 +170,50 @@ impl ::protobuf::Message for BlockID { } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "height", - |m: &BlockID| { &m.height }, - |m: &mut BlockID| { &mut m.height }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "hash", - |m: &BlockID| { &m.hash }, - |m: &mut BlockID| { &mut m.hash }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BlockID", - fields, - file_descriptor_proto() - ) - }) - } + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "height", + |m: &BlockID| { &m.height }, + |m: &mut BlockID| { &mut m.height }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "hash", + |m: &BlockID| { &m.hash }, + |m: &mut BlockID| { &mut m.hash }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "BlockID", + fields, + file_descriptor_proto() + ) + }) } fn default_instance() -> &'static BlockID { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BlockID, - }; - unsafe { - instance.get(BlockID::new) - } + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(BlockID::new) } } impl ::protobuf::Clear for BlockID { fn clear(&mut self) { - self.clear_height(); - self.clear_hash(); + self.height = 0; + self.hash.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for BlockID { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockID { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -229,6 +227,12 @@ pub struct BlockRange { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a BlockRange { + fn default() -> &'a BlockRange { + ::default_instance() + } +} + impl BlockRange { pub fn new() -> BlockRange { ::std::default::Default::default() @@ -236,6 +240,10 @@ impl BlockRange { // .cash.z.wallet.sdk.rpc.BlockID start = 1; + + pub fn get_start(&self) -> &BlockID { + self.start.as_ref().unwrap_or_else(|| ::default_instance()) + } pub fn clear_start(&mut self) { self.start.clear(); } @@ -263,12 +271,12 @@ impl BlockRange { self.start.take().unwrap_or_else(|| BlockID::new()) } - pub fn get_start(&self) -> &BlockID { - self.start.as_ref().unwrap_or_else(|| BlockID::default_instance()) - } - // .cash.z.wallet.sdk.rpc.BlockID end = 2; + + pub fn get_end(&self) -> &BlockID { + self.end.as_ref().unwrap_or_else(|| ::default_instance()) + } pub fn clear_end(&mut self) { self.end.clear(); } @@ -295,10 +303,6 @@ impl BlockRange { pub fn take_end(&mut self) -> BlockID { self.end.take().unwrap_or_else(|| BlockID::new()) } - - pub fn get_end(&self) -> &BlockID { - self.end.as_ref().unwrap_or_else(|| BlockID::default_instance()) - } } impl ::protobuf::Message for BlockRange { @@ -316,7 +320,7 @@ impl ::protobuf::Message for BlockRange { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { @@ -351,7 +355,7 @@ impl ::protobuf::Message for BlockRange { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { if let Some(ref v) = self.start.as_ref() { os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; @@ -378,13 +382,13 @@ impl ::protobuf::Message for BlockRange { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { self } @@ -397,60 +401,50 @@ impl ::protobuf::Message for BlockRange { } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "start", - |m: &BlockRange| { &m.start }, - |m: &mut BlockRange| { &mut m.start }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "end", - |m: &BlockRange| { &m.end }, - |m: &mut BlockRange| { &mut m.end }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BlockRange", - fields, - file_descriptor_proto() - ) - }) - } + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "start", + |m: &BlockRange| { &m.start }, + |m: &mut BlockRange| { &mut m.start }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "end", + |m: &BlockRange| { &m.end }, + |m: &mut BlockRange| { &mut m.end }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "BlockRange", + fields, + file_descriptor_proto() + ) + }) } fn default_instance() -> &'static BlockRange { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BlockRange, - }; - unsafe { - instance.get(BlockRange::new) - } + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(BlockRange::new) } } impl ::protobuf::Clear for BlockRange { fn clear(&mut self) { - self.clear_start(); - self.clear_end(); + self.start.clear(); + self.end.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for BlockRange { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockRange { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -465,6 +459,12 @@ pub struct TxFilter { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a TxFilter { + fn default() -> &'a TxFilter { + ::default_instance() + } +} + impl TxFilter { pub fn new() -> TxFilter { ::std::default::Default::default() @@ -472,6 +472,10 @@ impl TxFilter { // .cash.z.wallet.sdk.rpc.BlockID block = 1; + + pub fn get_block(&self) -> &BlockID { + self.block.as_ref().unwrap_or_else(|| ::default_instance()) + } pub fn clear_block(&mut self) { self.block.clear(); } @@ -499,12 +503,12 @@ impl TxFilter { self.block.take().unwrap_or_else(|| BlockID::new()) } - pub fn get_block(&self) -> &BlockID { - self.block.as_ref().unwrap_or_else(|| BlockID::default_instance()) - } - // uint64 index = 2; + + pub fn get_index(&self) -> u64 { + self.index + } pub fn clear_index(&mut self) { self.index = 0; } @@ -514,12 +518,12 @@ impl TxFilter { self.index = v; } - pub fn get_index(&self) -> u64 { - self.index - } - // bytes hash = 3; + + pub fn get_hash(&self) -> &[u8] { + &self.hash + } pub fn clear_hash(&mut self) { self.hash.clear(); } @@ -539,10 +543,6 @@ impl TxFilter { pub fn take_hash(&mut self) -> ::std::vec::Vec { ::std::mem::replace(&mut self.hash, ::std::vec::Vec::new()) } - - pub fn get_hash(&self) -> &[u8] { - &self.hash - } } impl ::protobuf::Message for TxFilter { @@ -555,7 +555,7 @@ impl ::protobuf::Message for TxFilter { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { @@ -599,7 +599,7 @@ impl ::protobuf::Message for TxFilter { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { if let Some(ref v) = self.block.as_ref() { os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; @@ -627,13 +627,13 @@ impl ::protobuf::Message for TxFilter { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { self } @@ -646,66 +646,56 @@ impl ::protobuf::Message for TxFilter { } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "block", - |m: &TxFilter| { &m.block }, - |m: &mut TxFilter| { &mut m.block }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - |m: &TxFilter| { &m.index }, - |m: &mut TxFilter| { &mut m.index }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "hash", - |m: &TxFilter| { &m.hash }, - |m: &mut TxFilter| { &mut m.hash }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "TxFilter", - fields, - file_descriptor_proto() - ) - }) - } + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "block", + |m: &TxFilter| { &m.block }, + |m: &mut TxFilter| { &mut m.block }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + |m: &TxFilter| { &m.index }, + |m: &mut TxFilter| { &mut m.index }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "hash", + |m: &TxFilter| { &m.hash }, + |m: &mut TxFilter| { &mut m.hash }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "TxFilter", + fields, + file_descriptor_proto() + ) + }) } fn default_instance() -> &'static TxFilter { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TxFilter, - }; - unsafe { - instance.get(TxFilter::new) - } + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(TxFilter::new) } } impl ::protobuf::Clear for TxFilter { fn clear(&mut self) { - self.clear_block(); - self.clear_index(); - self.clear_hash(); + self.block.clear(); + self.index = 0; + self.hash.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for TxFilter { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TxFilter { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -713,11 +703,18 @@ impl ::protobuf::reflect::ProtobufValue for TxFilter { pub struct RawTransaction { // message fields pub data: ::std::vec::Vec, + pub height: u64, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a RawTransaction { + fn default() -> &'a RawTransaction { + ::default_instance() + } +} + impl RawTransaction { pub fn new() -> RawTransaction { ::std::default::Default::default() @@ -725,6 +722,10 @@ impl RawTransaction { // bytes data = 1; + + pub fn get_data(&self) -> &[u8] { + &self.data + } pub fn clear_data(&mut self) { self.data.clear(); } @@ -745,8 +746,19 @@ impl RawTransaction { ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) } - pub fn get_data(&self) -> &[u8] { - &self.data + // uint64 height = 2; + + + pub fn get_height(&self) -> u64 { + self.height + } + pub fn clear_height(&mut self) { + self.height = 0; + } + + // Param is passed by value, moved + pub fn set_height(&mut self, v: u64) { + self.height = v; } } @@ -755,13 +767,20 @@ impl ::protobuf::Message for RawTransaction { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.height = tmp; + }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; }, @@ -777,15 +796,21 @@ impl ::protobuf::Message for RawTransaction { if !self.data.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.data); } + if self.height != 0 { + my_size += ::protobuf::rt::value_size(2, self.height, ::protobuf::wire_format::WireTypeVarint); + } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { if !self.data.is_empty() { os.write_bytes(1, &self.data)?; } + if self.height != 0 { + os.write_uint64(2, self.height)?; + } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) } @@ -802,13 +827,13 @@ impl ::protobuf::Message for RawTransaction { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { self } @@ -821,54 +846,50 @@ impl ::protobuf::Message for RawTransaction { } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "data", - |m: &RawTransaction| { &m.data }, - |m: &mut RawTransaction| { &mut m.data }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawTransaction", - fields, - file_descriptor_proto() - ) - }) - } + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + |m: &RawTransaction| { &m.data }, + |m: &mut RawTransaction| { &mut m.data }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "height", + |m: &RawTransaction| { &m.height }, + |m: &mut RawTransaction| { &mut m.height }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RawTransaction", + fields, + file_descriptor_proto() + ) + }) } fn default_instance() -> &'static RawTransaction { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawTransaction, - }; - unsafe { - instance.get(RawTransaction::new) - } + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RawTransaction::new) } } impl ::protobuf::Clear for RawTransaction { fn clear(&mut self) { - self.clear_data(); + self.data.clear(); + self.height = 0; self.unknown_fields.clear(); } } impl ::std::fmt::Debug for RawTransaction { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for RawTransaction { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -882,6 +903,12 @@ pub struct SendResponse { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a SendResponse { + fn default() -> &'a SendResponse { + ::default_instance() + } +} + impl SendResponse { pub fn new() -> SendResponse { ::std::default::Default::default() @@ -889,6 +916,10 @@ impl SendResponse { // int32 errorCode = 1; + + pub fn get_errorCode(&self) -> i32 { + self.errorCode + } pub fn clear_errorCode(&mut self) { self.errorCode = 0; } @@ -898,12 +929,12 @@ impl SendResponse { self.errorCode = v; } - pub fn get_errorCode(&self) -> i32 { - self.errorCode - } - // string errorMessage = 2; + + pub fn get_errorMessage(&self) -> &str { + &self.errorMessage + } pub fn clear_errorMessage(&mut self) { self.errorMessage.clear(); } @@ -923,10 +954,6 @@ impl SendResponse { pub fn take_errorMessage(&mut self) -> ::std::string::String { ::std::mem::replace(&mut self.errorMessage, ::std::string::String::new()) } - - pub fn get_errorMessage(&self) -> &str { - &self.errorMessage - } } impl ::protobuf::Message for SendResponse { @@ -934,7 +961,7 @@ impl ::protobuf::Message for SendResponse { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { @@ -971,7 +998,7 @@ impl ::protobuf::Message for SendResponse { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { if self.errorCode != 0 { os.write_int32(1, self.errorCode)?; } @@ -994,13 +1021,13 @@ impl ::protobuf::Message for SendResponse { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { self } @@ -1013,60 +1040,50 @@ impl ::protobuf::Message for SendResponse { } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( - "errorCode", - |m: &SendResponse| { &m.errorCode }, - |m: &mut SendResponse| { &mut m.errorCode }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "errorMessage", - |m: &SendResponse| { &m.errorMessage }, - |m: &mut SendResponse| { &mut m.errorMessage }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SendResponse", - fields, - file_descriptor_proto() - ) - }) - } + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "errorCode", + |m: &SendResponse| { &m.errorCode }, + |m: &mut SendResponse| { &mut m.errorCode }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "errorMessage", + |m: &SendResponse| { &m.errorMessage }, + |m: &mut SendResponse| { &mut m.errorMessage }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "SendResponse", + fields, + file_descriptor_proto() + ) + }) } fn default_instance() -> &'static SendResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SendResponse, - }; - unsafe { - instance.get(SendResponse::new) - } + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(SendResponse::new) } } impl ::protobuf::Clear for SendResponse { fn clear(&mut self) { - self.clear_errorCode(); - self.clear_errorMessage(); + self.errorCode = 0; + self.errorMessage.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for SendResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SendResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -1077,6 +1094,12 @@ pub struct ChainSpec { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a ChainSpec { + fn default() -> &'a ChainSpec { + ::default_instance() + } +} + impl ChainSpec { pub fn new() -> ChainSpec { ::std::default::Default::default() @@ -1088,7 +1111,7 @@ impl ::protobuf::Message for ChainSpec { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { @@ -1109,7 +1132,7 @@ impl ::protobuf::Message for ChainSpec { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) } @@ -1126,13 +1149,13 @@ impl ::protobuf::Message for ChainSpec { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { self } @@ -1145,30 +1168,20 @@ impl ::protobuf::Message for ChainSpec { } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "ChainSpec", - fields, - file_descriptor_proto() - ) - }) - } + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ChainSpec", + fields, + file_descriptor_proto() + ) + }) } fn default_instance() -> &'static ChainSpec { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ChainSpec, - }; - unsafe { - instance.get(ChainSpec::new) - } + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ChainSpec::new) } } @@ -1179,14 +1192,1075 @@ impl ::protobuf::Clear for ChainSpec { } impl ::std::fmt::Debug for ChainSpec { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ChainSpec { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Empty { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Empty { + fn default() -> &'a Empty { + ::default_instance() + } +} + +impl Empty { + pub fn new() -> Empty { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for Empty { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Empty { + Empty::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Empty", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Empty { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Empty::new) + } +} + +impl ::protobuf::Clear for Empty { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Empty { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Empty { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LightdInfo { + // message fields + pub version: ::std::string::String, + pub vendor: ::std::string::String, + pub taddrSupport: bool, + pub chainName: ::std::string::String, + pub saplingActivationHeight: u64, + pub consensusBranchId: ::std::string::String, + pub blockHeight: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LightdInfo { + fn default() -> &'a LightdInfo { + ::default_instance() + } +} + +impl LightdInfo { + pub fn new() -> LightdInfo { + ::std::default::Default::default() + } + + // string version = 1; + + + pub fn get_version(&self) -> &str { + &self.version + } + pub fn clear_version(&mut self) { + self.version.clear(); + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: ::std::string::String) { + self.version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_version(&mut self) -> &mut ::std::string::String { + &mut self.version + } + + // Take field + pub fn take_version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.version, ::std::string::String::new()) + } + + // string vendor = 2; + + + pub fn get_vendor(&self) -> &str { + &self.vendor + } + pub fn clear_vendor(&mut self) { + self.vendor.clear(); + } + + // Param is passed by value, moved + pub fn set_vendor(&mut self, v: ::std::string::String) { + self.vendor = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vendor(&mut self) -> &mut ::std::string::String { + &mut self.vendor + } + + // Take field + pub fn take_vendor(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.vendor, ::std::string::String::new()) + } + + // bool taddrSupport = 3; + + + pub fn get_taddrSupport(&self) -> bool { + self.taddrSupport + } + pub fn clear_taddrSupport(&mut self) { + self.taddrSupport = false; + } + + // Param is passed by value, moved + pub fn set_taddrSupport(&mut self, v: bool) { + self.taddrSupport = v; + } + + // string chainName = 4; + + + pub fn get_chainName(&self) -> &str { + &self.chainName + } + pub fn clear_chainName(&mut self) { + self.chainName.clear(); + } + + // Param is passed by value, moved + pub fn set_chainName(&mut self, v: ::std::string::String) { + self.chainName = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_chainName(&mut self) -> &mut ::std::string::String { + &mut self.chainName + } + + // Take field + pub fn take_chainName(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.chainName, ::std::string::String::new()) + } + + // uint64 saplingActivationHeight = 5; + + + pub fn get_saplingActivationHeight(&self) -> u64 { + self.saplingActivationHeight + } + pub fn clear_saplingActivationHeight(&mut self) { + self.saplingActivationHeight = 0; + } + + // Param is passed by value, moved + pub fn set_saplingActivationHeight(&mut self, v: u64) { + self.saplingActivationHeight = v; + } + + // string consensusBranchId = 6; + + + pub fn get_consensusBranchId(&self) -> &str { + &self.consensusBranchId + } + pub fn clear_consensusBranchId(&mut self) { + self.consensusBranchId.clear(); + } + + // Param is passed by value, moved + pub fn set_consensusBranchId(&mut self, v: ::std::string::String) { + self.consensusBranchId = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_consensusBranchId(&mut self) -> &mut ::std::string::String { + &mut self.consensusBranchId + } + + // Take field + pub fn take_consensusBranchId(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.consensusBranchId, ::std::string::String::new()) + } + + // uint64 blockHeight = 7; + + + pub fn get_blockHeight(&self) -> u64 { + self.blockHeight + } + pub fn clear_blockHeight(&mut self) { + self.blockHeight = 0; + } + + // Param is passed by value, moved + pub fn set_blockHeight(&mut self, v: u64) { + self.blockHeight = v; + } +} + +impl ::protobuf::Message for LightdInfo { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.version)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.vendor)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.taddrSupport = tmp; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.chainName)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.saplingActivationHeight = tmp; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.consensusBranchId)?; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.blockHeight = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.version.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.version); + } + if !self.vendor.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.vendor); + } + if self.taddrSupport != false { + my_size += 2; + } + if !self.chainName.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.chainName); + } + if self.saplingActivationHeight != 0 { + my_size += ::protobuf::rt::value_size(5, self.saplingActivationHeight, ::protobuf::wire_format::WireTypeVarint); + } + if !self.consensusBranchId.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.consensusBranchId); + } + if self.blockHeight != 0 { + my_size += ::protobuf::rt::value_size(7, self.blockHeight, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.version.is_empty() { + os.write_string(1, &self.version)?; + } + if !self.vendor.is_empty() { + os.write_string(2, &self.vendor)?; + } + if self.taddrSupport != false { + os.write_bool(3, self.taddrSupport)?; + } + if !self.chainName.is_empty() { + os.write_string(4, &self.chainName)?; + } + if self.saplingActivationHeight != 0 { + os.write_uint64(5, self.saplingActivationHeight)?; + } + if !self.consensusBranchId.is_empty() { + os.write_string(6, &self.consensusBranchId)?; + } + if self.blockHeight != 0 { + os.write_uint64(7, self.blockHeight)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LightdInfo { + LightdInfo::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "version", + |m: &LightdInfo| { &m.version }, + |m: &mut LightdInfo| { &mut m.version }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "vendor", + |m: &LightdInfo| { &m.vendor }, + |m: &mut LightdInfo| { &mut m.vendor }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "taddrSupport", + |m: &LightdInfo| { &m.taddrSupport }, + |m: &mut LightdInfo| { &mut m.taddrSupport }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "chainName", + |m: &LightdInfo| { &m.chainName }, + |m: &mut LightdInfo| { &mut m.chainName }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "saplingActivationHeight", + |m: &LightdInfo| { &m.saplingActivationHeight }, + |m: &mut LightdInfo| { &mut m.saplingActivationHeight }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "consensusBranchId", + |m: &LightdInfo| { &m.consensusBranchId }, + |m: &mut LightdInfo| { &mut m.consensusBranchId }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "blockHeight", + |m: &LightdInfo| { &m.blockHeight }, + |m: &mut LightdInfo| { &mut m.blockHeight }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "LightdInfo", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static LightdInfo { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(LightdInfo::new) + } +} + +impl ::protobuf::Clear for LightdInfo { + fn clear(&mut self) { + self.version.clear(); + self.vendor.clear(); + self.taddrSupport = false; + self.chainName.clear(); + self.saplingActivationHeight = 0; + self.consensusBranchId.clear(); + self.blockHeight = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LightdInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LightdInfo { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TransparentAddressBlockFilter { + // message fields + pub address: ::std::string::String, + pub range: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a TransparentAddressBlockFilter { + fn default() -> &'a TransparentAddressBlockFilter { + ::default_instance() + } +} + +impl TransparentAddressBlockFilter { + pub fn new() -> TransparentAddressBlockFilter { + ::std::default::Default::default() + } + + // string address = 1; + + + pub fn get_address(&self) -> &str { + &self.address + } + pub fn clear_address(&mut self) { + self.address.clear(); + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + &mut self.address + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.address, ::std::string::String::new()) + } + + // .cash.z.wallet.sdk.rpc.BlockRange range = 2; + + + pub fn get_range(&self) -> &BlockRange { + self.range.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_range(&mut self) { + self.range.clear(); + } + + pub fn has_range(&self) -> bool { + self.range.is_some() + } + + // Param is passed by value, moved + pub fn set_range(&mut self, v: BlockRange) { + self.range = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_range(&mut self) -> &mut BlockRange { + if self.range.is_none() { + self.range.set_default(); + } + self.range.as_mut().unwrap() + } + + // Take field + pub fn take_range(&mut self) -> BlockRange { + self.range.take().unwrap_or_else(|| BlockRange::new()) + } +} + +impl ::protobuf::Message for TransparentAddressBlockFilter { + fn is_initialized(&self) -> bool { + for v in &self.range { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.address)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.range)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.address.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.address); + } + if let Some(ref v) = self.range.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.address.is_empty() { + os.write_string(1, &self.address)?; + } + if let Some(ref v) = self.range.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> TransparentAddressBlockFilter { + TransparentAddressBlockFilter::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "address", + |m: &TransparentAddressBlockFilter| { &m.address }, + |m: &mut TransparentAddressBlockFilter| { &mut m.address }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "range", + |m: &TransparentAddressBlockFilter| { &m.range }, + |m: &mut TransparentAddressBlockFilter| { &mut m.range }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "TransparentAddressBlockFilter", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static TransparentAddressBlockFilter { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(TransparentAddressBlockFilter::new) + } +} + +impl ::protobuf::Clear for TransparentAddressBlockFilter { + fn clear(&mut self) { + self.address.clear(); + self.range.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TransparentAddressBlockFilter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TransparentAddressBlockFilter { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Duration { + // message fields + pub intervalUs: i64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Duration { + fn default() -> &'a Duration { + ::default_instance() + } +} + +impl Duration { + pub fn new() -> Duration { + ::std::default::Default::default() + } + + // int64 intervalUs = 1; + + + pub fn get_intervalUs(&self) -> i64 { + self.intervalUs + } + pub fn clear_intervalUs(&mut self) { + self.intervalUs = 0; + } + + // Param is passed by value, moved + pub fn set_intervalUs(&mut self, v: i64) { + self.intervalUs = v; + } +} + +impl ::protobuf::Message for Duration { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.intervalUs = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.intervalUs != 0 { + my_size += ::protobuf::rt::value_size(1, self.intervalUs, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.intervalUs != 0 { + os.write_int64(1, self.intervalUs)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Duration { + Duration::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "intervalUs", + |m: &Duration| { &m.intervalUs }, + |m: &mut Duration| { &mut m.intervalUs }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Duration", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Duration { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Duration::new) + } +} + +impl ::protobuf::Clear for Duration { + fn clear(&mut self) { + self.intervalUs = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Duration { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Duration { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PingResponse { + // message fields + pub entry: i64, + pub exit: i64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a PingResponse { + fn default() -> &'a PingResponse { + ::default_instance() + } +} + +impl PingResponse { + pub fn new() -> PingResponse { + ::std::default::Default::default() + } + + // int64 entry = 1; + + + pub fn get_entry(&self) -> i64 { + self.entry + } + pub fn clear_entry(&mut self) { + self.entry = 0; + } + + // Param is passed by value, moved + pub fn set_entry(&mut self, v: i64) { + self.entry = v; + } + + // int64 exit = 2; + + + pub fn get_exit(&self) -> i64 { + self.exit + } + pub fn clear_exit(&mut self) { + self.exit = 0; + } + + // Param is passed by value, moved + pub fn set_exit(&mut self, v: i64) { + self.exit = v; + } +} + +impl ::protobuf::Message for PingResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.entry = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.exit = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.entry != 0 { + my_size += ::protobuf::rt::value_size(1, self.entry, ::protobuf::wire_format::WireTypeVarint); + } + if self.exit != 0 { + my_size += ::protobuf::rt::value_size(2, self.exit, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.entry != 0 { + os.write_int64(1, self.entry)?; + } + if self.exit != 0 { + os.write_int64(2, self.exit)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> PingResponse { + PingResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "entry", + |m: &PingResponse| { &m.entry }, + |m: &mut PingResponse| { &mut m.entry }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "exit", + |m: &PingResponse| { &m.exit }, + |m: &mut PingResponse| { &mut m.exit }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "PingResponse", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static PingResponse { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(PingResponse::new) + } +} + +impl ::protobuf::Clear for PingResponse { + fn clear(&mut self) { + self.entry = 0; + self.exit = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PingResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PingResponse { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -1198,34 +2272,46 @@ static file_descriptor_proto_data: &'static [u8] = b"\ art\x120\n\x03end\x18\x02\x20\x01(\x0b2\x1e.cash.z.wallet.sdk.rpc.BlockI\ DR\x03end\"j\n\x08TxFilter\x124\n\x05block\x18\x01\x20\x01(\x0b2\x1e.cas\ h.z.wallet.sdk.rpc.BlockIDR\x05block\x12\x14\n\x05index\x18\x02\x20\x01(\ - \x04R\x05index\x12\x12\n\x04hash\x18\x03\x20\x01(\x0cR\x04hash\"$\n\x0eR\ - awTransaction\x12\x12\n\x04data\x18\x01\x20\x01(\x0cR\x04data\"P\n\x0cSe\ - ndResponse\x12\x1c\n\terrorCode\x18\x01\x20\x01(\x05R\terrorCode\x12\"\n\ - \x0cerrorMessage\x18\x02\x20\x01(\tR\x0cerrorMessage\"\x0b\n\tChainSpec2\ - \xd6\x03\n\x11CompactTxStreamer\x12T\n\x0eGetLatestBlock\x12\x20.cash.z.\ - wallet.sdk.rpc.ChainSpec\x1a\x1e.cash.z.wallet.sdk.rpc.BlockID\"\0\x12Q\ - \n\x08GetBlock\x12\x1e.cash.z.wallet.sdk.rpc.BlockID\x1a#.cash.z.wallet.\ - sdk.rpc.CompactBlock\"\0\x12[\n\rGetBlockRange\x12!.cash.z.wallet.sdk.rp\ - c.BlockRange\x1a#.cash.z.wallet.sdk.rpc.CompactBlock\"\00\x01\x12Z\n\x0e\ - GetTransaction\x12\x1f.cash.z.wallet.sdk.rpc.TxFilter\x1a%.cash.z.wallet\ - .sdk.rpc.RawTransaction\"\0\x12_\n\x0fSendTransaction\x12%.cash.z.wallet\ - .sdk.rpc.RawTransaction\x1a#.cash.z.wallet.sdk.rpc.SendResponse\"\0B\x0b\ - Z\twalletrpcb\x06proto3\ + \x04R\x05index\x12\x12\n\x04hash\x18\x03\x20\x01(\x0cR\x04hash\"<\n\x0eR\ + awTransaction\x12\x12\n\x04data\x18\x01\x20\x01(\x0cR\x04data\x12\x16\n\ + \x06height\x18\x02\x20\x01(\x04R\x06height\"P\n\x0cSendResponse\x12\x1c\ + \n\terrorCode\x18\x01\x20\x01(\x05R\terrorCode\x12\"\n\x0cerrorMessage\ + \x18\x02\x20\x01(\tR\x0cerrorMessage\"\x0b\n\tChainSpec\"\x07\n\x05Empty\ + \"\x8a\x02\n\nLightdInfo\x12\x18\n\x07version\x18\x01\x20\x01(\tR\x07ver\ + sion\x12\x16\n\x06vendor\x18\x02\x20\x01(\tR\x06vendor\x12\"\n\x0ctaddrS\ + upport\x18\x03\x20\x01(\x08R\x0ctaddrSupport\x12\x1c\n\tchainName\x18\ + \x04\x20\x01(\tR\tchainName\x128\n\x17saplingActivationHeight\x18\x05\ + \x20\x01(\x04R\x17saplingActivationHeight\x12,\n\x11consensusBranchId\ + \x18\x06\x20\x01(\tR\x11consensusBranchId\x12\x20\n\x0bblockHeight\x18\ + \x07\x20\x01(\x04R\x0bblockHeight\"r\n\x1dTransparentAddressBlockFilter\ + \x12\x18\n\x07address\x18\x01\x20\x01(\tR\x07address\x127\n\x05range\x18\ + \x02\x20\x01(\x0b2!.cash.z.wallet.sdk.rpc.BlockRangeR\x05range\"*\n\x08D\ + uration\x12\x1e\n\nintervalUs\x18\x01\x20\x01(\x03R\nintervalUs\"8\n\x0c\ + PingResponse\x12\x14\n\x05entry\x18\x01\x20\x01(\x03R\x05entry\x12\x12\n\ + \x04exit\x18\x02\x20\x01(\x03R\x04exit2\xee\x05\n\x11CompactTxStreamer\ + \x12T\n\x0eGetLatestBlock\x12\x20.cash.z.wallet.sdk.rpc.ChainSpec\x1a\ + \x1e.cash.z.wallet.sdk.rpc.BlockID\"\0\x12Q\n\x08GetBlock\x12\x1e.cash.z\ + .wallet.sdk.rpc.BlockID\x1a#.cash.z.wallet.sdk.rpc.CompactBlock\"\0\x12[\ + \n\rGetBlockRange\x12!.cash.z.wallet.sdk.rpc.BlockRange\x1a#.cash.z.wall\ + et.sdk.rpc.CompactBlock\"\00\x01\x12Z\n\x0eGetTransaction\x12\x1f.cash.z\ + .wallet.sdk.rpc.TxFilter\x1a%.cash.z.wallet.sdk.rpc.RawTransaction\"\0\ + \x12_\n\x0fSendTransaction\x12%.cash.z.wallet.sdk.rpc.RawTransaction\x1a\ + #.cash.z.wallet.sdk.rpc.SendResponse\"\0\x12r\n\x0fGetAddressTxids\x124.\ + cash.z.wallet.sdk.rpc.TransparentAddressBlockFilter\x1a%.cash.z.wallet.s\ + dk.rpc.RawTransaction\"\00\x01\x12R\n\rGetLightdInfo\x12\x1c.cash.z.wall\ + et.sdk.rpc.Empty\x1a!.cash.z.wallet.sdk.rpc.LightdInfo\"\0\x12N\n\x04Pin\ + g\x12\x1f.cash.z.wallet.sdk.rpc.Duration\x1a#.cash.z.wallet.sdk.rpc.Ping\ + Response\"\0B\x0eZ\twalletrpc\xba\x02\0b\x06proto3\ "; -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) } diff --git a/src/main/rust/bin/service_grpc.rs b/src/main/rust/bin/service_grpc.rs index 47b0df52..6cd5d4fc 100644 --- a/src/main/rust/bin/service_grpc.rs +++ b/src/main/rust/bin/service_grpc.rs @@ -3,7 +3,7 @@ // https://github.com/Manishearth/rust-clippy/issues/702 #![allow(unknown_lints)] -#![allow(clippy)] +#![allow(clippy::all)] #![cfg_attr(rustfmt, rustfmt_skip)] @@ -19,88 +19,119 @@ #![allow(unused_results)] -// interface +// server interface pub trait CompactTxStreamer { - fn get_latest_block(&self, o: ::grpc::RequestOptions, p: super::service::ChainSpec) -> ::grpc::SingleResponse; + fn get_latest_block(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseUnarySink) -> ::grpc::Result<()>; - fn get_block(&self, o: ::grpc::RequestOptions, p: super::service::BlockID) -> ::grpc::SingleResponse; + fn get_block(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseUnarySink) -> ::grpc::Result<()>; - fn get_block_range(&self, o: ::grpc::RequestOptions, p: super::service::BlockRange) -> ::grpc::StreamingResponse; + fn get_block_range(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseSink) -> ::grpc::Result<()>; - fn get_transaction(&self, o: ::grpc::RequestOptions, p: super::service::TxFilter) -> ::grpc::SingleResponse; + fn get_transaction(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseUnarySink) -> ::grpc::Result<()>; - fn send_transaction(&self, o: ::grpc::RequestOptions, p: super::service::RawTransaction) -> ::grpc::SingleResponse; + fn send_transaction(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseUnarySink) -> ::grpc::Result<()>; + + fn get_address_txids(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseSink) -> ::grpc::Result<()>; + + fn get_lightd_info(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseUnarySink) -> ::grpc::Result<()>; + + fn ping(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle, resp: ::grpc::ServerResponseUnarySink) -> ::grpc::Result<()>; } // client pub struct CompactTxStreamerClient { grpc_client: ::std::sync::Arc<::grpc::Client>, - method_GetLatestBlock: ::std::sync::Arc<::grpc::rt::MethodDescriptor>, - method_GetBlock: ::std::sync::Arc<::grpc::rt::MethodDescriptor>, - method_GetBlockRange: ::std::sync::Arc<::grpc::rt::MethodDescriptor>, - method_GetTransaction: ::std::sync::Arc<::grpc::rt::MethodDescriptor>, - method_SendTransaction: ::std::sync::Arc<::grpc::rt::MethodDescriptor>, } impl ::grpc::ClientStub for CompactTxStreamerClient { fn with_client(grpc_client: ::std::sync::Arc<::grpc::Client>) -> Self { CompactTxStreamerClient { grpc_client: grpc_client, - method_GetLatestBlock: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock".to_string(), - streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - }), - method_GetBlock: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock".to_string(), - streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - }), - method_GetBlockRange: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange".to_string(), - streaming: ::grpc::rt::GrpcStreaming::ServerStreaming, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - }), - method_GetTransaction: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction".to_string(), - streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - }), - method_SendTransaction: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction".to_string(), - streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - }), } } } -impl CompactTxStreamer for CompactTxStreamerClient { - fn get_latest_block(&self, o: ::grpc::RequestOptions, p: super::service::ChainSpec) -> ::grpc::SingleResponse { - self.grpc_client.call_unary(o, p, self.method_GetLatestBlock.clone()) +impl CompactTxStreamerClient { + pub fn get_latest_block(&self, o: ::grpc::RequestOptions, req: super::service::ChainSpec) -> ::grpc::SingleResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_unary(o, req, descriptor) } - fn get_block(&self, o: ::grpc::RequestOptions, p: super::service::BlockID) -> ::grpc::SingleResponse { - self.grpc_client.call_unary(o, p, self.method_GetBlock.clone()) + pub fn get_block(&self, o: ::grpc::RequestOptions, req: super::service::BlockID) -> ::grpc::SingleResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_unary(o, req, descriptor) } - fn get_block_range(&self, o: ::grpc::RequestOptions, p: super::service::BlockRange) -> ::grpc::StreamingResponse { - self.grpc_client.call_server_streaming(o, p, self.method_GetBlockRange.clone()) + pub fn get_block_range(&self, o: ::grpc::RequestOptions, req: super::service::BlockRange) -> ::grpc::StreamingResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange"), + streaming: ::grpc::rt::GrpcStreaming::ServerStreaming, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_server_streaming(o, req, descriptor) } - fn get_transaction(&self, o: ::grpc::RequestOptions, p: super::service::TxFilter) -> ::grpc::SingleResponse { - self.grpc_client.call_unary(o, p, self.method_GetTransaction.clone()) + pub fn get_transaction(&self, o: ::grpc::RequestOptions, req: super::service::TxFilter) -> ::grpc::SingleResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_unary(o, req, descriptor) } - fn send_transaction(&self, o: ::grpc::RequestOptions, p: super::service::RawTransaction) -> ::grpc::SingleResponse { - self.grpc_client.call_unary(o, p, self.method_SendTransaction.clone()) + pub fn send_transaction(&self, o: ::grpc::RequestOptions, req: super::service::RawTransaction) -> ::grpc::SingleResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_unary(o, req, descriptor) + } + + pub fn get_address_txids(&self, o: ::grpc::RequestOptions, req: super::service::TransparentAddressBlockFilter) -> ::grpc::StreamingResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressTxids"), + streaming: ::grpc::rt::GrpcStreaming::ServerStreaming, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_server_streaming(o, req, descriptor) + } + + pub fn get_lightd_info(&self, o: ::grpc::RequestOptions, req: super::service::Empty) -> ::grpc::SingleResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_unary(o, req, descriptor) + } + + pub fn ping(&self, o: ::grpc::RequestOptions, req: super::service::Duration) -> ::grpc::SingleResponse { + let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }); + self.grpc_client.call_unary(o, req, descriptor) } } @@ -115,63 +146,99 @@ impl CompactTxStreamerServer { ::grpc::rt::ServerServiceDefinition::new("/cash.z.wallet.sdk.rpc.CompactTxStreamer", vec![ ::grpc::rt::ServerMethod::new( - ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock".to_string(), + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock"), streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), }), { let handler_copy = handler_arc.clone(); - ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.get_latest_block(o, p)) + ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_latest_block(ctx, req, resp)) }, ), ::grpc::rt::ServerMethod::new( - ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock".to_string(), + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock"), streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), }), { let handler_copy = handler_arc.clone(); - ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.get_block(o, p)) + ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_block(ctx, req, resp)) }, ), ::grpc::rt::ServerMethod::new( - ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange".to_string(), + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange"), streaming: ::grpc::rt::GrpcStreaming::ServerStreaming, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), }), { let handler_copy = handler_arc.clone(); - ::grpc::rt::MethodHandlerServerStreaming::new(move |o, p| handler_copy.get_block_range(o, p)) + ::grpc::rt::MethodHandlerServerStreaming::new(move |ctx, req, resp| (*handler_copy).get_block_range(ctx, req, resp)) }, ), ::grpc::rt::ServerMethod::new( - ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction".to_string(), + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction"), streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), }), { let handler_copy = handler_arc.clone(); - ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.get_transaction(o, p)) + ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_transaction(ctx, req, resp)) }, ), ::grpc::rt::ServerMethod::new( - ::std::sync::Arc::new(::grpc::rt::MethodDescriptor { - name: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction".to_string(), + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction"), streaming: ::grpc::rt::GrpcStreaming::Unary, - req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), - resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf), + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), }), { let handler_copy = handler_arc.clone(); - ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.send_transaction(o, p)) + ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).send_transaction(ctx, req, resp)) + }, + ), + ::grpc::rt::ServerMethod::new( + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressTxids"), + streaming: ::grpc::rt::GrpcStreaming::ServerStreaming, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }), + { + let handler_copy = handler_arc.clone(); + ::grpc::rt::MethodHandlerServerStreaming::new(move |ctx, req, resp| (*handler_copy).get_address_txids(ctx, req, resp)) + }, + ), + ::grpc::rt::ServerMethod::new( + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }), + { + let handler_copy = handler_arc.clone(); + ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_lightd_info(ctx, req, resp)) + }, + ), + ::grpc::rt::ServerMethod::new( + ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor { + name: ::grpc::rt::StringOrStatic::Static("/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping"), + streaming: ::grpc::rt::GrpcStreaming::Unary, + req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf), + }), + { + let handler_copy = handler_arc.clone(); + ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).ping(ctx, req, resp)) }, ), ], diff --git a/src/main/rust/bin/update_sapling_tree.rs b/src/main/rust/bin/update_sapling_tree.rs index 8d3c79a5..1e22c8a2 100644 --- a/src/main/rust/bin/update_sapling_tree.rs +++ b/src/main/rust/bin/update_sapling_tree.rs @@ -1,32 +1,15 @@ -extern crate ff; -extern crate futures; -extern crate grpc; -extern crate hex; -extern crate httpbis; -extern crate pairing; -extern crate protobuf; -extern crate tls_api; -extern crate tls_api_rustls; -extern crate zcash_client_backend; -extern crate zcash_primitives; - mod service; mod service_grpc; -use ff::{PrimeField, PrimeFieldRepr}; -use futures::Stream; +use futures::executor; use grpc::ClientStub; use httpbis::ClientTlsOption; -use pairing::bls12_381::{Fr, FrRepr}; use std::env; -use std::net::ToSocketAddrs; use std::sync::Arc; use tls_api::{TlsConnector, TlsConnectorBuilder}; use zcash_client_backend::proto::compact_formats; use zcash_primitives::{merkle_tree::CommitmentTree, sapling::Node}; -use service_grpc::CompactTxStreamer; - #[cfg(feature = "mainnet")] const START_HEIGHT: u64 = 419200; #[cfg(feature = "mainnet")] @@ -112,15 +95,6 @@ fn main() -> Result<(), Error> { let mut start_height = START_HEIGHT; let mut tree = CommitmentTree::new(); - // If LIGHTWALLETD_HOST is behind a load balancer which resolves to multiple IP - // addresses, we need to select one ourselves and then use it directly, as a - // workaround for https://github.com/stepancheg/rust-http2/issues/7 - let socket = (LIGHTWALLETD_HOST, LIGHTWALLETD_PORT) - .to_socket_addrs()? - .into_iter() - .next() - .expect("LIGHTWALLETD_HOST can be resolved"); - let tls = { let mut tls_connector = tls_api_rustls::TlsConnector::builder()?; @@ -134,14 +108,10 @@ fn main() -> Result<(), Error> { ClientTlsOption::Tls(LIGHTWALLETD_HOST.to_owned(), tls_connector) }; - let client_conf = Default::default(); - let client = grpc::Client::new_expl::( - &socket, - LIGHTWALLETD_HOST, - tls, - client_conf, - ) - .map(|c| service_grpc::CompactTxStreamerClient::with_client(Arc::new(c)))?; + let client = grpc::ClientBuilder::new(LIGHTWALLETD_HOST, LIGHTWALLETD_PORT) + .explicit_tls(tls) + .build() + .map(|c| service_grpc::CompactTxStreamerClient::with_client(Arc::new(c)))?; loop { // Get the latest height @@ -161,10 +131,11 @@ fn main() -> Result<(), Error> { let mut range = service::BlockRange::new(); range.set_start(start); range.set_end(end); - let blocks = client - .get_block_range(grpc::RequestOptions::new(), range) - .drop_metadata() - .wait(); + let blocks = executor::block_on_stream( + client + .get_block_range(grpc::RequestOptions::new(), range) + .drop_metadata(), + ); let mut end_hash = vec![]; let mut end_time = 0; @@ -176,10 +147,11 @@ fn main() -> Result<(), Error> { for tx in block.vtx.iter() { for output in tx.outputs.iter() { // Append commitment to tree - let mut repr = FrRepr::default(); - repr.read_le(&output.cmu[..])?; - let cmu = Fr::from_repr(repr).map_err(|_| Error::InvalidBlock)?; - let node = Node::new(cmu.into_repr()); + let mut repr = [0u8; 32]; + repr.copy_from_slice(&output.cmu[..]); + let cmu: bls12_381::Scalar = Option::from(bls12_381::Scalar::from_bytes(&repr)) + .ok_or(Error::InvalidBlock)?; + let node = Node::new(cmu.to_bytes()); tree.append(node).expect("tree is not full"); } }