fixfees on grin-wallet (#526)

* change fee to fee_fields in various structs and fix tests for new fee calculation

* set up accept_fee_base param in grin-wallet.toml

* fix bug and adopt new tx_fee interface

* Fix doctests

* Remove left over debug statement

* revert field name feef to fee to remain slate compatible

* use into() for some literal fee_fields

* add height arguments to FeeFields methods where necessary

* Fix tests

* Rename fee_fields -> fee on Context

* Rename fee_fields -> fee on TxLogEntry

* Update to grin master

* replace fee(0) by fee(2*YEAR_HEIGHT) to get fee masking

* Fix compilation error and revert Cargo lock

* fix wrong height passed into next_difficulty

Co-authored-by: Jasper van der Maarel <j@sper.dev>
This commit is contained in:
John Tromp 2020-11-26 20:46:03 +01:00 committed by GitHub
parent 429db61bb7
commit 8334304c16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 196 additions and 140 deletions

16
Cargo.lock generated
View file

@ -1171,7 +1171,7 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "grin_api" name = "grin_api"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"bytes", "bytes",
"easy-jsonrpc-mw", "easy-jsonrpc-mw",
@ -1204,7 +1204,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_chain" name = "grin_chain"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"bit-vec", "bit-vec",
"bitflags 1.2.1", "bitflags 1.2.1",
@ -1228,7 +1228,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_core" name = "grin_core"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"blake2-rfc", "blake2-rfc",
"byteorder", "byteorder",
@ -1255,7 +1255,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_keychain" name = "grin_keychain"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"blake2-rfc", "blake2-rfc",
"byteorder", "byteorder",
@ -1277,7 +1277,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_p2p" name = "grin_p2p"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"bitflags 1.2.1", "bitflags 1.2.1",
"bytes", "bytes",
@ -1299,7 +1299,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_pool" name = "grin_pool"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"blake2-rfc", "blake2-rfc",
"chrono", "chrono",
@ -1333,7 +1333,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_store" name = "grin_store"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"croaring-mw", "croaring-mw",
@ -1353,7 +1353,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_util" name = "grin_util"
version = "4.2.0-alpha.1" version = "4.2.0-alpha.1"
source = "git+https://github.com/mimblewimble/grin#cf2a65242d9805b0688e40f2432250461aa56561" source = "git+https://github.com/mimblewimble/grin#48efb693e2e5cdf60449b7f009214491d5bf3646"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"base64 0.12.3", "base64 0.12.3",

View file

@ -128,7 +128,7 @@ pub trait ForeignRpc {
"params": [ "params": [
{ {
"amt": "6000000000", "amt": "6000000000",
"fee": "8000000", "fee": "23500000",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"off": "d202964900000000d302964900000000d402964900000000d502964900000000", "off": "d202964900000000d302964900000000d402964900000000d502964900000000",
"proof": { "proof": {
@ -137,7 +137,7 @@ pub trait ForeignRpc {
}, },
"sigs": [ "sigs": [
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "02b57c1f4fea69a3ee070309cf8f06082022fe06f25a9be1851b56ef0fa18f25d6",
"xs": "023878ce845727f3a4ec76ca3f3db4b38a2d05d636b8c3632108b857fed63c96de" "xs": "023878ce845727f3a4ec76ca3f3db4b38a2d05d636b8c3632108b857fed63c96de"
} }
], ],
@ -172,7 +172,7 @@ pub trait ForeignRpc {
"sigs": [ "sigs": [
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841babbc82d2e200efe3a3b70cdfbed5b4e1d2a87641d0c4f6a3d7e73b80facb8507", "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be4f81215c8e678c7bd5f04f3562388948864d7a5a0374e220ab6dc5e02bae66f",
"xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f" "xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f"
} }
], ],
@ -209,13 +209,13 @@ pub trait ForeignRpc {
"ver": "4:2", "ver": "4:2",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"sta": "I2", "sta": "I2",
"off": "dbd68b83e4d6f9ebaebf179fdde3efd4309734124937bcb5f5a7df49120eca7f", "off": "383bc9df0dd332629520a0a72f8dd7f0e97d579dccb4dbdc8592aa3d424c846c",
"fee": "7000000", "fee": "23500000",
"sigs": [ "sigs": [
{ {
"xs": "0384a71f13c434e79b70f9a0649e34887f1c6caf3021636cfced448a146ca23c7a", "xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f",
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b6485299a0be2e4306663dcc78f1bc9d029c7be30e423558fe3f4fcfc9ad79a8e" "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be7bf31d80494f5e4a3d656649b1610c61a268f9cafcfc604b5d9f25efb2aa3c5"
} }
], ],
"coms": [ "coms": [
@ -228,8 +228,8 @@ pub trait ForeignRpc {
"c": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7" "c": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7"
}, },
{ {
"c": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", "c": "09ede20409d5ae0d1c0d3f3d2c68038a384cdd6b7cc5ca2aab670f570adc2dffc3",
"p": "284b9f9199411c6bbf7227eae15cc9fa7ed30534af3ecff85b0d016da329cae1f1edf79f01426434cb90afcc2f0a1fb296e5c51a91b5e57a1f0230fda4f8c5950e7986fa379b99d64b6039a86cc7e35e040ba192b781043959851268ca9874a918805ea958c84f7fee8d3ab4262f032f5a3f840ebcdd273b29be810114e6e86a959d8e4c080572e3ef249edd6ad68503ec3bc4486548520ea2775a41aea67aac99945fce9e7a7769d71f893ad7f0d0108692f6b6852312cae6f9857063055bda59dce521927c70040b8026a41b6517cae0a1c947ca244984a5c0adf7c6483b0939346c48f61cac37d501f46a1c5878b67cee0d0723f4eeadc9f5d71ed5e9f33b4294b58d3ebeefeaa13f20357599be549ce18e6e2eb1d50e1235ccc40ec9184c68a623741a7238ce69aa3a1d25156b3b7eb38fdd6fbe5473979feee3317df279c60d48a289826aa4c76dbce24d526890d4e6e2f83e80f674a1248fc1dc037d982009012ae1133f5e158ae6cdadb18c8d53e4a8ae5595c758782c67aa0c20f146d52085cf45a35794cec45702830f8952a69744718fbe6fe0d3da66e348dd3473a0aced7080fbf5494c3e7e141916f3b135b33277f998fcd9acfbca8709814866e9838a5dcda4c29422cf157293e6fc2ccc2d25423517843bd8e21c61ced72312c0b48814c312021b0d31598d2389b0b329baa1169922a4c34173dd5f540545be5066a0f291f1a870e1aaff94c19f0a855254882a17984baeda08e8ead53d1563e9ee4bc36742789cef4f3ab158054d7ddfe2a2b37b5a8a30be84ff7df9a7d758a9b76751a3622057721a3ec5b873582d0c91cd1febbc153662739854ea15c9903023c193c6b5768b55484108f897cdc47d13a9088b32558e57f12f5807668649c99a17b51905127340e8b49c42775f1b3cab072dfad33d33cc1e4ba5964d728ed0a905" "p": "6d86fe00220f8c6ac2ad4e338d80063dba5423af525bd273ecfac8ef6b509192732a8cd0c53d3313e663ac5ccece3d589fd2634e29f96e82b99ca6f8b953645a005d1bc73493f8c41f84fb8e327d4cbe6711dba194a60db30700df94a41e1fda7afe0619169389f8d8ee12bddf736c4bc86cd5b1809a5a27f195209147dc38d0de6f6710ce9350f3b8e7e6820bfe5182e6e58f0b41b82b6ec6bb01ffe1d8b3c2368ebf1e31dfdb9e00f0bc68d9119a38d19c038c29c7b37e31246e7bba56019bc88881d7d695d32557fc0e93635b5f24deffefc787787144e5de7e86281e79934e7e20d9408c34317c778e6b218ee26d0a5e56b8b84a883e3ddf8603826010234531281486454f8c2cf3fee074f242f9fc1da3c6636b86fb6f941eb8b633d6e3b3f87dfe5ae261a40190bd4636f433bcdd5e3400255594e282c5396db8999d95be08a35be9a8f70fdb7cf5353b90584523daee6e27e208b2ca0e5758b8a24b974dca00bab162505a2aa4bcefd8320f111240b62f861261f0ce9b35979f9f92da7dd6989fe1f41ec46049fd514d9142ce23755f52ec7e64df2af33579e9b8356171b91bc96b875511bef6062dd59ef3fe2ddcc152147554405b12c7c5231513405eb062aa8fa093e3414a144c544d551c4f1f9bf5d5d2ff5b50a3f296c800907704bed8d8ee948c0855eff65ad44413af641cdc68a06a7c855be7ed7dd64d5f623bbc9645763d48774ba2258240a83f8f89ef84d21c65bcb75895ebca08b0090b40aafb7ddef039fcaf4bad2dbbac72336c4412c600e854d368ed775597c15d2e66775ab47024ce7e62fd31bf90b183149990c10b5b678501dbac1af8b2897b67d085d87cab7af4036cba3bdcfdcc7548d7710511045813c6818d859e192e03adc0d6a6b30c4cbac20a0d6f8719c7a9c3ad46d62eec464c4c44b58fca463fea3ce1fc51"
} }
] ]
}] }]
@ -256,22 +256,22 @@ pub trait ForeignRpc {
"p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7" "p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7"
}, },
{ {
"c": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", "c": "09ede20409d5ae0d1c0d3f3d2c68038a384cdd6b7cc5ca2aab670f570adc2dffc3",
"p": "284b9f9199411c6bbf7227eae15cc9fa7ed30534af3ecff85b0d016da329cae1f1edf79f01426434cb90afcc2f0a1fb296e5c51a91b5e57a1f0230fda4f8c5950e7986fa379b99d64b6039a86cc7e35e040ba192b781043959851268ca9874a918805ea958c84f7fee8d3ab4262f032f5a3f840ebcdd273b29be810114e6e86a959d8e4c080572e3ef249edd6ad68503ec3bc4486548520ea2775a41aea67aac99945fce9e7a7769d71f893ad7f0d0108692f6b6852312cae6f9857063055bda59dce521927c70040b8026a41b6517cae0a1c947ca244984a5c0adf7c6483b0939346c48f61cac37d501f46a1c5878b67cee0d0723f4eeadc9f5d71ed5e9f33b4294b58d3ebeefeaa13f20357599be549ce18e6e2eb1d50e1235ccc40ec9184c68a623741a7238ce69aa3a1d25156b3b7eb38fdd6fbe5473979feee3317df279c60d48a289826aa4c76dbce24d526890d4e6e2f83e80f674a1248fc1dc037d982009012ae1133f5e158ae6cdadb18c8d53e4a8ae5595c758782c67aa0c20f146d52085cf45a35794cec45702830f8952a69744718fbe6fe0d3da66e348dd3473a0aced7080fbf5494c3e7e141916f3b135b33277f998fcd9acfbca8709814866e9838a5dcda4c29422cf157293e6fc2ccc2d25423517843bd8e21c61ced72312c0b48814c312021b0d31598d2389b0b329baa1169922a4c34173dd5f540545be5066a0f291f1a870e1aaff94c19f0a855254882a17984baeda08e8ead53d1563e9ee4bc36742789cef4f3ab158054d7ddfe2a2b37b5a8a30be84ff7df9a7d758a9b76751a3622057721a3ec5b873582d0c91cd1febbc153662739854ea15c9903023c193c6b5768b55484108f897cdc47d13a9088b32558e57f12f5807668649c99a17b51905127340e8b49c42775f1b3cab072dfad33d33cc1e4ba5964d728ed0a905" "p": "6d86fe00220f8c6ac2ad4e338d80063dba5423af525bd273ecfac8ef6b509192732a8cd0c53d3313e663ac5ccece3d589fd2634e29f96e82b99ca6f8b953645a005d1bc73493f8c41f84fb8e327d4cbe6711dba194a60db30700df94a41e1fda7afe0619169389f8d8ee12bddf736c4bc86cd5b1809a5a27f195209147dc38d0de6f6710ce9350f3b8e7e6820bfe5182e6e58f0b41b82b6ec6bb01ffe1d8b3c2368ebf1e31dfdb9e00f0bc68d9119a38d19c038c29c7b37e31246e7bba56019bc88881d7d695d32557fc0e93635b5f24deffefc787787144e5de7e86281e79934e7e20d9408c34317c778e6b218ee26d0a5e56b8b84a883e3ddf8603826010234531281486454f8c2cf3fee074f242f9fc1da3c6636b86fb6f941eb8b633d6e3b3f87dfe5ae261a40190bd4636f433bcdd5e3400255594e282c5396db8999d95be08a35be9a8f70fdb7cf5353b90584523daee6e27e208b2ca0e5758b8a24b974dca00bab162505a2aa4bcefd8320f111240b62f861261f0ce9b35979f9f92da7dd6989fe1f41ec46049fd514d9142ce23755f52ec7e64df2af33579e9b8356171b91bc96b875511bef6062dd59ef3fe2ddcc152147554405b12c7c5231513405eb062aa8fa093e3414a144c544d551c4f1f9bf5d5d2ff5b50a3f296c800907704bed8d8ee948c0855eff65ad44413af641cdc68a06a7c855be7ed7dd64d5f623bbc9645763d48774ba2258240a83f8f89ef84d21c65bcb75895ebca08b0090b40aafb7ddef039fcaf4bad2dbbac72336c4412c600e854d368ed775597c15d2e66775ab47024ce7e62fd31bf90b183149990c10b5b678501dbac1af8b2897b67d085d87cab7af4036cba3bdcfdcc7548d7710511045813c6818d859e192e03adc0d6a6b30c4cbac20a0d6f8719c7a9c3ad46d62eec464c4c44b58fca463fea3ce1fc51"
} }
], ],
"fee": "7000000", "fee": "23500000",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"off": "4940f497462b7140383738c1665fa3989e6fff5d9f411a33aa04438f75d6de2c", "off": "a5a632f26f27a9b71e98c1c8b8098bb41204ffcfd206d995f9c16d10764ad95a",
"sigs": [ "sigs": [
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b6485299a0be2e4306663dcc78f1bc9d029c7be30e423558fe3f4fcfc9ad79a8e", "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be7bf31d80494f5e4a3d656649b1610c61a268f9cafcfc604b5d9f25efb2aa3c5",
"xs": "0384a71f13c434e79b70f9a0649e34887f1c6caf3021636cfced448a146ca23c7a" "xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f"
}, },
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b32617ea149fa6faf220f4212530517809e9ed2193f5e558b1de9d339414fda91", "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b04e1e15ceb1b5dbab8baf7750d7bd4aad6cfe97b83e4dc080dae328eb75881fd",
"xs": "02e89cce4499ac1e9bb498dab9e3fab93cc40cd3d26c04a0292e00f4bf272499ec" "xs": "02e89cce4499ac1e9bb498dab9e3fab93cc40cd3d26c04a0292e00f4bf272499ec"
} }
], ],

