Skip to content
Snippets Groups Projects
Unverified Commit 13ab4150 authored by bgallois's avatar bgallois
Browse files

workaround pallet_duniter_account

Workaround to be able to pass https://github.com/paritytech/substrate/blob/6ef184e33f6ce0f56999ae84b212ea6148c0624d/frame/balances/src/benchmarking.rs#L271 in the benchmark.
ExtraFlags is private and Default is always new_logic not suitable for the benchmark.
parent f1223f65
No related branches found
No related tags found
No related merge requests found
...@@ -32,13 +32,17 @@ pub struct AccountData<Balance> { ...@@ -32,13 +32,17 @@ pub struct AccountData<Balance> {
pub(super) reserved: Balance, pub(super) reserved: Balance,
// see Substrate AccountData // see Substrate AccountData
fee_frozen: Balance, fee_frozen: Balance,
// Workaround because ExtraFlags is not public
// Refactoration is needed
flag: pallet_balances::AccountData<Balance>,
} }
impl<Balance: Zero> AccountData<Balance> { impl<Balance: Zero + Clone> AccountData<Balance> {
pub fn set_balances(&mut self, new_balances: pallet_balances::AccountData<Balance>) { pub fn set_balances(&mut self, new_balances: pallet_balances::AccountData<Balance>) {
self.free = new_balances.free; self.free = new_balances.free.clone();
self.reserved = new_balances.reserved; self.reserved = new_balances.reserved.clone();
self.fee_frozen = new_balances.frozen; self.fee_frozen = new_balances.frozen.clone();
self.flag = new_balances;
} }
pub fn was_providing(&self) -> bool { pub fn was_providing(&self) -> bool {
!self.free.is_zero() || !self.reserved.is_zero() !self.free.is_zero() || !self.reserved.is_zero()
...@@ -53,7 +57,7 @@ impl<Balance: Zero + sp_std::default::Default> From<AccountData<Balance>> ...@@ -53,7 +57,7 @@ impl<Balance: Zero + sp_std::default::Default> From<AccountData<Balance>>
free: account_data.free, free: account_data.free,
reserved: account_data.reserved, reserved: account_data.reserved,
frozen: account_data.fee_frozen, frozen: account_data.fee_frozen,
..Default::default() flags: account_data.flag.flags,
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment