remove height argument from fee related functions as per fixpastfees RFC (#602)

* remove height argument from fee related functions as per fixpastfees RFC

* Cargo.lock updated from cargo update -p grin_core
This commit is contained in:
John Tromp
2021-05-19 14:27:42 -04:00
committed by GitHub
parent 83fd8ffc86
commit b7f587f2b3
7 changed files with 36 additions and 43 deletions
+4 -5
View File
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// 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::global;
@@ -191,7 +190,7 @@ pub fn txs(
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 fee = match t.fee {
Some(f) => format!("{}", core::amount_to_hr_string(f.fee(cur_height), true)),
Some(f) => format!("{}", core::amount_to_hr_string(f.fee(), true)),
None => "None".to_owned(),
};
let net_diff = if t.amount_credited >= t.amount_debited {
@@ -418,13 +417,13 @@ pub fn estimate(
if dark_background_color_scheme {
table.add_row(row![
bFC->strategy,
FR->amount_to_hr_string(fee_fields.fee(2*YEAR_HEIGHT), false), // apply fee mask past HF4
FR->amount_to_hr_string(fee_fields.fee(), false), // apply fee mask past HF4
FY->amount_to_hr_string(total, false),
]);
} else {
table.add_row(row![
bFD->strategy,
FR->amount_to_hr_string(fee_fields.fee(2*YEAR_HEIGHT), false), // apply fee mask past HF4
FR->amount_to_hr_string(fee_fields.fee(), false), // apply fee mask past HF4
FY->amount_to_hr_string(total, false),
]);
}
@@ -486,7 +485,7 @@ pub fn payment_proof(tx: &TxLogEntry) -> Result<(), Error> {
None => "None".to_owned(),
};
let fee = match tx.fee {
Some(f) => f.fee(2 * YEAR_HEIGHT), // apply fee mask past HF4
Some(f) => f.fee(), // apply fee mask past HF4
None => 0,
};
let amount = if tx.amount_credited >= tx.amount_debited {
+2 -2
View File
@@ -272,7 +272,7 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
let est = sender_api.init_send_tx(m, init_args)?;
assert_eq!(est.amount, 600_000_000_000);
// fees for 5 inputs, 2 outputs, 1 kernel (weight 50)
assert_eq!(est.fee_fields.fee(0), 25_000_000);
assert_eq!(est.fee_fields.fee(), 25_000_000);
let init_args = InitTxArgs {
src_acct_name: None,
@@ -287,7 +287,7 @@ fn basic_transaction_api(test_dir: &'static str) -> Result<(), libwallet::Error>
let est = sender_api.init_send_tx(m, init_args)?;
assert_eq!(est.amount, 180_000_000_000);
// fees for 3 inputs, 2 outputs, 1 kernel (weight 48)
assert_eq!(est.fee_fields.fee(0), 24_000_000);
assert_eq!(est.fee_fields.fee(), 24_000_000);
Ok(())
})?;