Add JNI methods for handling chain validity and reorgs

This commit is contained in:
Jack Grigg 2019-05-02 23:40:58 +01:00
parent 0591784ce4
commit 4948617d6d
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
10 changed files with 139 additions and 70 deletions

108
Cargo.lock generated
View File

@ -102,17 +102,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bellman"
version = "0.1.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"group 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"group 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -363,17 +363,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ff"
version = "0.4.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ff_derive 0.3.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff_derive 0.3.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ff_derive"
version = "0.3.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
@ -447,9 +447,9 @@ dependencies = [
[[package]]
name = "group"
version = "0.1.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -724,11 +724,11 @@ dependencies = [
[[package]]
name = "pairing"
version = "0.14.2"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"group 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"group 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -960,14 +960,14 @@ dependencies = [
[[package]]
name = "sapling-crypto"
version = "0.0.1"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"bellman 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"bellman 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"blake2-rfc 0.2.18 (git+https://github.com/gtank/blake2-rfc?rev=7a5b5fc99ae483a0043db7547fb79a6fa44b88a9)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1415,86 +1415,86 @@ version = "0.0.1"
dependencies = [
"android_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"grpc 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"jni 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_client_backend 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_proofs 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_client_backend 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_proofs 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
]
[[package]]
name = "zcash_client_backend"
version = "0.0.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"bech32 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf-codegen-pure 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
]
[[package]]
name = "zcash_client_sqlite"
version = "0.0.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"bech32 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rusqlite 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_client_backend 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_client_backend 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
]
[[package]]
name = "zcash_primitives"
version = "0.0.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"aes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2-rfc 0.2.18 (git+https://github.com/gtank/blake2-rfc?rev=7a5b5fc99ae483a0043db7547fb79a6fa44b88a9)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crypto_api_chachapoly 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"fpe 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zcash_proofs"
version = "0.0.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307#10039b3e9cbd97a1c633e69100aa4a179f7e4307"
source = "git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6#b12ff574992219c39c694143e7faa11f095305b6"
dependencies = [
"bellman 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"bellman 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"blake2-rfc 0.2.18 (git+https://github.com/gtank/blake2-rfc?rev=7a5b5fc99ae483a0043db7547fb79a6fa44b88a9)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)",
"sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
"zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)",
]
[metadata]
@ -1510,7 +1510,7 @@ dependencies = [
"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
"checksum bech32 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "58946044516aa9dc922182e0d6e9d124a31aafe6b421614654eb27cf90cec09c"
"checksum bellman 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum bellman 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum blake2-rfc 0.2.18 (git+https://github.com/gtank/blake2-rfc?rev=7a5b5fc99ae483a0043db7547fb79a6fa44b88a9)" = "<none>"
@ -1543,8 +1543,8 @@ dependencies = [
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum ff_derive 0.3.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum ff 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum ff_derive 0.3.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum fpe 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce3371c82bfbd984f624cab093f55e7336f5a6e589f8518e1258f54f011b89ad"
"checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
@ -1553,7 +1553,7 @@ dependencies = [
"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4"
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
"checksum group 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum group 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum grpc 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8e530ef7894a104a1c8525ce68787b3491efa2098ce5e5454e8324ea78893548"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
"checksum httpbis 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7689cfa896b2a71da4f16206af167542b75d242b6906313e53857972a92d5614"
@ -1585,7 +1585,7 @@ dependencies = [
"checksum opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d620c9c26834b34f039489ac0dfdb12c7ac15ccaf818350a64c9b5334a452ad7"
"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
"checksum pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum pairing 0.14.2 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
@ -1612,7 +1612,7 @@ dependencies = [
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9"
"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
"checksum sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum sapling-crypto 0.0.1 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
@ -1660,7 +1660,7 @@ dependencies = [
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum zcash_client_backend 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum zcash_proofs 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=10039b3e9cbd97a1c633e69100aa4a179f7e4307)" = "<none>"
"checksum zcash_client_backend 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum zcash_primitives 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"
"checksum zcash_proofs 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=b12ff574992219c39c694143e7faa11f095305b6)" = "<none>"

View File

@ -22,31 +22,31 @@ protobuf = { version = "2", optional = true }
[dependencies.ff]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[dependencies.pairing]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[dependencies.sapling-crypto]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[dependencies.zcash_client_backend]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[dependencies.zcash_client_sqlite]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[dependencies.zcash_primitives]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[dependencies.zcash_proofs]
git = "https://github.com/str4d/librustzcash.git"
rev = "10039b3e9cbd97a1c633e69100aa4a179f7e4307"
rev = "b12ff574992219c39c694143e7faa11f095305b6"
[features]
mainnet = ["zcash_client_sqlite/mainnet"]

View File

@ -1,5 +1,6 @@
{
"height": 280000,
"hash": "000420e7fcc3a49d729479fb0b560dd7b8617b178a08e9e389620a9d1dd6361a",
"time": 1535262293,
"tree": "000000"
}

View File

@ -1,5 +1,6 @@
{
"height": 421720,
"hash": "001ede53476a31a91da3313eddf4e41409fb7f4e003840700557b576024d09b4",
"time": 1550762014,
"tree": "015495a30aef9e18b9c774df6a9fcd583748c8bba1a6348e70f59bc9f0c2bc673b000f00000000018054b75173b577dc36f2c80dfc41f83d6716557597f74ec54436df32d4466d57000120f1825067a52ca973b07431199d5866a0d46ef231d08aa2f544665936d5b4520168d782e3d028131f59e9296c75de5a101898c5e53108e45baa223c608d6c3d3d01fb0a8d465b57c15d793c742df9470b116ddf06bd30d42123fdb7becef1fd63640001a86b141bdb55fd5f5b2e880ea4e07caf2bbf1ac7b52a9f504977913068a917270001dd960b6c11b157d1626f0768ec099af9385aea3f31c91111a8c5b899ffb99e6b0192acd61b1853311b0bf166057ca433e231c93ab5988844a09a91c113ebc58e18019fbfd76ad6d98cafa0174391546e7022afe62e870e20e16d57c4c419a5c2bb69"
}

View File

@ -1,5 +1,6 @@
{
"height": 425865,
"hash": "0011c4de26004e564347b8af218ca16cd07b08c4159b1cc9c43afa6cb8807bed",
"time": 1551215770,
"tree": "01881e4da7e4767ee8a144a32ab8a5719a513bb05854477773bb55e6cd7f15055201f8a99a3a5ae3528ec2fc0bda9652b6728aecb08bf364e06ac511fd6654d782720f019ef0b9bdd075c38519fa4ab8210fe7e94c609f52672796e33e3cab58b1602831000001f803bf338ff1526b2ca527288974cb9be3fe240a2eadb7507e46ba59eaddb9320129fc0148ac088a6aa509f8f64ef79fda92232020369b58a12b32c05b6f428f22015e3dd0950c442940bd015c2176f7c817f22104f54c61159727483188c539dc13000000013589be9e2d9e9e38fd78b1e8eaec5b5f5167bf7fd2b1c95c316fa366a24cac4c01a86b141bdb55fd5f5b2e880ea4e07caf2bbf1ac7b52a9f504977913068a917270001dd960b6c11b157d1626f0768ec099af9385aea3f31c91111a8c5b899ffb99e6b0192acd61b1853311b0bf166057ca433e231c93ab5988844a09a91c113ebc58e18019fbfd76ad6d98cafa0174391546e7022afe62e870e20e16d57c4c419a5c2bb69"
}

View File

@ -20,6 +20,7 @@ class JniConverter {
external fun initBlocksTable(
dbData: String,
height: Int,
hash: String,
time: Long,
saplingTree: String): Boolean
@ -33,6 +34,10 @@ class JniConverter {
external fun getSentMemoAsUtf8(dbData: String, idNote: Long): String
external fun validateCombinedChain(db_cache: String, db_data: String): Int
external fun rewindToHeight(db_data: String, height: Int): Boolean
external fun scanBlocks(db_cache: String, db_data: String): Boolean
external fun sendToAddress(

View File

@ -79,7 +79,7 @@ class Wallet(
twig("Initializing wallet for first run")
converter.initDataDb(dataDbPath)
twig("seeding the database with sapling tree at height ${birthday.height}")
converter.initBlocksTable(dataDbPath, birthday.height, birthday.time, birthday.tree)
converter.initBlocksTable(dataDbPath, birthday.height, birthday.hash, birthday.time, birthday.tree)
// store the spendingkey by leveraging the utilities provided during construction
val seed by seedProvider
@ -314,6 +314,7 @@ class Wallet(
* New wallets can ignore any blocks created before their birthday.
*
* @param height the height at the time the wallet was born
* @param hash the block hash corresponding to the given height
* @param time the time the wallet was born, in seconds
* @param tree the sapling tree corresponding to the given height. This takes around 15 minutes of processing to
* generate from scratch because all blocks since activation need to be considered. So when it is calculated in
@ -321,6 +322,7 @@ class Wallet(
*/
data class WalletBirthday(
val height: Int = -1,
val hash: String = "",
val time: Long = -1,
val tree: String = ""
)

View File

@ -13,9 +13,10 @@ message CompactBlock {
uint32 protoVersion = 1; // the version of this wire format, for storage
uint64 height = 2; // the height of this block
bytes hash = 3;
uint32 time = 4;
bytes header = 5; // (hash and time) OR (full header)
repeated CompactTx vtx = 6; // compact transactions from this block
bytes prevHash = 4;
uint32 time = 5;
bytes header = 6; // (hash, prevHash, and time) OR (full header)
repeated CompactTx vtx = 7; // compact transactions from this block
}
message CompactTx {

View File

@ -23,11 +23,13 @@ const LIGHTWALLETD_HOST: &str = "lightwalletd.z.cash";
const LIGHTWALLETD_PORT: u16 = 9067;
const BATCH_SIZE: u64 = 10_000;
fn print_sapling_tree(height: u64, time: u32, tree: CommitmentTree<Node>) {
fn print_sapling_tree(height: u64, mut hash: Vec<u8>, time: u32, tree: CommitmentTree<Node>) {
hash.reverse();
let mut tree_bytes = vec![];
tree.write(&mut tree_bytes).unwrap();
println!("{{");
println!(" \"height\": {},", height);
println!(" \"hash\": {},", hex::encode(hash));
println!(" \"time\": {},", time);
println!(" \"tree\": \"{}\",", hex::encode(tree_bytes));
println!("}}");
@ -73,10 +75,12 @@ fn main() {
.drop_metadata()
.wait();
let mut end_hash = vec![];
let mut end_time = 0;
let mut parsed = 0;
for block in blocks {
let block = block.unwrap();
end_hash = block.hash;
end_time = block.time;
for tx in block.vtx.iter() {
for output in tx.outputs.iter() {
@ -93,7 +97,7 @@ fn main() {
println!("Parsed {} blocks", parsed);
if end_height == latest_height {
print_sapling_tree(end_height, end_time, tree);
print_sapling_tree(end_height, end_hash, end_time, tree);
break;
} else {
start_height = end_height + 1

View File

@ -22,12 +22,14 @@ use zcash_client_backend::{
keys::spending_key,
};
use zcash_client_sqlite::{
chain::{rewind_to_height, validate_combined_chain},
get_address, get_balance, get_received_memo_as_utf8, get_sent_memo_as_utf8,
get_verified_balance, init_accounts_table, init_blocks_table, init_data_database,
scan_cached_blocks, send_to_address,
scan_cached_blocks, send_to_address, ErrorKind,
};
use zcash_primitives::{
note_encryption::Memo, transaction::components::Amount, zip32::ExtendedFullViewingKey,
block::BlockHash, note_encryption::Memo, transaction::components::Amount,
zip32::ExtendedFullViewingKey,
};
use zcash_proofs::prover::LocalTxProver;
@ -124,11 +126,17 @@ pub unsafe extern "C" fn Java_cash_z_wallet_sdk_jni_JniConverter_initBlocksTable
_: JClass<'_>,
db_data: JString<'_>,
height: jint,
hash_string: JString<'_>,
time: jlong,
sapling_tree_string: JString<'_>,
) -> jboolean {
let res = panic::catch_unwind(|| {
let db_data = utils::java_string_to_rust(&env, db_data);
let hash = {
let mut hash = hex::decode(utils::java_string_to_rust(&env, hash_string)).unwrap();
hash.reverse();
BlockHash::from_slice(&hash)
};
let time = if time >= 0 && time <= jlong::from(u32::max_value()) {
time as u32
} else {
@ -137,7 +145,7 @@ pub unsafe extern "C" fn Java_cash_z_wallet_sdk_jni_JniConverter_initBlocksTable
let sapling_tree =
hex::decode(utils::java_string_to_rust(&env, sapling_tree_string)).unwrap();
match init_blocks_table(&db_data, height, time, &sapling_tree) {
match init_blocks_table(&db_data, height, hash, time, &sapling_tree) {
Ok(()) => Ok(JNI_TRUE),
Err(e) => Err(format_err!("Error while initializing blocks table: {}", e)),
}
@ -259,6 +267,52 @@ pub unsafe extern "C" fn Java_cash_z_wallet_sdk_jni_JniConverter_getSentMemoAsUt
unwrap_exc_or(&env, res, ptr::null_mut())
}
#[no_mangle]
pub unsafe extern "C" fn Java_cash_z_wallet_sdk_jni_JniConverter_validateCombinedChain(
env: JNIEnv<'_>,
_: JClass<'_>,
db_cache: JString<'_>,
db_data: JString<'_>,
) -> jint {
let res = panic::catch_unwind(|| {
let db_cache = utils::java_string_to_rust(&env, db_cache);
let db_data = utils::java_string_to_rust(&env, db_data);
if let Err(e) = validate_combined_chain(&db_cache, &db_data) {
match e.kind() {
ErrorKind::InvalidChain(upper_bound, _) => Ok(*upper_bound),
_ => Err(format_err!("Error while validating chain: {}", e)),
}
} else {
// All blocks are valid, so "highest invalid block height" is below genesis.
Ok(-1)
}
});
unwrap_exc_or(&env, res, 0)
}
#[no_mangle]
pub unsafe extern "C" fn Java_cash_z_wallet_sdk_jni_JniConverter_rewindToHeight(
env: JNIEnv<'_>,
_: JClass<'_>,
db_data: JString<'_>,
height: jint,
) -> jboolean {
let res = panic::catch_unwind(|| {
let db_data = utils::java_string_to_rust(&env, db_data);
match rewind_to_height(&db_data, height) {
Ok(()) => Ok(JNI_TRUE),
Err(e) => Err(format_err!(
"Error while rewinding data DB to height {}: {}",
height,
e
)),
}
});
unwrap_exc_or(&env, res, JNI_FALSE)
}
#[no_mangle]
pub unsafe extern "C" fn Java_cash_z_wallet_sdk_jni_JniConverter_scanBlocks(
env: JNIEnv<'_>,