rust: Migrate to latest upstream Zcash crates
This commit is contained in:
parent
4d7d0bf64b
commit
4a37f3976f
|
@ -17,15 +17,6 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aead"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877"
|
||||
dependencies = [
|
||||
"generic-array 0.14.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aead"
|
||||
version = "0.5.1"
|
||||
|
@ -50,9 +41,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.4.7"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
|
@ -338,18 +334,6 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chacha20"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cipher 0.3.0",
|
||||
"cpufeatures",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chacha20"
|
||||
version = "0.9.0"
|
||||
|
@ -361,29 +345,16 @@ dependencies = [
|
|||
"cpufeatures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chacha20poly1305"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5"
|
||||
dependencies = [
|
||||
"aead 0.4.3",
|
||||
"chacha20 0.8.2",
|
||||
"cipher 0.3.0",
|
||||
"poly1305 0.7.2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chacha20poly1305"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
|
||||
dependencies = [
|
||||
"aead 0.5.1",
|
||||
"chacha20 0.9.0",
|
||||
"aead",
|
||||
"chacha20",
|
||||
"cipher 0.4.3",
|
||||
"poly1305 0.8.0",
|
||||
"poly1305",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
|
@ -494,6 +465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array 0.14.6",
|
||||
"rand_core",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
|
@ -589,7 +561,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "equihash"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"blake2b_simd",
|
||||
"byteorder",
|
||||
|
@ -598,7 +570,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "f4jumble"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"blake2b_simd",
|
||||
]
|
||||
|
@ -712,10 +684,12 @@ checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
|
|||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/zkcrypto/group.git?rev=a7f3ceb2373e9fe536996f7b4d55c797f3e667f0#a7f3ceb2373e9fe536996f7b4d55c797f3e667f0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
|
||||
dependencies = [
|
||||
"ff",
|
||||
"memuse",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
@ -755,18 +729,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.9.1"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d99cf782f0dc4372d26846bec3de7804ceb5df083c2d4462c0b8d2330e894fa8"
|
||||
checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
@ -907,9 +881,9 @@ checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565"
|
|||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.20.1"
|
||||
version = "0.22.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64d31059f22935e6c31830db5249ba2b7ecd54fd73a9909286f0a67aa55c2fbd"
|
||||
checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
|
@ -1059,7 +1033,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
|||
[[package]]
|
||||
name = "orchard"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/zcash/orchard.git?rev=f206b3f5d4e31bba75d03d9d03d5fa25825a9384#f206b3f5d4e31bba75d03d9d03d5fa25825a9384"
|
||||
source = "git+https://github.com/zcash/orchard.git?rev=4035a97d178f99bb889f4d7ed26c59378fa88961#4035a97d178f99bb889f4d7ed26c59378fa88961"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"bitvec",
|
||||
|
@ -1080,7 +1054,7 @@ dependencies = [
|
|||
"serde",
|
||||
"subtle",
|
||||
"tracing",
|
||||
"zcash_note_encryption",
|
||||
"zcash_note_encryption 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1155,17 +1129,6 @@ version = "0.3.25"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
||||
|
||||
[[package]]
|
||||
name = "poly1305"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede"
|
||||
dependencies = [
|
||||
"cpufeatures",
|
||||
"opaque-debug 0.3.0",
|
||||
"universal-hash 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "poly1305"
|
||||
version = "0.8.0"
|
||||
|
@ -1174,7 +1137,7 @@ checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
|
|||
dependencies = [
|
||||
"cpufeatures",
|
||||
"opaque-debug 0.3.0",
|
||||
"universal-hash 0.5.0",
|
||||
"universal-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1399,9 +1362,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.24.2"
|
||||
version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5f38ee71cbab2c827ec0ac24e76f82eca723cee92c509a65f67dee393c25112"
|
||||
checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fallible-iterator",
|
||||
|
@ -1446,8 +1409,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "schemer"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48f0ed79b582101b59740acd981e58eaa3bf8c4b1179e9a0124a7df1e08e98b3"
|
||||
source = "git+https://github.com/aschampion/schemer.git?rev=6726b60f43f72c6e24a18d31be0ec7d42829e5e1#6726b60f43f72c6e24a18d31be0ec7d42829e5e1"
|
||||
dependencies = [
|
||||
"daggy",
|
||||
"log",
|
||||
|
@ -1458,8 +1420,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "schemer-rusqlite"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f2b83ba5d80561f0ac602bd539a22d34015e332b82dd9d29c94aa84adbd55d7"
|
||||
source = "git+https://github.com/aschampion/schemer.git?rev=6726b60f43f72c6e24a18d31be0ec7d42829e5e1#6726b60f43f72c6e24a18d31be0ec7d42829e5e1"
|
||||
dependencies = [
|
||||
"rusqlite",
|
||||
"schemer",
|
||||
|
@ -1839,16 +1800,6 @@ version = "0.2.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||
|
||||
[[package]]
|
||||
name = "universal-hash"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05"
|
||||
dependencies = [
|
||||
"generic-array 0.14.6",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "universal-hash"
|
||||
version = "0.5.0"
|
||||
|
@ -2029,7 +1980,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zcash_address"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"bech32",
|
||||
"bs58",
|
||||
|
@ -2040,7 +1991,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zcash_client_backend"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bech32",
|
||||
|
@ -2048,12 +1999,10 @@ dependencies = [
|
|||
"bs58",
|
||||
"byteorder",
|
||||
"crossbeam-channel",
|
||||
"ff",
|
||||
"group",
|
||||
"hdwallet",
|
||||
"hex",
|
||||
"jubjub",
|
||||
"log",
|
||||
"memuse",
|
||||
"nom",
|
||||
"orchard",
|
||||
|
@ -2071,18 +2020,17 @@ dependencies = [
|
|||
"tracing",
|
||||
"zcash_address",
|
||||
"zcash_encoding",
|
||||
"zcash_note_encryption",
|
||||
"zcash_note_encryption 0.2.0 (git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24)",
|
||||
"zcash_primitives",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zcash_client_sqlite"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"bech32",
|
||||
"bs58",
|
||||
"ff",
|
||||
"group",
|
||||
"hdwallet",
|
||||
"jubjub",
|
||||
|
@ -2091,7 +2039,6 @@ dependencies = [
|
|||
"rusqlite",
|
||||
"schemer",
|
||||
"schemer-rusqlite",
|
||||
"secp256k1",
|
||||
"secrecy",
|
||||
"time",
|
||||
"uuid",
|
||||
|
@ -2102,7 +2049,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zcash_encoding"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"nonempty",
|
||||
|
@ -2110,13 +2057,25 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zcash_note_encryption"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2be9c12532389fd03786b7068fb7936c17fade23b48f584707bdc5f79f3ec867"
|
||||
dependencies = [
|
||||
"chacha20 0.9.0",
|
||||
"chacha20poly1305 0.10.1",
|
||||
"chacha20",
|
||||
"chacha20poly1305",
|
||||
"cipher 0.4.3",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zcash_note_encryption"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"chacha20",
|
||||
"chacha20poly1305",
|
||||
"cipher 0.4.3",
|
||||
"group",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
@ -2124,7 +2083,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zcash_primitives"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"bip0039",
|
||||
|
@ -2134,7 +2093,7 @@ dependencies = [
|
|||
"bls12_381",
|
||||
"bs58",
|
||||
"byteorder",
|
||||
"chacha20poly1305 0.9.1",
|
||||
"chacha20poly1305",
|
||||
"equihash",
|
||||
"ff",
|
||||
"fpe",
|
||||
|
@ -2155,20 +2114,19 @@ dependencies = [
|
|||
"subtle",
|
||||
"zcash_address",
|
||||
"zcash_encoding",
|
||||
"zcash_note_encryption",
|
||||
"zcash_note_encryption 0.2.0 (git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zcash_proofs"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=774ffadf5a0120a74d70d281974d079ccd58c600#774ffadf5a0120a74d70d281974d079ccd58c600"
|
||||
source = "git+https://github.com/zcash/librustzcash.git?rev=b3dc323876e07d990392855c30a2958d37750e24#b3dc323876e07d990392855c30a2958d37750e24"
|
||||
dependencies = [
|
||||
"bellman",
|
||||
"blake2b_simd",
|
||||
"bls12_381",
|
||||
"byteorder",
|
||||
"directories",
|
||||
"ff",
|
||||
"group",
|
||||
"jubjub",
|
||||
"lazy_static",
|
||||
|
|
|
@ -29,14 +29,14 @@ zcash_proofs = "0.7"
|
|||
|
||||
# Revision corresponds to the pending zcash_primitives 0.8.0.
|
||||
[patch.crates-io]
|
||||
group = { git = "https://github.com/zkcrypto/group.git", rev = "a7f3ceb2373e9fe536996f7b4d55c797f3e667f0" }
|
||||
orchard = { git = 'https://github.com/zcash/orchard.git', rev='f206b3f5d4e31bba75d03d9d03d5fa25825a9384' }
|
||||
zcash_address = { git = 'https://github.com/zcash/librustzcash.git', rev='774ffadf5a0120a74d70d281974d079ccd58c600' }
|
||||
zcash_client_backend = { git = 'https://github.com/zcash/librustzcash.git', rev='774ffadf5a0120a74d70d281974d079ccd58c600' }
|
||||
zcash_client_sqlite = { git = 'https://github.com/zcash/librustzcash.git', rev='774ffadf5a0120a74d70d281974d079ccd58c600' }
|
||||
zcash_note_encryption = { git = 'https://github.com/zcash/librustzcash.git', rev='774ffadf5a0120a74d70d281974d079ccd58c600' }
|
||||
zcash_primitives = { git = 'https://github.com/zcash/librustzcash.git', rev='774ffadf5a0120a74d70d281974d079ccd58c600' }
|
||||
zcash_proofs = { git = 'https://github.com/zcash/librustzcash.git', rev='774ffadf5a0120a74d70d281974d079ccd58c600' }
|
||||
orchard = { git = "https://github.com/zcash/orchard.git", rev = "4035a97d178f99bb889f4d7ed26c59378fa88961" }
|
||||
schemer = { git = "https://github.com/aschampion/schemer.git", rev = "6726b60f43f72c6e24a18d31be0ec7d42829e5e1" }
|
||||
schemer-rusqlite = { git = "https://github.com/aschampion/schemer.git", rev = "6726b60f43f72c6e24a18d31be0ec7d42829e5e1" }
|
||||
zcash_address = { git = 'https://github.com/zcash/librustzcash.git', rev='b3dc323876e07d990392855c30a2958d37750e24' }
|
||||
zcash_client_backend = { git = 'https://github.com/zcash/librustzcash.git', rev='b3dc323876e07d990392855c30a2958d37750e24' }
|
||||
zcash_client_sqlite = { git = 'https://github.com/zcash/librustzcash.git', rev='b3dc323876e07d990392855c30a2958d37750e24' }
|
||||
zcash_primitives = { git = 'https://github.com/zcash/librustzcash.git', rev='b3dc323876e07d990392855c30a2958d37750e24' }
|
||||
zcash_proofs = { git = 'https://github.com/zcash/librustzcash.git', rev='b3dc323876e07d990392855c30a2958d37750e24' }
|
||||
|
||||
## Uncomment this to test librustzcash changes locally
|
||||
#[patch.crates-io]
|
||||
|
|
|
@ -559,8 +559,15 @@ class CompactBlockProcessor internal constructor(
|
|||
): Int = withContext(IO) {
|
||||
var skipped = 0
|
||||
val aboveHeight = startHeight
|
||||
twig("Clearing utxos above height $aboveHeight", -1)
|
||||
rustBackend.clearUtxos(tAddress, aboveHeight)
|
||||
// TODO(str4d): We no longer clear UTXOs here, as rustBackend.putUtxo now uses an upsert instead of an insert.
|
||||
// This means that now-spent UTXOs would previously have been deleted, but now are left in the database (like
|
||||
// shielded notes). Due to the fact that the lightwalletd query only returns _current_ UTXOs, we don't learn
|
||||
// about recently-spent UTXOs here, so the transparent balance does not get updated here. Instead, when a
|
||||
// received shielded note is "enhanced" by downloading the full transaction, we mark any UTXOs spent in that
|
||||
// transaction as spent in the database. This relies on two current properties: UTXOs are only ever spent in
|
||||
// shielding transactions, and at least one shielded note from each shielding transaction is always enhanced.
|
||||
// However, for greater reliability, we may want to alter the Data Access API to support "inferring spentness"
|
||||
// from what is _not_ returned as a UTXO, or alternatively fetch TXOs from lightwalletd instead of just UTXOs.
|
||||
twig("Checking for UTXOs above height $aboveHeight")
|
||||
result.forEach { utxo: Service.GetAddressUtxosReply ->
|
||||
twig("Found UTXO at height ${utxo.height.toInt()} with ${utxo.valueZat} zatoshi")
|
||||
|
|
|
@ -232,7 +232,6 @@ internal class RustBackend private constructor(
|
|||
): Long = withContext(SdkDispatchers.DATABASE_IO) {
|
||||
createToAddress(
|
||||
dataDbFile.absolutePath,
|
||||
usk.account.value,
|
||||
usk.copyBytes(),
|
||||
to,
|
||||
value,
|
||||
|
@ -251,7 +250,6 @@ internal class RustBackend private constructor(
|
|||
return withContext(SdkDispatchers.DATABASE_IO) {
|
||||
shieldToAddress(
|
||||
dataDbFile.absolutePath,
|
||||
usk.account.value,
|
||||
usk.copyBytes(),
|
||||
memo ?: ByteArray(0),
|
||||
"$pathParamsDir/$SPEND_PARAM_FILE_NAME",
|
||||
|
@ -281,20 +279,6 @@ internal class RustBackend private constructor(
|
|||
)
|
||||
}
|
||||
|
||||
override suspend fun clearUtxos(
|
||||
tAddress: String,
|
||||
aboveHeightInclusive: BlockHeight
|
||||
): Boolean = withContext(SdkDispatchers.DATABASE_IO) {
|
||||
clearUtxos(
|
||||
dataDbFile.absolutePath,
|
||||
tAddress,
|
||||
// The Kotlin API is inclusive, but the Rust API is exclusive.
|
||||
// This can create invalid BlockHeights if the height is saplingActivationHeight.
|
||||
aboveHeightInclusive.value - 1,
|
||||
networkId = network.id
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getDownloadedUtxoBalance(address: String): WalletBalance {
|
||||
val verified = withContext(SdkDispatchers.DATABASE_IO) {
|
||||
getVerifiedTransparentBalance(
|
||||
|
@ -514,7 +498,6 @@ internal class RustBackend private constructor(
|
|||
@Suppress("LongParameterList")
|
||||
private external fun createToAddress(
|
||||
dbDataPath: String,
|
||||
account: Int,
|
||||
usk: ByteArray,
|
||||
to: String,
|
||||
value: Long,
|
||||
|
@ -528,7 +511,6 @@ internal class RustBackend private constructor(
|
|||
@Suppress("LongParameterList")
|
||||
private external fun shieldToAddress(
|
||||
dbDataPath: String,
|
||||
account: Int,
|
||||
usk: ByteArray,
|
||||
memo: ByteArray,
|
||||
spendParamsPath: String,
|
||||
|
@ -555,14 +537,6 @@ internal class RustBackend private constructor(
|
|||
networkId: Int
|
||||
): Boolean
|
||||
|
||||
@JvmStatic
|
||||
private external fun clearUtxos(
|
||||
dbDataPath: String,
|
||||
tAddress: String,
|
||||
aboveHeight: Long,
|
||||
networkId: Int
|
||||
): Boolean
|
||||
|
||||
@JvmStatic
|
||||
private external fun getVerifiedTransparentBalance(
|
||||
pathDataDb: String,
|
||||
|
|
|
@ -90,11 +90,6 @@ internal interface RustBackendWelding {
|
|||
height: BlockHeight
|
||||
): Boolean
|
||||
|
||||
suspend fun clearUtxos(
|
||||
tAddress: String,
|
||||
aboveHeightInclusive: BlockHeight = BlockHeight(network.saplingActivationHeight.value)
|
||||
): Boolean
|
||||
|
||||
suspend fun getDownloadedUtxoBalance(address: String): WalletBalance
|
||||
|
||||
// Implemented by `DerivationTool`
|
||||
|
|
|
@ -31,18 +31,17 @@ use zcash_client_backend::{
|
|||
wallet::{
|
||||
create_spend_to_address, decrypt_and_store_transaction, shield_transparent_funds,
|
||||
},
|
||||
WalletRead, WalletReadTransparent, WalletWrite, WalletWriteTransparent,
|
||||
WalletRead, WalletWrite,
|
||||
},
|
||||
encoding::AddressCodec,
|
||||
keys::{Era, UnifiedFullViewingKey},
|
||||
wallet::{OvkPolicy, WalletTransparentOutput},
|
||||
};
|
||||
use zcash_client_sqlite::wallet::init::WalletMigrationError;
|
||||
#[allow(deprecated)]
|
||||
use zcash_client_sqlite::wallet::{delete_utxos_above, get_rewind_height};
|
||||
use zcash_client_sqlite::wallet::get_rewind_height;
|
||||
use zcash_client_sqlite::{
|
||||
error::SqliteClientError,
|
||||
wallet::init::{init_accounts_table, init_blocks_table, init_wallet_db},
|
||||
wallet::init::{init_accounts_table, init_blocks_table, init_wallet_db, WalletMigrationError},
|
||||
BlockDb, NoteId, WalletDb,
|
||||
};
|
||||
use zcash_primitives::consensus::Network::{MainNetwork, TestNetwork};
|
||||
|
@ -714,7 +713,7 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_getVerified
|
|||
.map_err(|e| format_err!("Error while fetching verified balance: {}", e))
|
||||
})?
|
||||
.iter()
|
||||
.map(|utxo| utxo.txout.value)
|
||||
.map(|utxo| utxo.txout().value)
|
||||
.sum::<Option<Amount>>()
|
||||
.ok_or_else(|| format_err!("Balance overflowed MAX_MONEY."))?;
|
||||
|
||||
|
@ -752,7 +751,7 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_getTotalTra
|
|||
.map_err(|e| format_err!("Error while fetching verified balance: {}", e))
|
||||
})?
|
||||
.iter()
|
||||
.map(|utxo| utxo.txout.value)
|
||||
.map(|utxo| utxo.txout().value)
|
||||
.sum::<Option<Amount>>()
|
||||
.ok_or_else(|| format_err!("Balance overflowed MAX_MONEY"))?;
|
||||
|
||||
|
@ -994,14 +993,15 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_putUtxo(
|
|||
let addr = utils::java_string_to_rust(&env, address);
|
||||
let _address = TransparentAddress::decode(&network, &addr).unwrap();
|
||||
|
||||
let output = WalletTransparentOutput {
|
||||
outpoint: OutPoint::new(txid, index as u32),
|
||||
txout: TxOut {
|
||||
let output = WalletTransparentOutput::from_parts(
|
||||
OutPoint::new(txid, index as u32),
|
||||
TxOut {
|
||||
value: Amount::from_i64(value).unwrap(),
|
||||
script_pubkey,
|
||||
},
|
||||
height: BlockHeight::from(height as u32),
|
||||
};
|
||||
BlockHeight::from(height as u32),
|
||||
)
|
||||
.ok_or_else(|| format_err!("UTXO is not P2PKH or P2SH"))?;
|
||||
|
||||
debug!("Storing UTXO in db_data");
|
||||
match db_data.put_received_transparent_utxo(&output) {
|
||||
|
@ -1012,36 +1012,6 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_putUtxo(
|
|||
unwrap_exc_or(&env, res, JNI_FALSE)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_clearUtxos(
|
||||
env: JNIEnv<'_>,
|
||||
_: JClass<'_>,
|
||||
db_data: JString<'_>,
|
||||
taddress: JString<'_>,
|
||||
above_height: jlong,
|
||||
network_id: jint,
|
||||
) -> jint {
|
||||
#[allow(deprecated)]
|
||||
let res = panic::catch_unwind(|| {
|
||||
let network = parse_network(network_id as u32)?;
|
||||
let db_data = wallet_db(&env, network, db_data)?;
|
||||
let mut db_data = db_data.get_update_ops()?;
|
||||
let addr = utils::java_string_to_rust(&env, taddress);
|
||||
let taddress = TransparentAddress::decode(&network, &addr).unwrap();
|
||||
let height = BlockHeight::from(above_height as u32);
|
||||
|
||||
debug!(
|
||||
"clearing UTXOs that were found above height: {}",
|
||||
above_height
|
||||
);
|
||||
match delete_utxos_above(&mut db_data, &taddress, height) {
|
||||
Ok(rows) => Ok(rows as i32),
|
||||
Err(e) => Err(format_err!("Error while clearing UTXOs: {}", e)),
|
||||
}
|
||||
});
|
||||
unwrap_exc_or(&env, res, -1)
|
||||
}
|
||||
|
||||
// ADDED BY ANDROID
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_scanBlockBatch(
|
||||
|
@ -1234,7 +1204,6 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_createToAdd
|
|||
env: JNIEnv<'_>,
|
||||
_: JClass<'_>,
|
||||
db_data: JString<'_>,
|
||||
account: jint,
|
||||
usk: jbyteArray,
|
||||
to: JString<'_>,
|
||||
value: jlong,
|
||||
|
@ -1247,11 +1216,6 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_createToAdd
|
|||
let network = parse_network(network_id as u32)?;
|
||||
let db_data = wallet_db(&env, network, db_data)?;
|
||||
let mut db_data = db_data.get_update_ops()?;
|
||||
let account = if account >= 0 {
|
||||
account as u32
|
||||
} else {
|
||||
return Err(format_err!("account argument must be nonnegative"));
|
||||
};
|
||||
let usk = decode_usk(&env, usk)?;
|
||||
let to = utils::java_string_to_rust(&env, to);
|
||||
let value =
|
||||
|
@ -1282,13 +1246,11 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_createToAdd
|
|||
|
||||
let prover = LocalTxProver::new(Path::new(&spend_params), Path::new(&output_params));
|
||||
|
||||
// let branch = if
|
||||
create_spend_to_address(
|
||||
&mut db_data,
|
||||
&network,
|
||||
prover,
|
||||
AccountId::from(account),
|
||||
usk.sapling(),
|
||||
&usk,
|
||||
&to,
|
||||
value,
|
||||
memo,
|
||||
|
@ -1305,7 +1267,6 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_shieldToAdd
|
|||
env: JNIEnv<'_>,
|
||||
_: JClass<'_>,
|
||||
db_data: JString<'_>,
|
||||
account: jint,
|
||||
usk: jbyteArray,
|
||||
memo: jbyteArray,
|
||||
spend_params: JString<'_>,
|
||||
|
@ -1316,11 +1277,6 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_shieldToAdd
|
|||
let network = parse_network(network_id as u32)?;
|
||||
let db_data = wallet_db(&env, network, db_data)?;
|
||||
let mut db_data = db_data.get_update_ops()?;
|
||||
let account = if account >= 0 {
|
||||
account as u32
|
||||
} else {
|
||||
return Err(format_err!("account argument must be nonnegative"));
|
||||
};
|
||||
let usk = decode_usk(&env, usk)?;
|
||||
let memo_bytes = env.convert_byte_array(memo).unwrap();
|
||||
let spend_params = utils::java_string_to_rust(&env, spend_params);
|
||||
|
@ -1334,8 +1290,7 @@ pub unsafe extern "C" fn Java_cash_z_ecc_android_sdk_jni_RustBackend_shieldToAdd
|
|||
&mut db_data,
|
||||
&network,
|
||||
prover,
|
||||
usk.transparent(),
|
||||
AccountId::from(account),
|
||||
&usk,
|
||||
&MemoBytes::from(&memo),
|
||||
0,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue