Invert allowfree option.

Boolean options cannot be unset from a default true value on the
command line, so invert the allowfree option, renaming it
disallowfree, so attaching fees may always be forced by specifying
disallowfree = true in the configuration file, or --disallowfree on
the command line.
This commit is contained in:
Josh Rickmar 2014-01-28 12:55:42 -05:00
parent df51a478f4
commit 0d903a5a29
3 changed files with 13 additions and 13 deletions

View file

@ -33,7 +33,7 @@ const (
defaultBtcNet = btcwire.TestNet3
defaultLogLevel = "info"
defaultKeypoolSize = 100
defaultAllowFree = true
defaultDisallowFree = false
)
var (
@ -61,7 +61,7 @@ type config struct {
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
MainNet bool `long:"mainnet" description:"Use the main Bitcoin network (default testnet3)"`
KeypoolSize uint `short:"k" long:"keypoolsize" description:"Maximum number of addresses in keypool"`
AllowFree bool `long:"allowfree" description:"Whether transactions with high enough priority may be made without any fee"`
DisallowFree bool `long:"disallowfree" description:"Force transactions to always include a fee"`
Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
@ -141,13 +141,13 @@ func normalizeAddress(addr, defaultPort string) string {
func loadConfig() (*config, []string, error) {
// Default config.
cfg := config{
DebugLevel: defaultLogLevel,
ConfigFile: defaultConfigFile,
DataDir: defaultDataDir,
RPCKey: defaultRPCKeyFile,
RPCCert: defaultRPCCertFile,
KeypoolSize: defaultKeypoolSize,
AllowFree: defaultAllowFree,
DebugLevel: defaultLogLevel,
ConfigFile: defaultConfigFile,
DataDir: defaultDataDir,
RPCKey: defaultRPCKeyFile,
RPCCert: defaultRPCCertFile,
KeypoolSize: defaultKeypoolSize,
DisallowFree: defaultDisallowFree,
}
// A config file in the current directory takes precedence.

View file

@ -305,7 +305,7 @@ func (a *Account) txToPairs(pairs map[string]int64, minconf int) (*CreatedTx, er
}
noFeeAllowed := false
if cfg.AllowFree {
if !cfg.DisallowFree {
noFeeAllowed = allowFree(bs.Height, inputs, msgtx.SerializeSize())
}
if minFee := minimumFee(msgtx, noFeeAllowed); fee < minFee {

View file

@ -15,9 +15,9 @@
; Maximum number of addresses to generate for the keypool
; keypoolsize=100
; Whether transactions may be created without any attached fee, if the calculated
; transaction priority is high enough
; allowfree = true
; Whether transactions must be created with some minimum fee, even if the
; calculated transaction priority is high enough to allow a free tx
; disallowfree = false
; ------------------------------------------------------------------------------