View file

@ -393,7 +393,7 @@ pub trait OwnerRpc {
"result": { "result": {
"Ok": { "Ok": {
"amt": "6000000000", "amt": "6000000000",
"fee": "8000000", "fee": "23000000",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"proof": { "proof": {
"raddr": "32cdd63928854f8b2628b1dce4626ddcdf35d56cb7cfdf7d64cca5822b78d4d3", "raddr": "32cdd63928854f8b2628b1dce4626ddcdf35d56cb7cfdf7d64cca5822b78d4d3",
@ -521,17 +521,17 @@ pub trait OwnerRpc {
"f": 1 "f": 1
}, },
{ {
"c": "094be57c91787fc2033d5d97fae099f1a6ddb37ea48370f1a138f09524c767fdd3", "c": "087e4e373ef2ab9921ba53e05f384b717789ddb4ad18a8f2057c9338bd639e02a5",
"p": "1319630b26d02363861ebdb15514086dc8b0772b4bb63ef9b828704e0ac348efada6747dd7a29848138d630c7b403e573c9cde04be5d25f2d344db4b010d6b890dd6c54cc0911c0cadc7a8a225b2ec3f2dcac88189a17aa62257e969eef9de9172009d8e864e413f1953998b28531e580d3ea495a512d320e8d4ff50e7495a6c283c6e544d16364d34272805893526f1e3b6fd176ef4adc5671b165cf28efcfb8d25c0dfcd018a2c5e65beeb9201f3983194e5a521c0844d05c700654dfaed1b9b39dae08cc9afab9cb891256bc0237ad2ce78da8b44586580f52dd346dcafde5e471917f16e4c4b51e966e1946f13e31771503c85bb0f1b41d1c7fcc953e70af55400638a35e7f5610f9f4c5b881a35060a693deaf46e1839c54a8f7d2c626b05acd3450b72ae8f2e0f8721bcbbd8562141d3fef851c6ac3c8069fa6389389bc4fcba5e4fb49709a3b63a59ba96a82827dfbd6f16de849ef95f3114593d207aff6e030152929fa220b0c3b54ca419cfcbffb7a0106dd3154e858878c7d8f38cadcc376c502bdc50292b494484936d0846fc3fac10910962bca4ddcca5c80b458fd7df15e9a6c2f39b516425a2190a97c9d0e2e2f105ee29905f36e3a648a135ebf387d0bb2a6b61d95b215319d6dc9ee8b4b2798810fb6e01c007041b288c2b39e805c9af86c88dd4a380b6a346b4a0e67bba6aaac5acc70088ac3297486b90cfe371d9464552747a2f7680f42d5629fb09bed835382d842234712c0574c5b4f256c226e77602429983e4def71541cff80ccf4cd3b761685c91463c8e1c7bf828699c688509282b85e752424df3da670b3cfacdea2f66cfb804fecdf8b7eb056e8917fdae78d83c011964e3d5a0748873f817d0abf4b04c20452733eac35c318b96e100a5ace0f54085bd24f968b8fc5b276e0d7b134f01db50b3d2771cdcf1423d44" "p": "28875d797af7cb6c63eba070e0a79af57ea0a434d7d34801a02bc85624ae14a4a13519164737c7154b6222a9d6da33b8c52ef7dc4dc58aea3c776b7907e474450a52f3ccc017f66e2ce9f97a45733d6ed90a223e7d1a67802d393834cc9e4103c27bb7d63abc2753a5b54bcc48751c63b6accde16a37678338452bc985d24fb6af405a9166c0ca750f1cdedc5c0996c56f199722df3844b822de96480fac6e706dab6241d0338d7914a10a0e83406d0689224a3286e8c579c50882ce96123aecc6aa667c27abf1ce894e0c6282fc81e5fba51d498af16c5b0c39b45faf3f0cd7140dccae7d8d45330ec7895ce0c90e2490877311b9dfe157c05c6206f929ffef0da1a8d807077712a80670dfb9ac38ca565d47acf7e93bd09f418f20f10c9e87f6f4421fa889e522c33475f98ddff87a36eb0a0b445a8679628e163ae56bf3cfc39a5a5867d3e31e1e9d373a6b3924d7d895d5140e4bf00c0cbf7f343c12dc2b2c6b01769a588cc1ef1178fbf3bd645e25bf5c458c4af79884329b7ed80e08868121baeb39b11814f2dd8dddbb7114382e65378e2c6f1e837ace9a980acb965629f9f1525f60efb54301a7540a9105bf33eac1be37e1add96801f1c62857be0ac38ac370e0722764c59517960056bafe6fdd388eb78c98954f3f966d44e8f060366617844eff416625f8609b44263efc10e4f2f4fb22ceae5c16d4105e477a49511b4ac37aefac17e5532ee1ccb1654eb0bf17b32415561f02c2b07462f2c5aa7846ef21cfb30548c6bfe4d762333a199be183d7d9fa1ae6c9b4730965f741183d75ac0610efcf48d0039514011816f421a7a1a4c7c1bbc2ba8b522178cff367b4c704d343fac3a2662b50211556b630b5620244587d2f90941ef1edf8e44fa97d35daaa58d16fff3f57c6e6fa618f511dc770704d831a1f49630ec9da6f33f551923c"
} }
], ],
"fee": "8000000", "fee": "23000000",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"off": "bca108f36955448dacfc0464d75d010641f9e1a81709c27bc4404eea895c4f91", "off": "16672e6b4e2a6851b27641d8b5c32fcee83abbd516ceb9af5f0e8b6aad8d26a5",
"sigs": [ "sigs": [
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b20b8e09af72b6b7212c1bf6a4c17d56ce0048e05bb5309c1394a3d763a102a7e", "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bdac2d36fe4c972de75f4e462004de9ca3e8c77d4dae5344d210beea9ad138c45",
"xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f" "xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f"
} }
], ],
@ -614,12 +614,12 @@ pub trait OwnerRpc {
"ver": "4:2", "ver": "4:2",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"sta": "S2", "sta": "S2",
"off": "696a69136154775485782121887bb3c32487a8320551fdb9702ec2d333fe54ee", "off": "6c6a69136154775488782121887bb3c32787a8320551fdb9732ec2d333fe54ee",
"sigs": [ "sigs": [
{ {
"xs": "0384a71f13c434e79b70f9a0649e34887f1c6caf3021636cfced448a146ca23c7a", "xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f",
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b6485299a0be2e4306663dcc78f1bc9d029c7be30e423558fe3f4fcfc9ad79a8e" "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be7bf31d80494f5e4a3d656649b1610c61a268f9cafcfc604b5d9f25efb2aa3c5"
} }
], ],
"coms": [ "coms": [
@ -653,22 +653,22 @@ pub trait OwnerRpc {
"p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7" "p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7"
}, },
{ {
"c": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", "c": "09ede20409d5ae0d1c0d3f3d2c68038a384cdd6b7cc5ca2aab670f570adc2dffc3",
"p": "284b9f9199411c6bbf7227eae15cc9fa7ed30534af3ecff85b0d016da329cae1f1edf79f01426434cb90afcc2f0a1fb296e5c51a91b5e57a1f0230fda4f8c5950e7986fa379b99d64b6039a86cc7e35e040ba192b781043959851268ca9874a918805ea958c84f7fee8d3ab4262f032f5a3f840ebcdd273b29be810114e6e86a959d8e4c080572e3ef249edd6ad68503ec3bc4486548520ea2775a41aea67aac99945fce9e7a7769d71f893ad7f0d0108692f6b6852312cae6f9857063055bda59dce521927c70040b8026a41b6517cae0a1c947ca244984a5c0adf7c6483b0939346c48f61cac37d501f46a1c5878b67cee0d0723f4eeadc9f5d71ed5e9f33b4294b58d3ebeefeaa13f20357599be549ce18e6e2eb1d50e1235ccc40ec9184c68a623741a7238ce69aa3a1d25156b3b7eb38fdd6fbe5473979feee3317df279c60d48a289826aa4c76dbce24d526890d4e6e2f83e80f674a1248fc1dc037d982009012ae1133f5e158ae6cdadb18c8d53e4a8ae5595c758782c67aa0c20f146d52085cf45a35794cec45702830f8952a69744718fbe6fe0d3da66e348dd3473a0aced7080fbf5494c3e7e141916f3b135b33277f998fcd9acfbca8709814866e9838a5dcda4c29422cf157293e6fc2ccc2d25423517843bd8e21c61ced72312c0b48814c312021b0d31598d2389b0b329baa1169922a4c34173dd5f540545be5066a0f291f1a870e1aaff94c19f0a855254882a17984baeda08e8ead53d1563e9ee4bc36742789cef4f3ab158054d7ddfe2a2b37b5a8a30be84ff7df9a7d758a9b76751a3622057721a3ec5b873582d0c91cd1febbc153662739854ea15c9903023c193c6b5768b55484108f897cdc47d13a9088b32558e57f12f5807668649c99a17b51905127340e8b49c42775f1b3cab072dfad33d33cc1e4ba5964d728ed0a905" "p": "6d86fe00220f8c6ac2ad4e338d80063dba5423af525bd273ecfac8ef6b509192732a8cd0c53d3313e663ac5ccece3d589fd2634e29f96e82b99ca6f8b953645a005d1bc73493f8c41f84fb8e327d4cbe6711dba194a60db30700df94a41e1fda7afe0619169389f8d8ee12bddf736c4bc86cd5b1809a5a27f195209147dc38d0de6f6710ce9350f3b8e7e6820bfe5182e6e58f0b41b82b6ec6bb01ffe1d8b3c2368ebf1e31dfdb9e00f0bc68d9119a38d19c038c29c7b37e31246e7bba56019bc88881d7d695d32557fc0e93635b5f24deffefc787787144e5de7e86281e79934e7e20d9408c34317c778e6b218ee26d0a5e56b8b84a883e3ddf8603826010234531281486454f8c2cf3fee074f242f9fc1da3c6636b86fb6f941eb8b633d6e3b3f87dfe5ae261a40190bd4636f433bcdd5e3400255594e282c5396db8999d95be08a35be9a8f70fdb7cf5353b90584523daee6e27e208b2ca0e5758b8a24b974dca00bab162505a2aa4bcefd8320f111240b62f861261f0ce9b35979f9f92da7dd6989fe1f41ec46049fd514d9142ce23755f52ec7e64df2af33579e9b8356171b91bc96b875511bef6062dd59ef3fe2ddcc152147554405b12c7c5231513405eb062aa8fa093e3414a144c544d551c4f1f9bf5d5d2ff5b50a3f296c800907704bed8d8ee948c0855eff65ad44413af641cdc68a06a7c855be7ed7dd64d5f623bbc9645763d48774ba2258240a83f8f89ef84d21c65bcb75895ebca08b0090b40aafb7ddef039fcaf4bad2dbbac72336c4412c600e854d368ed775597c15d2e66775ab47024ce7e62fd31bf90b183149990c10b5b678501dbac1af8b2897b67d085d87cab7af4036cba3bdcfdcc7548d7710511045813c6818d859e192e03adc0d6a6b30c4cbac20a0d6f8719c7a9c3ad46d62eec464c4c44b58fca463fea3ce1fc51"
} }
], ],
"fee": "7000000", "fee": "23500000",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"off": "4940f497462b7140383738c1665fa3989e6fff5d9f411a33aa04438f75d6de2c", "off": "a5a632f26f27a9b71e98c1c8b8098bb41204ffcfd206d995f9c16d10764ad95a",
"sigs": [ "sigs": [
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b6485299a0be2e4306663dcc78f1bc9d029c7be30e423558fe3f4fcfc9ad79a8e", "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be7bf31d80494f5e4a3d656649b1610c61a268f9cafcfc604b5d9f25efb2aa3c5",
"xs": "0384a71f13c434e79b70f9a0649e34887f1c6caf3021636cfced448a146ca23c7a" "xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f"
}, },
{ {
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b32617ea149fa6faf220f4212530517809e9ed2193f5e558b1de9d339414fda91", "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b04e1e15ceb1b5dbab8baf7750d7bd4aad6cfe97b83e4dc080dae328eb75881fd",
"xs": "02e89cce4499ac1e9bb498dab9e3fab93cc40cd3d26c04a0292e00f4bf272499ec" "xs": "02e89cce4499ac1e9bb498dab9e3fab93cc40cd3d26c04a0292e00f4bf272499ec"
} }
], ],
@ -701,17 +701,17 @@ pub trait OwnerRpc {
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"sta": "S3", "sta": "S3",
"off": "750dbf4fd43b7f4cfd68d2698a522f3ff6e6a00ad9895b33f1ec46493b837b49", "off": "750dbf4fd43b7f4cfd68d2698a522f3ff6e6a00ad9895b33f1ec46493b837b49",
"fee": "7000000", "fee": "23500000",
"sigs": [ "sigs": [
{ {
"xs": "033bbe2a419ea2e9d6810a8d66552e709d1783ca50759a44dbaf63fc79c0164c4c", "xs": "033bbe2a419ea2e9d6810a8d66552e709d1783ca50759a44dbaf63fc79c0164c4c",
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b35fdfe55271f2ae73d75f58c70d1efb69b3384c7bc507d57e99e56de77e20874" "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b92c7c53280dd79f8b028cd9863bac89820267cac794b121e217541efb061ad53"
}, },
{ {
"xs": "030152d2d72e2dba7c6086ad49a219d9ff0dfe0fd993dcaea22e058c210033ce93", "xs": "02b57c1f4fea69a3ee070309cf8f06082022fe06f25a9be1851b56ef0fa18f25d6",
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", "nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bdad934daa17db7e477c4eed90afed40d1117896df8c4f5861b6309a949878074" "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b4cd4afef1cd2d708100cd1680d6566e4e987ac5c939ace9c0e036a679121c7a8"
} }
], ],
"coms": [ "coms": [
@ -728,8 +728,8 @@ pub trait OwnerRpc {
"p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7" "p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7"
}, },
{ {
"c": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", "c": "09ede20409d5ae0d1c0d3f3d2c68038a384cdd6b7cc5ca2aab670f570adc2dffc3",
"p": "284b9f9199411c6bbf7227eae15cc9fa7ed30534af3ecff85b0d016da329cae1f1edf79f01426434cb90afcc2f0a1fb296e5c51a91b5e57a1f0230fda4f8c5950e7986fa379b99d64b6039a86cc7e35e040ba192b781043959851268ca9874a918805ea958c84f7fee8d3ab4262f032f5a3f840ebcdd273b29be810114e6e86a959d8e4c080572e3ef249edd6ad68503ec3bc4486548520ea2775a41aea67aac99945fce9e7a7769d71f893ad7f0d0108692f6b6852312cae6f9857063055bda59dce521927c70040b8026a41b6517cae0a1c947ca244984a5c0adf7c6483b0939346c48f61cac37d501f46a1c5878b67cee0d0723f4eeadc9f5d71ed5e9f33b4294b58d3ebeefeaa13f20357599be549ce18e6e2eb1d50e1235ccc40ec9184c68a623741a7238ce69aa3a1d25156b3b7eb38fdd6fbe5473979feee3317df279c60d48a289826aa4c76dbce24d526890d4e6e2f83e80f674a1248fc1dc037d982009012ae1133f5e158ae6cdadb18c8d53e4a8ae5595c758782c67aa0c20f146d52085cf45a35794cec45702830f8952a69744718fbe6fe0d3da66e348dd3473a0aced7080fbf5494c3e7e141916f3b135b33277f998fcd9acfbca8709814866e9838a5dcda4c29422cf157293e6fc2ccc2d25423517843bd8e21c61ced72312c0b48814c312021b0d31598d2389b0b329baa1169922a4c34173dd5f540545be5066a0f291f1a870e1aaff94c19f0a855254882a17984baeda08e8ead53d1563e9ee4bc36742789cef4f3ab158054d7ddfe2a2b37b5a8a30be84ff7df9a7d758a9b76751a3622057721a3ec5b873582d0c91cd1febbc153662739854ea15c9903023c193c6b5768b55484108f897cdc47d13a9088b32558e57f12f5807668649c99a17b51905127340e8b49c42775f1b3cab072dfad33d33cc1e4ba5964d728ed0a905" "p": "6d86fe00220f8c6ac2ad4e338d80063dba5423af525bd273ecfac8ef6b509192732a8cd0c53d3313e663ac5ccece3d589fd2634e29f96e82b99ca6f8b953645a005d1bc73493f8c41f84fb8e327d4cbe6711dba194a60db30700df94a41e1fda7afe0619169389f8d8ee12bddf736c4bc86cd5b1809a5a27f195209147dc38d0de6f6710ce9350f3b8e7e6820bfe5182e6e58f0b41b82b6ec6bb01ffe1d8b3c2368ebf1e31dfdb9e00f0bc68d9119a38d19c038c29c7b37e31246e7bba56019bc88881d7d695d32557fc0e93635b5f24deffefc787787144e5de7e86281e79934e7e20d9408c34317c778e6b218ee26d0a5e56b8b84a883e3ddf8603826010234531281486454f8c2cf3fee074f242f9fc1da3c6636b86fb6f941eb8b633d6e3b3f87dfe5ae261a40190bd4636f433bcdd5e3400255594e282c5396db8999d95be08a35be9a8f70fdb7cf5353b90584523daee6e27e208b2ca0e5758b8a24b974dca00bab162505a2aa4bcefd8320f111240b62f861261f0ce9b35979f9f92da7dd6989fe1f41ec46049fd514d9142ce23755f52ec7e64df2af33579e9b8356171b91bc96b875511bef6062dd59ef3fe2ddcc152147554405b12c7c5231513405eb062aa8fa093e3414a144c544d551c4f1f9bf5d5d2ff5b50a3f296c800907704bed8d8ee948c0855eff65ad44413af641cdc68a06a7c855be7ed7dd64d5f623bbc9645763d48774ba2258240a83f8f89ef84d21c65bcb75895ebca08b0090b40aafb7ddef039fcaf4bad2dbbac72336c4412c600e854d368ed775597c15d2e66775ab47024ce7e62fd31bf90b183149990c10b5b678501dbac1af8b2897b67d085d87cab7af4036cba3bdcfdcc7548d7710511045813c6818d859e192e03adc0d6a6b30c4cbac20a0d6f8719c7a9c3ad46d62eec464c4c44b58fca463fea3ce1fc51"
} }
] ]
}, },
@ -821,7 +821,7 @@ pub trait OwnerRpc {
"p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7" "p": "29701ceae262cac77b79b868c883a292e61e6de8192b868edcd1300b0973d91396b156ace6bd673402a303de10ddd8a5e6b7f17ba6557a574a672bd04cc273ab04ed8e2ca80bac483345c0ec843f521814ce1301ec9adc38956a12b4d948acce71295a4f52bcdeb8a1c9f2d6b2da5d731262a5e9c0276ef904df9ef8d48001420cd59f75a2f1ae5c7a1c7c6b9f140e7613e52ef9e249f29f9340b7efb80699e460164324616f98fd4cde3db52497c919e95222fffeacb7e65deca7e368a80ce713c19de7da5369726228ee336f5bd494538c12ccbffeb1b9bfd5fc8906d1c64245b516f103fa96d9c56975837652c1e0fa5803d7ccf1147d8f927e36da717f7ad79471dbe192f5f50f87a79fc3fe030dba569b634b92d2cf307993cce545633af263897cd7e6ebf4dcafb176d07358bdc38d03e45a49dfa9c8c6517cd68d167ffbf6c3b4de0e2dd21909cbad4c467b84e5700be473a39ac59c669d7c155c4bcab9b8026eea3431c779cd277e4922d2b9742e1f6678cbe869ec3b5b7ef4132ddb6cdd06cf27dbeb28be72b949fa897610e48e3a0d789fd2eea75abc97b3dc7e00e5c8b3d24e40c6f24112adb72352b89a2bef0599345338e9e76202a3c46efa6370952b2aca41aadbae0ea32531acafcdab6dd066d769ebf50cf4f3c0a59d2d5fa79600a207b9417c623f76ad05e8cccfcd4038f9448bc40f127ca7c0d372e46074e334fe49f5a956ec0056f4da601e6af80eb1a6c4951054869e665b296d8c14f344ca2dc5fdd5df4a3652536365a1615ad9b422165c77bf8fe65a835c8e0c41e070014eb66ef8c525204e990b3a3d663c1e42221b496895c37a2f0c1bf05e91235409c3fe3d89a9a79d6c78609ab18a463311911f71fa37bb73b15fcd38143d1404fd2ce81004dc7ff89cf1115dcc0c35ce1c1bf9941586fb959770f2618ccb7118a7"
} }
], ],
"fee": "7000000", "fee": "23500000",
"id": "0436430c-2b02-624c-2032-570501212b00", "id": "0436430c-2b02-624c-2032-570501212b00",
"sigs": [], "sigs": [],
"sta": "S3", "sta": "S3",

