Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to streamline getting/setting of fees for main/testnet #74

Merged
merged 1 commit into from
Mar 1, 2016

Conversation

alexlyp
Copy link
Member

@alexlyp alexlyp commented Mar 1, 2016

Move switch/case for main/testnet inside the get/setters for wallet.FeeIncrement()

Replace all existing switch/cases with w.FeeIncrement() and the proper one will be returned.

On wallet creation the 2 non-exported feeIncrementMainnet and feeIncrementTestnet fields in wallet are set to the consts FeeIncrementMainnet and FeeIncrementTestnet respectively.

Fixes #34

@jcvernaleo
Copy link
Member

I like it. Not repeating that switch/case so many times seems like a positive to me.

@@ -225,7 +216,8 @@ func newWallet(vb uint16, esm bool, btm dcrutil.Amount, addressReuse bool,
BalanceToMaintain: btm,
CurrentStakeDiff: &StakeDifficultyInfo{nil, -1, -1},
lockedOutpoints: map[wire.OutPoint]struct{}{},
feeIncrement: feeIncrement,
feeIncrementMainnet: FeeIncrementMainnet,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just declare a single fee increment here, since mainnet and testnet will never be enabled at the same time. Put the switch case above the struct declaration.

@jcvernaleo
Copy link
Member

Seems good when I run it.
tACK
(but needs a rebase).

Remove all switch/cases for FeeIncrment except for intial wallet
creation.  Instead all set/getting of feeIncrement is done with
the mutex safe get and set.  This cleans up the code and
provides a straightforward way to get/set that field
@jcvernaleo
Copy link
Member

Tested and it is good. OK

@jcvernaleo jcvernaleo merged commit ee276f6 into decred:master Mar 1, 2016
@alexlyp alexlyp deleted the ayp_cleanSwitchs branch April 4, 2016 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants