Major fee bump to come to more reasonable values

Starting on the higher side for testnet to see how it goes in
practice. Introduced constants for each smaller unit.
This commit is contained in:
Ignotus Peverell 2017-11-14 20:14:07 -05:00
parent 89217a1fa5
commit 6ac2fe2a8c
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
4 changed files with 14 additions and 7 deletions

View file

@ -25,8 +25,14 @@ use std::cmp::max;
use ser; use ser;
use core::target::Difficulty; use core::target::Difficulty;
/// A grin is divisible to 10^9, a nanogrin /// A grin is divisible to 10^9, following the SI prefixes
pub const GRIN_BASE: u64 = 1_000_000_000; pub const GRIN_BASE: u64 = 1_000_000_000;
/// Milligrin, a thousand of a grin
pub const MILLI_GRIN: u64 = GRIN_BASE / 1_000;
/// Microgrin, a thousand of a milligrin
pub const MICRO_GRIN: u64 = MILLI_GRIN / 1_000;
/// Nanogrin, smallest unit, takes a billion to make a grin
pub const NANO_GRIN: u64 = 1;
/// The block subsidy amount /// The block subsidy amount
pub const REWARD: u64 = 50 * GRIN_BASE; pub const REWARD: u64 = 50 * GRIN_BASE;

View file

@ -585,7 +585,6 @@ where
// for a basic transaction (1 input, 2 outputs) - // for a basic transaction (1 input, 2 outputs) -
// (-1 * 1) + (4 * 2) + 1 = 8 // (-1 * 1) + (4 * 2) + 1 = 8
// 8 * 10 = 80 // 8 * 10 = 80
//
if self.config.accept_fee_base > 0 { if self.config.accept_fee_base > 0 {
let mut tx_weight = -1 * (tx.inputs.len() as i32) + (4 * tx.outputs.len() as i32) + 1; let mut tx_weight = -1 * (tx.inputs.len() as i32) + (4 * tx.outputs.len() as i32) + 1;
if tx_weight < 1 { if tx_weight < 1 {

View file

@ -24,6 +24,7 @@ use util::secp::pedersen::Commitment;
pub use graph; pub use graph;
use core::consensus;
use core::core::block; use core::core::block;
use core::core::transaction; use core::core::transaction;
use core::core::hash; use core::core::hash;
@ -52,7 +53,7 @@ impl Default for PoolConfig {
} }
fn default_accept_fee_base() -> u64 { fn default_accept_fee_base() -> u64 {
10 consensus::MILLI_GRIN
} }
fn default_max_pool_size() -> usize { fn default_max_pool_size() -> usize {
50_000 50_000

View file

@ -32,6 +32,7 @@ use tokio_retry::strategy::FibonacciBackoff;
use api; use api;
use core::consensus;
use core::core::{transaction, Transaction}; use core::core::{transaction, Transaction};
use core::ser; use core::ser;
use keychain; use keychain;
@ -42,7 +43,7 @@ const DAT_FILE: &'static str = "wallet.dat";
const LOCK_FILE: &'static str = "wallet.lock"; const LOCK_FILE: &'static str = "wallet.lock";
const SEED_FILE: &'static str = "wallet.seed"; const SEED_FILE: &'static str = "wallet.seed";
const DEFAULT_BASE_FEE: u64 = 10; const DEFAULT_BASE_FEE: u64 = consensus::MILLI_GRIN;
/// Transaction fee calculation /// Transaction fee calculation
pub fn tx_fee(input_len: usize, output_len: usize, base_fee: Option<u64>) -> u64 { pub fn tx_fee(input_len: usize, output_len: usize, base_fee: Option<u64>) -> u64 {