View file

@ -122,7 +122,13 @@ fn comments() -> HashMap<String, String> {
" "
.to_string(), .to_string(),
); );
retval.insert(
"accept_fee_base".to_string(),
"
#Minimum acceptable fee per unit of transaction weight
"
.to_string(),
);
retval.insert( retval.insert(
"[logging]".to_string(), "[logging]".to_string(),
" "

View file

@ -53,6 +53,9 @@ pub struct WalletConfig {
pub dark_background_color_scheme: Option<bool>, pub dark_background_color_scheme: Option<bool>,
/// The exploding lifetime (minutes) for keybase notification on coins received /// The exploding lifetime (minutes) for keybase notification on coins received
pub keybase_notify_ttl: Option<u16>, pub keybase_notify_ttl: Option<u16>,
/// Scaling factor from transaction weight to transaction fee
/// should match accept_fee_base parameter in grin-server
pub accept_fee_base: Option<u64>,
} }
impl Default for WalletConfig { impl Default for WalletConfig {
@ -71,6 +74,7 @@ impl Default for WalletConfig {
tls_certificate_key: None, tls_certificate_key: None,
dark_background_color_scheme: Some(true), dark_background_color_scheme: Some(true),
keybase_notify_ttl: Some(1440), keybase_notify_ttl: Some(1440),
accept_fee_base: None,
} }
} }
} }
@ -86,6 +90,11 @@ impl WalletConfig {
3420 3420
} }
/// Default listener port
pub fn default_accept_fee_base() -> u64 {
500_000
}
/// Use value from config file, defaulting to sensible value if missing. /// Use value from config file, defaulting to sensible value if missing.
pub fn owner_api_listen_port(&self) -> u16 { pub fn owner_api_listen_port(&self) -> u16 {
self.owner_api_listen_port self.owner_api_listen_port
@ -96,6 +105,12 @@ impl WalletConfig {
pub fn owner_api_listen_addr(&self) -> String { pub fn owner_api_listen_addr(&self) -> String {
format!("127.0.0.1:{}", self.owner_api_listen_port()) format!("127.0.0.1:{}", self.owner_api_listen_port())
} }
/// Accept fee base
pub fn accept_fee_base(&self) -> u64 {
self.accept_fee_base
.unwrap_or_else(|| WalletConfig::default_accept_fee_base())
}
} }
/// Error type wrapping config errors. /// Error type wrapping config errors.
#[derive(Debug)] #[derive(Debug)]

View file

@ -17,6 +17,7 @@
use crate::api::TLSConfig; use crate::api::TLSConfig;
use crate::apiwallet::{try_slatepack_sync_workflow, Owner}; use crate::apiwallet::{try_slatepack_sync_workflow, Owner};
use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME}; use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME};
use crate::core::core::FeeFields;
use crate::core::{core, global}; use crate::core::{core, global};
use crate::error::{Error, ErrorKind}; use crate::error::{Error, ErrorKind};
use crate::impls::PathToSlatepack; use crate::impls::PathToSlatepack;
@ -277,7 +278,7 @@ where
let mut slate = Slate::blank(2, false); let mut slate = Slate::blank(2, false);
controller::owner_single_use(None, keychain_mask, Some(owner_api), |api, m| { controller::owner_single_use(None, keychain_mask, Some(owner_api), |api, m| {
if args.estimate_selection_strategies { if args.estimate_selection_strategies {
let strategies = vec!["smallest", "all"] let strategies: Vec<(&str, u64, FeeFields)> = vec!["smallest", "all"]
.into_iter() .into_iter()
.map(|strategy| { .map(|strategy| {
let init_args = InitTxArgs { let init_args = InitTxArgs {
@ -291,7 +292,7 @@ where
..Default::default() ..Default::default()
}; };
let slate = api.init_send_tx(m, init_args).unwrap(); let slate = api.init_send_tx(m, init_args).unwrap();
(strategy, slate.amount, slate.fee) (strategy, slate.amount, slate.fee_fields)
}) })
.collect(); .collect();
display::estimate(args.amount, strategies, dark_scheme); display::estimate(args.amount, strategies, dark_scheme);
@ -848,7 +849,7 @@ where
..Default::default() ..Default::default()
}; };
let slate = api.init_send_tx(m, init_args).unwrap(); let slate = api.init_send_tx(m, init_args).unwrap();
(strategy, slate.amount, slate.fee) (strategy, slate.amount, slate.fee_fields)
}) })
.collect(); .collect();
display::estimate(slate.amount, strategies, dark_scheme); display::estimate(slate.amount, strategies, dark_scheme);

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::core::consensus::YEAR_HEIGHT;
use crate::core::core::FeeFields;
use crate::core::core::{self, amount_to_hr_string}; use crate::core::core::{self, amount_to_hr_string};
use crate::core::global; use crate::core::global;
use crate::libwallet::{ use crate::libwallet::{
@ -189,7 +191,7 @@ pub fn txs(
let amount_debited_str = core::amount_to_hr_string(t.amount_debited, true); let amount_debited_str = core::amount_to_hr_string(t.amount_debited, true);
let amount_credited_str = core::amount_to_hr_string(t.amount_credited, true); let amount_credited_str = core::amount_to_hr_string(t.amount_credited, true);
let fee = match t.fee { let fee = match t.fee {
Some(f) => format!("{}", core::amount_to_hr_string(f, true)), Some(f) => format!("{}", core::amount_to_hr_string(f.fee(cur_height), true)),
None => "None".to_owned(), None => "None".to_owned(),
}; };
let net_diff = if t.amount_credited >= t.amount_debited { let net_diff = if t.amount_credited >= t.amount_debited {
@ -393,9 +395,9 @@ pub fn info(
pub fn estimate( pub fn estimate(
amount: u64, amount: u64,
strategies: Vec<( strategies: Vec<(
&str, // strategy &str, // strategy
u64, // total amount to be locked u64, // total amount to be locked
u64, // fee FeeFields, // fee
)>, )>,
dark_background_color_scheme: bool, dark_background_color_scheme: bool,
) { ) {
@ -412,17 +414,17 @@ pub fn estimate(
bMG->"Will be locked", bMG->"Will be locked",
]); ]);
for (strategy, total, fee) in strategies { for (strategy, total, fee_fields) in strategies {
if dark_background_color_scheme { if dark_background_color_scheme {
table.add_row(row![ table.add_row(row![
bFC->strategy, bFC->strategy,
FR->amount_to_hr_string(fee, false), FR->amount_to_hr_string(fee_fields.fee(2*YEAR_HEIGHT), false), // apply fee mask past HF4
FY->amount_to_hr_string(total, false), FY->amount_to_hr_string(total, false),
]); ]);
} else { } else {
table.add_row(row![ table.add_row(row![
bFD->strategy, bFD->strategy,
FR->amount_to_hr_string(fee, false), FR->amount_to_hr_string(fee_fields.fee(2*YEAR_HEIGHT), false), // apply fee mask past HF4
FY->amount_to_hr_string(total, false), FY->amount_to_hr_string(total, false),
]); ]);
} }
@ -484,7 +486,7 @@ pub fn payment_proof(tx: &TxLogEntry) -> Result<(), Error> {
None => "None".to_owned(), None => "None".to_owned(),
}; };
let fee = match tx.fee { let fee = match tx.fee {
Some(f) => f, Some(f) => f.fee(2 * YEAR_HEIGHT), // apply fee mask past HF4
None => 0, None => 0,
}; };
let amount = if tx.amount_credited >= tx.amount_debited { let amount = if tx.amount_credited >= tx.amount_debited {

View file

@ -73,7 +73,7 @@ fn no_change_test_impl(test_dir: &'static str) -> Result<(), libwallet::Error> {
// Mine into wallet 1 // Mine into wallet 1
let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), mask1, 4, false); let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), mask1, 4, false);
let fee = core::libtx::tx_fee(1, 1, 1, None); let fee = core::libtx::tx_fee(1, 1, 1);
// send a single block's worth of transactions with minimal strategy // send a single block's worth of transactions with minimal strategy
let mut slate = Slate::blank(2, false); let mut slate = Slate::blank(2, false);

View file

@ -24,6 +24,7 @@ use self::core::core::transaction;
use self::core::global; use self::core::global;
use self::libwallet::{InitTxArgs, OutputStatus, Slate, SlateState}; use self::libwallet::{InitTxArgs, OutputStatus, Slate, SlateState};
use impls::test_framework::{self, LocalWalletClient}; use impls::test_framework::{self, LocalWalletClient};
use std::convert::TryInto;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
@ -124,6 +125,7 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
assert_eq!(slate.state, SlateState::Standard3); assert_eq!(slate.state, SlateState::Standard3);
// Check we have a single kernel and that it is a Plain kernel (no lock_height). // Check we have a single kernel and that it is a Plain kernel (no lock_height).
// fees for 7 inputs, 2 outputs, 1 kernel (weight 52)
assert_eq!(slate.tx_or_err()?.kernels().len(), 1); assert_eq!(slate.tx_or_err()?.kernels().len(), 1);
assert_eq!( assert_eq!(
slate slate
@ -132,7 +134,9 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
.first() .first()
.map(|k| k.features) .map(|k| k.features)
.unwrap(), .unwrap(),
transaction::KernelFeatures::Plain { fee: 2000000 } transaction::KernelFeatures::Plain {
fee: 26_000_000.into()
}
); );
Ok(()) Ok(())
@ -147,7 +151,6 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
wallet1_info.last_confirmed_height as usize - cm as usize, wallet1_info.last_confirmed_height as usize - cm as usize,
2, 2,
1, 1,
None,
); );
// we should have a transaction entry for this slate // we should have a transaction entry for this slate
let tx = txs.iter().find(|t| t.tx_slate_id == Some(slate.id)); let tx = txs.iter().find(|t| t.tx_slate_id == Some(slate.id));
@ -157,7 +160,7 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
assert!(tx.confirmation_ts.is_none()); assert!(tx.confirmation_ts.is_none());
assert_eq!(tx.amount_debited - tx.amount_credited, fee + amount); assert_eq!(tx.amount_debited - tx.amount_credited, fee + amount);
println!("tx: {:?}", tx); println!("tx: {:?}", tx);
assert_eq!(Some(fee), tx.fee); assert_eq!(Some(fee.try_into().unwrap()), tx.fee);
Ok(()) Ok(())
})?; })?;
@ -194,7 +197,6 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
wallet1_info.last_confirmed_height as usize - 1 - cm as usize, wallet1_info.last_confirmed_height as usize - 1 - cm as usize,
2, 2,
1, 1,
None,
); );
assert!(wallet1_refreshed); assert!(wallet1_refreshed);
// wallet 1 received fees, so amount should be the same // wallet 1 received fees, so amount should be the same
@ -269,7 +271,8 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
}; };
let est = sender_api.init_send_tx(m, init_args)?; let est = sender_api.init_send_tx(m, init_args)?;
assert_eq!(est.amount, 600_000_000_000); assert_eq!(est.amount, 600_000_000_000);
assert_eq!(est.fee, 4_000_000); // fees for 5 inputs, 2 outputs, 1 kernel (weight 50)
assert_eq!(est.fee_fields.fee(0), 25_000_000);
let init_args = InitTxArgs { let init_args = InitTxArgs {
src_acct_name: None, src_acct_name: None,
@ -283,7 +286,8 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
}; };
let est = sender_api.init_send_tx(m, init_args)?; let est = sender_api.init_send_tx(m, init_args)?;
assert_eq!(est.amount, 180_000_000_000); assert_eq!(est.amount, 180_000_000_000);
assert_eq!(est.fee, 6_000_000); // fees for 3 inputs, 2 outputs, 1 kernel (weight 48)
assert_eq!(est.fee_fields.fee(0), 24_000_000);
Ok(()) Ok(())
})?; })?;

