diff --git a/config.go b/config.go index 2ddb994..cf7b1f7 100644 --- a/config.go +++ b/config.go @@ -33,6 +33,7 @@ const ( defaultBtcNet = btcwire.TestNet3 defaultLogLevel = "info" defaultKeypoolSize = 100 + defaultAllowFree = true ) var ( @@ -60,6 +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"` 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"` @@ -145,6 +147,7 @@ func loadConfig() (*config, []string, error) { RPCKey: defaultRPCKeyFile, RPCCert: defaultRPCCertFile, KeypoolSize: defaultKeypoolSize, + AllowFree: defaultAllowFree, } // A config file in the current directory takes precedence. diff --git a/createtx.go b/createtx.go index c013a9b..24f4a0f 100644 --- a/createtx.go +++ b/createtx.go @@ -304,7 +304,10 @@ func (a *Account) txToPairs(pairs map[string]int64, minconf int) (*CreatedTx, er msgtx.TxIn[i].SignatureScript = sigscript } - noFeeAllowed := allowFree(bs.Height, inputs, msgtx.SerializeSize()) + noFeeAllowed := false + if cfg.AllowFree { + noFeeAllowed = allowFree(bs.Height, inputs, msgtx.SerializeSize()) + } if minFee := minimumFee(msgtx, noFeeAllowed); fee < minFee { fee = minFee } else { diff --git a/sample-btcwallet.conf b/sample-btcwallet.conf index ea935b9..02d0ed2 100644 --- a/sample-btcwallet.conf +++ b/sample-btcwallet.conf @@ -15,6 +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 ; ------------------------------------------------------------------------------