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
co-authored by Jasper van der Maarel
parent 429db61bb7
commit 8334304c16
21 changed files with 196 additions and 140 deletions
+4 -3
View File
@@ -17,6 +17,7 @@
use crate::api::TLSConfig;
use crate::apiwallet::{try_slatepack_sync_workflow, Owner};
use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME};
use crate::core::core::FeeFields;
use crate::core::{core, global};
use crate::error::{Error, ErrorKind};
use crate::impls::PathToSlatepack;
@@ -277,7 +278,7 @@ where
let mut slate = Slate::blank(2, false);
controller::owner_single_use(None, keychain_mask, Some(owner_api), |api, m| {
if args.estimate_selection_strategies {
let strategies = vec!["smallest", "all"]
let strategies: Vec<(&str, u64, FeeFields)> = vec!["smallest", "all"]
.into_iter()
.map(|strategy| {
let init_args = InitTxArgs {
@@ -291,7 +292,7 @@ where
..Default::default()
};
let slate = api.init_send_tx(m, init_args).unwrap();
(strategy, slate.amount, slate.fee)
(strategy, slate.amount, slate.fee_fields)
})
.collect();
display::estimate(args.amount, strategies, dark_scheme);
@@ -848,7 +849,7 @@ where
..Default::default()
};
let slate = api.init_send_tx(m, init_args).unwrap();
(strategy, slate.amount, slate.fee)
(strategy, slate.amount, slate.fee_fields)
})
.collect();
display::estimate(slate.amount, strategies, dark_scheme);