View file

@ -388,7 +388,7 @@ mod tests {
let key_id1 = ExtKeychain::derive_key_id(1, 1, 0, 0, 0); let key_id1 = ExtKeychain::derive_key_id(1, 1, 0, 0, 0);
let key_id2 = ExtKeychain::derive_key_id(1, 2, 0, 0, 0); let key_id2 = ExtKeychain::derive_key_id(1, 2, 0, 0, 0);
let tx = build::transaction( let tx = build::transaction(
KernelFeatures::Plain { fee: 2 }, KernelFeatures::Plain { fee: 2.into() },
&[build::input(5, key_id1), build::output(3, key_id2)], &[build::input(5, key_id1), build::output(3, key_id2)],
&keychain, &keychain,
&builder, &builder,

View file

@ -107,7 +107,8 @@ fn create_block_with_reward(
reward_output: Output, reward_output: Output,
reward_kernel: TxKernel, reward_kernel: TxKernel,
) -> core::core::Block { ) -> core::core::Block {
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter().unwrap()); let next_header_info =
consensus::next_difficulty(prev.height + 1, chain.difficulty_iter().unwrap());
let mut b = core::core::Block::new( let mut b = core::core::Block::new(
&prev, &prev,
txs, txs,
@ -155,7 +156,7 @@ where
K: keychain::Keychain + 'a, K: keychain::Keychain + 'a,
{ {
// build block fees // build block fees
let fee_amt = txs.iter().map(|tx| tx.fee()).sum(); let fee_amt = txs.iter().map(|tx| tx.fee(prev.height + 1)).sum();
let block_fees = BlockFees { let block_fees = BlockFees {
fees: fee_amt, fees: fee_amt,
key_id: None, key_id: None,

View file

@ -17,6 +17,7 @@ use strum::IntoEnumIterator;
use crate::api_impl::owner::finalize_tx as owner_finalize; use crate::api_impl::owner::finalize_tx as owner_finalize;
use crate::api_impl::owner::{check_ttl, post_tx}; use crate::api_impl::owner::{check_ttl, post_tx};
use crate::grin_core::core::FeeFields;
use crate::grin_keychain::Keychain; use crate::grin_keychain::Keychain;
use crate::grin_util::secp::key::SecretKey; use crate::grin_util::secp::key::SecretKey;
use crate::internal::{selection, tx, updater}; use crate::internal::{selection, tx, updater};
@ -122,7 +123,7 @@ where
} }
ret_slate.amount = 0; ret_slate.amount = 0;
ret_slate.fee = 0; ret_slate.fee_fields = FeeFields::zero();
ret_slate.remove_other_sigdata(&keychain, &context.sec_nonce, &context.sec_key)?; ret_slate.remove_other_sigdata(&keychain, &context.sec_nonce, &context.sec_key)?;
ret_slate.state = SlateState::Standard2; ret_slate.state = SlateState::Standard2;

View file

@ -16,6 +16,7 @@
use uuid::Uuid; use uuid::Uuid;
use crate::grin_core::consensus::YEAR_HEIGHT;
use crate::grin_core::core::hash::Hashed; use crate::grin_core::core::hash::Hashed;
use crate::grin_core::core::Transaction; use crate::grin_core::core::Transaction;
use crate::grin_util::secp::key::SecretKey; use crate::grin_util::secp::key::SecretKey;
@ -37,7 +38,7 @@ use ed25519_dalek::PublicKey as DalekPublicKey;
use ed25519_dalek::SecretKey as DalekSecretKey; use ed25519_dalek::SecretKey as DalekSecretKey;
use ed25519_dalek::Verifier; use ed25519_dalek::Verifier;
use std::convert::TryFrom; use std::convert::{TryFrom, TryInto};
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::Arc; use std::sync::Arc;
@ -403,7 +404,7 @@ where
tx.amount_credited - tx.amount_debited tx.amount_credited - tx.amount_debited
} else { } else {
let fee = match tx.fee { let fee = match tx.fee {
Some(f) => f, Some(f) => f.fee(2 * YEAR_HEIGHT), // apply fee mask past HF4
None => 0, None => 0,
}; };
tx.amount_debited - tx.amount_credited - fee tx.amount_debited - tx.amount_credited - fee
@ -495,7 +496,7 @@ where
&parent_key_id, &parent_key_id,
)?; )?;
slate.amount = total; slate.amount = total;
slate.fee = fee; slate.fee_fields = fee.try_into().unwrap();
return Ok(slate); return Ok(slate);
} }
@ -799,7 +800,7 @@ where
args.max_outputs as usize, args.max_outputs as usize,
args.num_change_outputs as usize, args.num_change_outputs as usize,
args.selection_strategy_is_use_all, args.selection_strategy_is_use_all,
Some(context.fee), Some(context.fee.map(|f| f.fee(current_height)).unwrap_or(0)),
parent_key_id.clone(), parent_key_id.clone(),
false, false,
true, true,
@ -869,6 +870,7 @@ where
} }
/// get stored tx /// get stored tx
/// crashes if stored tx has total fees exceeding 2^40 nanogrin
pub fn get_stored_tx<'a, T: ?Sized, C, K>( pub fn get_stored_tx<'a, T: ?Sized, C, K>(
w: &T, w: &T,
tx_id: Option<u32>, tx_id: Option<u32>,
@ -905,7 +907,7 @@ where
Some(tx) => { Some(tx) => {
let mut slate = Slate::blank(2, false); let mut slate = Slate::blank(2, false);
slate.tx = Some(tx.clone()); slate.tx = Some(tx.clone());
slate.fee = tx.fee(); slate.fee_fields = tx.aggregate_fee_fields(0).unwrap();
slate.id = id.clone(); slate.id = id.clone();
slate.offset = tx.offset; slate.offset = tx.offset;
slate.state = SlateState::Standard3; slate.state = SlateState::Standard3;

View file

@ -30,6 +30,7 @@ use crate::slate::Slate;
use crate::types::*; use crate::types::*;
use crate::util::OnionV3Address; use crate::util::OnionV3Address;
use std::collections::HashMap; use std::collections::HashMap;
use std::convert::TryInto;
/// Initialize a transaction on the sender side, returns a corresponding /// Initialize a transaction on the sender side, returns a corresponding
/// libwallet transaction slate with the appropriate inputs selected, /// libwallet transaction slate with the appropriate inputs selected,
@ -74,7 +75,7 @@ where
} }
// Update the fee on the slate so we account for this when building the tx. // Update the fee on the slate so we account for this when building the tx.
slate.fee = fee; slate.fee_fields = fee.try_into().unwrap();
slate.add_transaction_elements(keychain, &ProofBuilder::new(keychain), elems)?; slate.add_transaction_elements(keychain, &ProofBuilder::new(keychain), elems)?;
// Create our own private context // Create our own private context
@ -85,7 +86,7 @@ where
is_initiator, is_initiator,
); );
context.fee = fee; context.fee = Some(slate.fee_fields);
context.amount = slate.amount; context.amount = slate.amount;
// Store our private identifiers for each input // Store our private identifiers for each input
@ -151,7 +152,7 @@ where
t.tx_slate_id = Some(slate_id); t.tx_slate_id = Some(slate_id);
let filename = format!("{}.grintx", slate_id); let filename = format!("{}.grintx", slate_id);
t.stored_tx = Some(filename); t.stored_tx = Some(filename);
t.fee = Some(context.fee); t.fee = context.fee;
t.ttl_cutoff_height = match slate.ttl_cutoff_height { t.ttl_cutoff_height = match slate.ttl_cutoff_height {
0 => None, 0 => None,
n => Some(n), n => Some(n),
@ -268,7 +269,7 @@ where
context.add_output(&key_id, &None, amount); context.add_output(&key_id, &None, amount);
context.amount = amount; context.amount = amount;
context.fee = slate.fee; context.fee = slate.fee_fields.as_opt();
let commit = wallet.calc_commit_for_cache(keychain_mask, amount, &key_id_inner)?; let commit = wallet.calc_commit_for_cache(keychain_mask, amount, &key_id_inner)?;
let mut batch = wallet.batch(keychain_mask)?; let mut batch = wallet.batch(keychain_mask)?;
let log_id = batch.next_tx_log_id(&parent_key_id)?; let log_id = batch.next_tx_log_id(&parent_key_id)?;
@ -398,7 +399,7 @@ where
// sender // sender
// First attempt to spend without change // First attempt to spend without change
let mut fee = tx_fee(coins.len(), 1, 1, None); let mut fee = tx_fee(coins.len(), 1, 1);
let mut total: u64 = coins.iter().map(|c| c.value).sum(); let mut total: u64 = coins.iter().map(|c| c.value).sum();
let mut amount_with_fee = amount + fee; let mut amount_with_fee = amount + fee;
@ -427,7 +428,7 @@ where
// We need to add a change address or amount with fee is more than total // We need to add a change address or amount with fee is more than total
if total != amount_with_fee { if total != amount_with_fee {
fee = tx_fee(coins.len(), num_outputs, 1, None); fee = tx_fee(coins.len(), num_outputs, 1);
amount_with_fee = amount + fee; amount_with_fee = amount + fee;
// Here check if we have enough outputs for the amount including fee otherwise // Here check if we have enough outputs for the amount including fee otherwise
@ -455,7 +456,7 @@ where
parent_key_id, parent_key_id,
) )
.1; .1;
fee = tx_fee(coins.len(), num_outputs, 1, None); fee = tx_fee(coins.len(), num_outputs, 1);
total = coins.iter().map(|c| c.value).sum(); total = coins.iter().map(|c| c.value).sum();
amount_with_fee = amount + fee; amount_with_fee = amount + fee;
} }
@ -655,7 +656,9 @@ where
// restore the original amount, fee // restore the original amount, fee
slate.amount = context.amount; slate.amount = context.amount;
if update_fee { if update_fee {
slate.fee = context.fee; slate.fee_fields = context
.fee
.ok_or_else(|| ErrorKind::Fee("Missing fee fields".into()))?;
} }
let keychain = wallet.keychain(keychain_mask)?; let keychain = wallet.keychain(keychain_mask)?;

