Always store and update kernel excess (#231)

* always store and update kernel excess

* fix to parent key id on update as caught by testing

* save kernel excess for transaction recipients and coinbase outputs

* rustfmt

* logic cleanup, cargo.lock

* update to use node beta.3 release

* fix to doctests

* check result of calc offset before using

* rustfmt
This commit is contained in:
Yeastplume 2019-10-03 15:15:25 +01:00 committed by GitHub
parent f021e15eb6
commit 2186900faa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 124 additions and 88 deletions

106
Cargo.lock generated
View file

@ -594,18 +594,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "grin_api"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_chain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_p2p 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_pool 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_store 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_chain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_p2p 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_pool 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_store 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-rustls 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -627,8 +627,8 @@ dependencies = [
[[package]]
name = "grin_chain"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -636,10 +636,10 @@ dependencies = [
"croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_keychain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_store 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_keychain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_store 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -650,8 +650,8 @@ dependencies = [
[[package]]
name = "grin_core"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -660,8 +660,8 @@ dependencies = [
"enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_keychain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_keychain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -677,13 +677,13 @@ dependencies = [
[[package]]
name = "grin_keychain"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -700,17 +700,17 @@ dependencies = [
[[package]]
name = "grin_p2p"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_chain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_store 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_chain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_store 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
@ -722,17 +722,17 @@ dependencies = [
[[package]]
name = "grin_pool"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_keychain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_store 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_keychain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_store 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)",
@ -756,16 +756,16 @@ dependencies = [
[[package]]
name = "grin_store"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -777,8 +777,8 @@ dependencies = [
[[package]]
name = "grin_util"
version = "2.1.0-beta.2"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2#751ca065601e4eaf6009dedddd6957758e2c352d"
version = "2.1.0-beta.3"
source = "git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3#b78ace8329c6cee2cee674d1b9c2800a961b8ad4"
dependencies = [
"backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -942,12 +942,12 @@ name = "grin_wallet_util"
version = "2.1.0-beta.2"
dependencies = [
"dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_api 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_chain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_keychain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_store 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)",
"grin_api 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_chain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_keychain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_store 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)",
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2955,15 +2955,15 @@ dependencies = [
"checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571"
"checksum git2 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39f27186fbb5ec67ece9a56990292bc5aed3c3fc51b9b07b0b52446b1dfb4a82"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum grin_api 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_chain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_core 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_keychain 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_p2p 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_pool 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_api 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_chain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_core 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_keychain 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_p2p 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_pool 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_secp256k1zkp 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "23027a7673df2c2b20fb9589d742ff400a10a9c3e4c769a77e9fa3bd19586822"
"checksum grin_store 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_util 2.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.2)" = "<none>"
"checksum grin_store 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum grin_util 2.1.0-beta.3 (git+https://github.com/mimblewimble/grin?tag=v2.1.0-beta.3)" = "<none>"
"checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a"

View file

@ -232,8 +232,8 @@ pub trait OwnerRpc: Sync + Send {
"creation_ts": "2019-01-15T16:01:26Z",
"fee": null,
"id": 0,
"kernel_excess": null,
"kernel_lookup_min_height": null,
"kernel_excess": "0838e19c490038b10f051c9c190a9b1f96d59bbd242f5d3143f50630deb74342ed",
"kernel_lookup_min_height": 1,
"messages": null,
"num_inputs": 0,
"num_outputs": 1,
@ -250,8 +250,8 @@ pub trait OwnerRpc: Sync + Send {
"creation_ts": "2019-01-15T16:01:26Z",
"fee": null,
"id": 1,
"kernel_excess": null,
"kernel_lookup_min_height": null,
"kernel_excess": "08cd9d890c0b6a004f700aa5939a1ce0488fe2a11fa33cf096b50732ceab0be1df",
"kernel_lookup_min_height": 2,
"messages": null,
"num_inputs": 0,
"num_outputs": 1,
@ -1025,7 +1025,9 @@ pub trait OwnerRpc: Sync + Send {
"parent_key_id": "0200000000000000000000000000000000",
"stored_tx": "0436430c-2b02-624c-2032-570501212b00.grintx",
"tx_slate_id": "0436430c-2b02-624c-2032-570501212b00",
"tx_type": "TxSent"
"tx_type": "TxSent",
"kernel_excess": null,
"kernel_lookup_min_height": null
}
]
}

View file

@ -255,8 +255,8 @@ pub trait OwnerRpcS {
"creation_ts": "2019-01-15T16:01:26Z",
"fee": null,
"id": 0,
"kernel_excess": null,
"kernel_lookup_min_height": null,
"kernel_excess": "0838e19c490038b10f051c9c190a9b1f96d59bbd242f5d3143f50630deb74342ed",
"kernel_lookup_min_height": 1,
"messages": null,
"num_inputs": 0,
"num_outputs": 1,
@ -273,8 +273,8 @@ pub trait OwnerRpcS {
"creation_ts": "2019-01-15T16:01:26Z",
"fee": null,
"id": 1,
"kernel_excess": null,
"kernel_lookup_min_height": null,
"kernel_excess": "08cd9d890c0b6a004f700aa5939a1ce0488fe2a11fa33cf096b50732ceab0be1df",
"kernel_lookup_min_height": 2,
"messages": null,
"num_inputs": 0,
"num_outputs": 1,
@ -1078,7 +1078,9 @@ pub trait OwnerRpcS {
"parent_key_id": "0200000000000000000000000000000000",
"stored_tx": "0436430c-2b02-624c-2032-570501212b00.grintx",
"tx_slate_id": "0436430c-2b02-624c-2032-570501212b00",
"tx_type": "TxSent"
"tx_type": "TxSent",
"kernel_excess": null,
"kernel_lookup_min_height": null
}
}
}

View file

@ -160,6 +160,7 @@ pub fn txs(
bMG->"Amount \nDebited",
bMG->"Fee",
bMG->"Net \nDifference",
bMG->"Kernel",
bMG->"Tx \nData",
]);
@ -196,6 +197,10 @@ pub fn txs(
Some(_) => "Yes".to_owned(),
None => "None".to_owned(),
};
let kernel_excess = match t.kernel_excess {
Some(e) => util::to_hex(e.0.to_vec()),
None => "None".to_owned(),
};
if dark_background_color_scheme {
table.add_row(row![
bFC->id,
@ -210,6 +215,7 @@ pub fn txs(
bFR->amount_debited_str,
bFR->fee,
bFY->net_diff,
bFB->kernel_excess,
bFb->tx_data,
]);
} else {
@ -227,6 +233,7 @@ pub fn txs(
bFD->amount_debited_str,
bFD->fee,
bFG->net_diff,
bFB->kernel_excess,
bFB->tx_data,
]);
} else {
@ -243,6 +250,7 @@ pub fn txs(
bFD->amount_debited_str,
bFD->fee,
bFG->net_diff,
bFB->kernel_excess,
bFB->tx_data,
]);
}

View file

@ -569,6 +569,9 @@ where
if tx.confirmed {
continue;
}
if tx.amount_debited != 0 && tx.amount_credited != 0 {
continue;
}
if let Some(e) = tx.kernel_excess {
let res = w
.w2n_client()
@ -585,6 +588,8 @@ where
batch.save_tx_log_entry(tx.clone(), &parent_key_id)?;
batch.commit()?;
}
} else {
warn!("Attempted to update via kernel excess for transaction {:?}, but kernel excess was not stored", tx.tx_slate_id);
}
}
Ok(true)

View file

@ -140,11 +140,13 @@ where
let filename = format!("{}.grintx", slate_id);
t.stored_tx = Some(filename);
t.fee = Some(slate.fee);
// TODO: Future multi-kernel considerations
if total_change == 0 {
t.kernel_excess = Some(slate.calc_excess(&keychain)?);
t.kernel_lookup_min_height = Some(slate.height);
match slate.calc_excess(&keychain) {
Ok(e) => t.kernel_excess = Some(e),
Err(_) => {}
}
t.kernel_lookup_min_height = Some(slate.height);
let mut amount_debited = 0;
t.num_inputs = lock_inputs.len();
for id in lock_inputs {
@ -234,6 +236,12 @@ where
t.amount_credited = amount;
t.num_outputs = 1;
t.messages = messages;
// when invoicing, this will be invalid
match slate.calc_excess(&keychain) {
Ok(e) => t.kernel_excess = Some(e),
Err(_) => {}
}
t.kernel_lookup_min_height = Some(slate.height);
batch.save(OutputData {
root_key_id: parent_key_id.clone(),
key_id: key_id_inner.clone(),

View file

@ -330,15 +330,11 @@ where
None => return Err(ErrorKind::TransactionDoesntExist(slate.id.to_string()))?,
};
wallet.store_tx(&format!("{}", tx.tx_slate_id.unwrap()), &slate.tx)?;
// If kernel excess is needed in the case of a no change transaction, update
// tx log info with final excess
if let Some(_) = tx.kernel_excess {
tx.kernel_excess = Some(slate.tx.body.kernels[0].excess);
let parent_key = wallet.parent_key_id();
let mut batch = wallet.batch(keychain_mask)?;
batch.save_tx_log_entry(tx, &parent_key)?;
batch.commit()?;
}
let parent_key = tx.parent_key_id.clone();
tx.kernel_excess = Some(slate.tx.body.kernels[0].excess);
let mut batch = wallet.batch(keychain_mask)?;
batch.save_tx_log_entry(tx, &parent_key)?;
batch.commit()?;
Ok(())
}

View file

@ -28,6 +28,7 @@ use crate::grin_keychain::{Identifier, Keychain, SwitchCommitmentType};
use crate::grin_util as util;
use crate::grin_util::secp::key::SecretKey;
use crate::grin_util::secp::pedersen;
use crate::grin_util::static_secp_instance;
use crate::internal::keys;
use crate::types::{
NodeClient, OutputData, OutputStatus, TxLogEntry, TxLogEntryType, WalletBackend, WalletInfo,
@ -285,6 +286,16 @@ where
t.amount_credited = output.value;
t.amount_debited = 0;
t.num_outputs = 1;
// calculate kernel excess for coinbase
{
let secp = static_secp_instance();
let secp = secp.lock();
let over_commit = secp.commit_value(output.value)?;
let excess =
secp.commit_sum(vec![commit.clone()], vec![over_commit])?;
t.kernel_excess = Some(excess);
t.kernel_lookup_min_height = Some(height);
}
t.update_confirmation_ts();
output.tx_log_entry = Some(log_id);
batch.save_tx_log_entry(t, &parent_key_id)?;

View file

@ -758,6 +758,7 @@ pub struct TxLogEntry {
/// Location of the store transaction, (reference or resending)
pub stored_tx: Option<String>,
/// Associated kernel excess, for later lookup if necessary
#[serde(with = "secp_ser::option_commitment_serde")]
pub kernel_excess: Option<pedersen::Commitment>,
/// Height reported when transaction was created, if lookup
/// of kernel is necessary

View file

@ -221,6 +221,9 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
let (refreshed, txs) = api.retrieve_txs(m, true, None, None)?;
assert!(refreshed);
assert_eq!(txs.len(), bh as usize);
for t in txs {
assert!(t.kernel_excess.is_some());
}
Ok(())
})?;

View file

@ -25,12 +25,12 @@ dirs = "1.0.3"
# grin_store = "2.0.0"
# For beta release
grin_core = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.2" }
grin_keychain = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.2" }
grin_chain = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.2" }
grin_util = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.2" }
grin_api = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.2" }
grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.2" }
grin_core = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.3"}
grin_keychain = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.3" }
grin_chain = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.3" }
grin_util = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.3" }
grin_api = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.3" }
grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.3" }
# For bleeding edge
# grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" }
@ -41,12 +41,12 @@ grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v2.1.0-beta.
# grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" }
# For local testing
#grin_core = { path = "../../grin/core"}
#grin_keychain = { path = "../../grin/keychain"}
#grin_chain = { path = "../../grin/chain"}
#grin_util = { path = "../../grin/util"}
#grin_api = { path = "../../grin/api"}
#grin_store = { path = "../../grin/store"}
# grin_core = { path = "../../grin/core"}
# grin_keychain = { path = "../../grin/keychain"}
# grin_chain = { path = "../../grin/chain"}
# grin_util = { path = "../../grin/util"}
# grin_api = { path = "../../grin/api"}
# grin_store = { path = "../../grin/store"}
[dev-dependencies]
pretty_assertions = "0.5.1"