mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
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:
co-authored by
Jasper van der Maarel
parent
429db61bb7
commit
8334304c16
@@ -122,7 +122,13 @@ fn comments() -> HashMap<String, String> {
|
||||
"
|
||||
.to_string(),
|
||||
);
|
||||
|
||||
retval.insert(
|
||||
"accept_fee_base".to_string(),
|
||||
"
|
||||
#Minimum acceptable fee per unit of transaction weight
|
||||
"
|
||||
.to_string(),
|
||||
);
|
||||
retval.insert(
|
||||
"[logging]".to_string(),
|
||||
"
|
||||
|
||||
@@ -53,6 +53,9 @@ pub struct WalletConfig {
|
||||
pub dark_background_color_scheme: Option<bool>,
|
||||
/// The exploding lifetime (minutes) for keybase notification on coins received
|
||||
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 {
|
||||
@@ -71,6 +74,7 @@ impl Default for WalletConfig {
|
||||
tls_certificate_key: None,
|
||||
dark_background_color_scheme: Some(true),
|
||||
keybase_notify_ttl: Some(1440),
|
||||
accept_fee_base: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +90,11 @@ impl WalletConfig {
|
||||
3420
|
||||
}
|
||||
|
||||
/// Default listener port
|
||||
pub fn default_accept_fee_base() -> u64 {
|
||||
500_000
|
||||
}
|
||||
|
||||
/// Use value from config file, defaulting to sensible value if missing.
|
||||
pub fn owner_api_listen_port(&self) -> u16 {
|
||||
self.owner_api_listen_port
|
||||
@@ -96,6 +105,12 @@ impl WalletConfig {
|
||||
pub fn owner_api_listen_addr(&self) -> String {
|
||||
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.
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user