View file

@ -35,6 +35,7 @@ use ed25519_dalek::PublicKey as DalekPublicKey;
use ed25519_dalek::SecretKey as DalekSecretKey; use ed25519_dalek::SecretKey as DalekSecretKey;
use ed25519_dalek::Signature as DalekSignature; use ed25519_dalek::Signature as DalekSignature;
use ed25519_dalek::{Signer, Verifier}; use ed25519_dalek::{Signer, Verifier};
use grin_wallet_util::grin_core::core::FeeFields;
// static for incrementing test UUIDs // static for incrementing test UUIDs
lazy_static! { lazy_static! {
@ -276,13 +277,13 @@ where
init_tx_args.selection_strategy_is_use_all, init_tx_args.selection_strategy_is_use_all,
&parent_key_id, &parent_key_id,
)?; )?;
slate.fee = fee; slate.fee_fields = FeeFields::new(0, fee)?;
let keychain = wallet.keychain(keychain_mask)?; let keychain = wallet.keychain(keychain_mask)?;
// Create our own private context // Create our own private context
let mut context = Context::new(keychain.secp(), &parent_key_id, use_test_rng, true); let mut context = Context::new(keychain.secp(), &parent_key_id, use_test_rng, true);
context.fee = slate.fee; context.fee = Some(slate.fee_fields);
context.amount = slate.amount; context.amount = slate.amount;
context.late_lock_args = Some(init_tx_args.clone()); context.late_lock_args = Some(init_tx_args.clone());
@ -585,7 +586,7 @@ mod test {
use super::*; use super::*;
use rand::rngs::mock::StepRng; use rand::rngs::mock::StepRng;
use crate::grin_core::core::KernelFeatures; use crate::grin_core::core::{FeeFields, KernelFeatures};
use crate::grin_core::libtx::{build, ProofBuilder}; use crate::grin_core::libtx::{build, ProofBuilder};
use crate::grin_keychain::{ use crate::grin_keychain::{
BlindSum, BlindingFactor, ExtKeychain, ExtKeychainPath, Keychain, SwitchCommitmentType, BlindSum, BlindingFactor, ExtKeychain, ExtKeychainPath, Keychain, SwitchCommitmentType,
@ -601,14 +602,18 @@ mod test {
let key_id1 = ExtKeychainPath::new(1, 1, 0, 0, 0).to_identifier(); let key_id1 = ExtKeychainPath::new(1, 1, 0, 0, 0).to_identifier();
let tx1 = build::transaction( let tx1 = build::transaction(
KernelFeatures::Plain { fee: 0 }, KernelFeatures::Plain {
fee: FeeFields::zero(),
},
&[build::output(105, key_id1.clone())], &[build::output(105, key_id1.clone())],
&keychain, &keychain,
&builder, &builder,
) )
.unwrap(); .unwrap();
let tx2 = build::transaction( let tx2 = build::transaction(
KernelFeatures::Plain { fee: 0 }, KernelFeatures::Plain {
fee: FeeFields::zero(),
},
&[build::input(105, key_id1.clone())], &[build::input(105, key_id1.clone())],
&keychain, &keychain,
&builder, &builder,

View file

@ -16,10 +16,11 @@
//! around during an interactive wallet exchange //! around during an interactive wallet exchange
use crate::error::{Error, ErrorKind}; use crate::error::{Error, ErrorKind};
use crate::grin_core::consensus::YEAR_HEIGHT;
use crate::grin_core::core::amount_to_hr_string; use crate::grin_core::core::amount_to_hr_string;
use crate::grin_core::core::transaction::{ use crate::grin_core::core::transaction::{
Input, Inputs, KernelFeatures, NRDRelativeHeight, Output, OutputFeatures, Transaction, FeeFields, Input, Inputs, KernelFeatures, NRDRelativeHeight, Output, OutputFeatures,
TxKernel, Weighting, Transaction, TxKernel, Weighting,
}; };
use crate::grin_core::core::verifier_cache::LruVerifierCache; use crate::grin_core::core::verifier_cache::LruVerifierCache;
use crate::grin_core::libtx::{aggsig, build, proof::ProofBuild, tx_fee}; use crate::grin_core::libtx::{aggsig, build, proof::ProofBuild, tx_fee};
@ -105,8 +106,8 @@ pub struct Slate {
pub tx: Option<Transaction>, pub tx: Option<Transaction>,
/// base amount (excluding fee) /// base amount (excluding fee)
pub amount: u64, pub amount: u64,
/// fee amount /// fee amount and shift
pub fee: u64, pub fee_fields: FeeFields,
/// TTL, the block height at which wallets /// TTL, the block height at which wallets
/// should refuse to process the transaction and unlock all /// should refuse to process the transaction and unlock all
/// associated outputs /// associated outputs
@ -265,7 +266,7 @@ impl Slate {
state, state,
tx: Some(Slate::empty_transaction()), tx: Some(Slate::empty_transaction()),
amount: 0, amount: 0,
fee: 0, fee_fields: FeeFields::zero(),
ttl_cutoff_height: 0, ttl_cutoff_height: 0,
kernel_features: 0, kernel_features: 0,
offset: BlindingFactor::zero(), offset: BlindingFactor::zero(),
@ -351,10 +352,12 @@ impl Slate {
// Any other value is invalid. // Any other value is invalid.
fn kernel_features(&self) -> Result<KernelFeatures, Error> { fn kernel_features(&self) -> Result<KernelFeatures, Error> {
match self.kernel_features { match self.kernel_features {
0 => Ok(KernelFeatures::Plain { fee: self.fee }), 0 => Ok(KernelFeatures::Plain {
fee: self.fee_fields,
}),
1 => Err(ErrorKind::InvalidKernelFeatures(1).into()), 1 => Err(ErrorKind::InvalidKernelFeatures(1).into()),
2 => Ok(KernelFeatures::HeightLocked { 2 => Ok(KernelFeatures::HeightLocked {
fee: self.fee, fee: self.fee_fields,
lock_height: match &self.kernel_features_args { lock_height: match &self.kernel_features_args {
Some(a) => a.lock_height, Some(a) => a.lock_height,
None => { None => {
@ -363,7 +366,7 @@ impl Slate {
}, },
}), }),
3 => Ok(KernelFeatures::NoRecentDuplicate { 3 => Ok(KernelFeatures::NoRecentDuplicate {
fee: self.fee, fee: self.fee_fields,
relative_height: match &self.kernel_features_args { relative_height: match &self.kernel_features_args {
Some(a) => NRDRelativeHeight::new(a.lock_height)?, Some(a) => NRDRelativeHeight::new(a.lock_height)?,
None => { None => {
@ -549,24 +552,23 @@ impl Slate {
// double check the fee amount included in the partial tx // double check the fee amount included in the partial tx
// we don't necessarily want to just trust the sender // we don't necessarily want to just trust the sender
// we could just overwrite the fee here (but we won't) due to the sig // we could just overwrite the fee here (but we won't) due to the sig
let fee = tx_fee( let fee = tx_fee(tx.inputs().len(), tx.outputs().len(), tx.kernels().len());
tx.inputs().len(),
tx.outputs().len(),
tx.kernels().len(),
None,
);
if fee > tx.fee() { if fee > tx.fee(2 * YEAR_HEIGHT) {
return Err( // apply fee mask past HF4
ErrorKind::Fee(format!("Fee Dispute Error: {}, {}", tx.fee(), fee,)).into(), return Err(ErrorKind::Fee(format!(
); "Fee Dispute Error: {}, {}",
tx.fee(2 * YEAR_HEIGHT),
fee,
))
.into());
} }
if fee > self.amount + self.fee { if fee > self.amount + self.fee_fields.fee(2 * YEAR_HEIGHT) {
let reason = format!( let reason = format!(
"Rejected the transfer because transaction fee ({}) exceeds received amount ({}).", "Rejected the transfer because transaction fee ({}) exceeds received amount ({}).",
amount_to_hr_string(fee, false), amount_to_hr_string(fee, false),
amount_to_hr_string(self.amount + self.fee, false) amount_to_hr_string(self.amount + self.fee_fields.fee(2 * YEAR_HEIGHT), false)
); );
info!("{}", reason); info!("{}", reason);
return Err(ErrorKind::Fee(reason).into()); return Err(ErrorKind::Fee(reason).into());
@ -676,7 +678,7 @@ impl Slate {
// confirm the overall transaction is valid (including the updated kernel) // confirm the overall transaction is valid (including the updated kernel)
// accounting for tx weight limits // accounting for tx weight limits
let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new())); let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new()));
if let Err(e) = final_tx.validate(Weighting::AsTransaction, verifier_cache) { if let Err(e) = final_tx.validate(Weighting::AsTransaction, verifier_cache, 0) {
error!("Error with final tx validation: {}", e); error!("Error with final tx validation: {}", e);
Err(e.into()) Err(e.into())
} else { } else {
@ -708,7 +710,7 @@ impl From<Slate> for SlateV4 {
state, state,
tx: _, tx: _,
amount, amount,
fee, fee_fields,
kernel_features, kernel_features,
ttl_cutoff_height: ttl, ttl_cutoff_height: ttl,
offset: off, offset: off,
@ -734,7 +736,7 @@ impl From<Slate> for SlateV4 {
sta, sta,
coms: (&slate).into(), coms: (&slate).into(),
amt: amount, amt: amount,
fee, fee: fee_fields,
feat: kernel_features, feat: kernel_features,
ttl, ttl,
off, off,
@ -754,7 +756,7 @@ impl From<&Slate> for SlateV4 {
state, state,
tx: _, tx: _,
amount, amount,
fee, fee_fields,
kernel_features, kernel_features,
ttl_cutoff_height: ttl, ttl_cutoff_height: ttl,
offset, offset,
@ -766,7 +768,7 @@ impl From<&Slate> for SlateV4 {
let num_parts = *num_parts; let num_parts = *num_parts;
let id = *id; let id = *id;
let amount = *amount; let amount = *amount;
let fee = *fee; let fee_fields = *fee_fields;
let feat = *kernel_features; let feat = *kernel_features;
let ttl = *ttl; let ttl = *ttl;
let off = offset.clone(); let off = offset.clone();
@ -787,7 +789,7 @@ impl From<&Slate> for SlateV4 {
sta, sta,
coms: slate.into(), coms: slate.into(),
amt: amount, amt: amount,
fee, fee: fee_fields,
feat, feat,
ttl, ttl,
off, off,
@ -914,7 +916,7 @@ impl From<SlateV4> for Slate {
sta, sta,
coms: _, coms: _,
amt: amount, amt: amount,
fee, fee: fee_fields,
feat: kernel_features, feat: kernel_features,
ttl: ttl_cutoff_height, ttl: ttl_cutoff_height,
off: offset, off: offset,
@ -940,7 +942,7 @@ impl From<SlateV4> for Slate {
state, state,
tx: (&slate).into(), tx: (&slate).into(),
amount, amount,
fee, fee_fields,
kernel_features, kernel_features,
ttl_cutoff_height, ttl_cutoff_height,
offset, offset,
@ -960,7 +962,7 @@ pub fn tx_from_slate_v4(slate: &SlateV4) -> Option<Transaction> {
let secp = static_secp_instance(); let secp = static_secp_instance();
let secp = secp.lock(); let secp = secp.lock();
let mut calc_slate = Slate::blank(2, false); let mut calc_slate = Slate::blank(2, false);
calc_slate.fee = slate.fee; calc_slate.fee_fields = slate.fee;
for d in slate.sigs.iter() { for d in slate.sigs.iter() {
calc_slate.participant_data.push(ParticipantData { calc_slate.participant_data.push(ParticipantData {
public_blind_excess: d.xs, public_blind_excess: d.xs,

View file

@ -53,6 +53,7 @@
//! * The `receiver_signature` field is renamed to `rsig` //! * The `receiver_signature` field is renamed to `rsig`
//! * `rsig` may be omitted if it has not yet been filled out //! * `rsig` may be omitted if it has not yet been filled out
use crate::grin_core::core::FeeFields;
use crate::grin_core::core::{Input, Output, TxKernel}; use crate::grin_core::core::{Input, Output, TxKernel};
use crate::grin_core::libtx::secp_ser; use crate::grin_core::libtx::secp_ser;
use crate::grin_keychain::{BlindingFactor, Identifier}; use crate::grin_keychain::{BlindingFactor, Identifier};
@ -95,11 +96,10 @@ pub struct SlateV4 {
#[serde(skip_serializing_if = "u64_is_blank")] #[serde(skip_serializing_if = "u64_is_blank")]
#[serde(default = "default_u64_0")] #[serde(default = "default_u64_0")]
pub amt: u64, pub amt: u64,
/// fee amount /// fee
#[serde(with = "secp_ser::string_or_u64")] #[serde(skip_serializing_if = "fee_is_zero")]
#[serde(default = "default_u64")] #[serde(default = "default_fee")]
#[serde(skip_serializing_if = "u64_is_blank")] pub fee: FeeFields,
pub fee: u64,
/// kernel features, if any /// kernel features, if any
#[serde(skip_serializing_if = "u8_is_blank")] #[serde(skip_serializing_if = "u8_is_blank")]
#[serde(default = "default_u8_0")] #[serde(default = "default_u8_0")]
@ -297,10 +297,6 @@ fn default_range_proof() -> Option<RangeProof> {
None None
} }
fn default_u64() -> u64 {
0
}
fn u64_is_blank(u: &u64) -> bool { fn u64_is_blank(u: &u64) -> bool {
*u == 0 *u == 0
} }
@ -312,6 +308,15 @@ fn default_u8_0() -> u8 {
fn u8_is_blank(u: &u8) -> bool { fn u8_is_blank(u: &u8) -> bool {
*u == 0 *u == 0
} }
fn fee_is_zero(f: &FeeFields) -> bool {
f.is_zero()
}
fn default_fee() -> FeeFields {
FeeFields::zero()
}
/// A mining node requests new coinbase via the foreign api every time a new candidate block is built. /// A mining node requests new coinbase via the foreign api every time a new candidate block is built.
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CoinbaseV4 { pub struct CoinbaseV4 {

View file

@ -14,7 +14,8 @@
//! Wraps a V4 Slate into a V4 Binary slate //! Wraps a V4 Slate into a V4 Binary slate
use crate::grin_core::core::transaction::OutputFeatures; use crate::grin_core::consensus::YEAR_HEIGHT;
use crate::grin_core::core::transaction::{FeeFields, OutputFeatures};
use crate::grin_core::ser as grin_ser; use crate::grin_core::ser as grin_ser;
use crate::grin_core::ser::{Readable, Reader, Writeable, Writer}; use crate::grin_core::ser::{Readable, Reader, Writeable, Writer};
use crate::grin_keychain::BlindingFactor; use crate::grin_keychain::BlindingFactor;
@ -87,8 +88,8 @@ struct SlateOptFields {
pub num_parts: u8, pub num_parts: u8,
/// amt, default 0 /// amt, default 0
pub amt: u64, pub amt: u64,
/// fee, default 0 /// fee_fields, default FeeFields::zero()
pub fee: u64, pub fee: FeeFields,
/// kernel features, default 0 /// kernel features, default 0
pub feat: u8, pub feat: u8,
/// ttl, default 0 /// ttl, default 0
@ -107,7 +108,8 @@ impl Writeable for SlateOptFields {
if self.amt > 0 { if self.amt > 0 {
status |= 0x02; status |= 0x02;
} }
if self.fee > 0 { if self.fee.fee(2 * YEAR_HEIGHT) > 0 {
// apply fee mask past HF4
status |= 0x04; status |= 0x04;
} }
if self.feat > 0 { if self.feat > 0 {
@ -124,7 +126,7 @@ impl Writeable for SlateOptFields {
writer.write_u64(self.amt)?; writer.write_u64(self.amt)?;
} }
if status & 0x04 > 0 { if status & 0x04 > 0 {
writer.write_u64(self.fee)?; self.fee.write(writer)?;
} }
if status & 0x08 > 0 { if status & 0x08 > 0 {
writer.write_u8(self.feat)?; writer.write_u8(self.feat)?;
@ -150,9 +152,9 @@ impl Readable for SlateOptFields {
0 0
}; };
let fee = if status & 0x04 > 0 { let fee = if status & 0x04 > 0 {
reader.read_u64()? FeeFields::read(reader)?
} else { } else {
0 FeeFields::zero()
}; };
let feat = if status & 0x08 > 0 { let feat = if status & 0x08 > 0 {
reader.read_u8()? reader.read_u8()?
@ -488,7 +490,9 @@ fn slate_v4_serialize_deserialize() {
use crate::grin_util::from_hex; use crate::grin_util::from_hex;
use crate::grin_util::secp::key::PublicKey; use crate::grin_util::secp::key::PublicKey;
use crate::Slate; use crate::Slate;
use grin_wallet_util::grin_core::global::{set_local_chain_type, ChainTypes};
use grin_wallet_util::grin_keychain::{ExtKeychain, Keychain, SwitchCommitmentType}; use grin_wallet_util::grin_keychain::{ExtKeychain, Keychain, SwitchCommitmentType};
set_local_chain_type(ChainTypes::Mainnet);
let slate = Slate::blank(1, false); let slate = Slate::blank(1, false);
let mut v4 = SlateV4::from(slate); let mut v4 = SlateV4::from(slate);

View file

@ -18,6 +18,7 @@
use crate::config::{TorConfig, WalletConfig}; use crate::config::{TorConfig, WalletConfig};
use crate::error::{Error, ErrorKind}; use crate::error::{Error, ErrorKind};
use crate::grin_core::core::hash::Hash; use crate::grin_core::core::hash::Hash;
use crate::grin_core::core::FeeFields;
use crate::grin_core::core::{Output, Transaction, TxKernel}; use crate::grin_core::core::{Output, Transaction, TxKernel};
use crate::grin_core::libtx::{aggsig, secp_ser}; use crate::grin_core::libtx::{aggsig, secp_ser};
use crate::grin_core::{global, ser}; use crate::grin_core::{global, ser};
@ -554,7 +555,7 @@ pub struct Context {
/// needed by the other party /// needed by the other party
pub amount: u64, pub amount: u64,
/// store the calculated fee /// store the calculated fee
pub fee: u64, pub fee: Option<FeeFields>,
/// Payment proof sender address derivation path, if needed /// Payment proof sender address derivation path, if needed
pub payment_proof_derivation_index: Option<u32>, pub payment_proof_derivation_index: Option<u32>,
/// If late-locking, store my tranasction creation prefs /// If late-locking, store my tranasction creation prefs
@ -608,7 +609,7 @@ impl Context {
input_ids: vec![], input_ids: vec![],
output_ids: vec![], output_ids: vec![],
amount: 0, amount: 0,
fee: 0, fee: None,
payment_proof_derivation_index: None, payment_proof_derivation_index: None,
late_lock_args: None, late_lock_args: None,
calculated_excess: None, calculated_excess: None,
@ -818,8 +819,7 @@ pub struct TxLogEntry {
#[serde(with = "secp_ser::string_or_u64")] #[serde(with = "secp_ser::string_or_u64")]
pub amount_debited: u64, pub amount_debited: u64,
/// Fee /// Fee
#[serde(with = "secp_ser::opt_string_or_u64")] pub fee: Option<FeeFields>,
pub fee: Option<u64>,
/// Cutoff block height /// Cutoff block height
#[serde(with = "secp_ser::opt_string_or_u64")] #[serde(with = "secp_ser::opt_string_or_u64")]
#[serde(default)] #[serde(default)]

View file

@ -14,6 +14,7 @@
//! core::libtx specific tests //! core::libtx specific tests
use grin_wallet_libwallet::Context; use grin_wallet_libwallet::Context;
use grin_wallet_util::grin_core::core::transaction; use grin_wallet_util::grin_core::core::transaction;
use grin_wallet_util::grin_core::core::FeeFields;
use grin_wallet_util::grin_core::libtx::{aggsig, proof}; use grin_wallet_util::grin_core::libtx::{aggsig, proof};
use grin_wallet_util::grin_keychain::{ use grin_wallet_util::grin_keychain::{
BlindSum, BlindingFactor, ExtKeychain, ExtKeychainPath, Keychain, SwitchCommitmentType, BlindSum, BlindingFactor, ExtKeychain, ExtKeychainPath, Keychain, SwitchCommitmentType,
@ -23,9 +24,11 @@ use grin_wallet_util::grin_util::secp::key::{PublicKey, SecretKey};
use rand::thread_rng; use rand::thread_rng;
fn kernel_sig_msg() -> secp::Message { fn kernel_sig_msg() -> secp::Message {
transaction::KernelFeatures::Plain { fee: 0 } transaction::KernelFeatures::Plain {
.kernel_sig_msg() fee: FeeFields::zero(),
.unwrap() }
.kernel_sig_msg()
.unwrap()
} }
#[test] #[test]

View file

@ -153,6 +153,8 @@ fn real_main() -> i32 {
.clone(), .clone(),
); );
global::init_global_accept_fee_base(config.members.as_ref().unwrap().wallet.accept_fee_base());
let wallet_config = config.clone().members.unwrap().wallet; let wallet_config = config.clone().members.unwrap().wallet;
let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None); let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None);