Add allowfree configuration option.
It may be desirable to never allow free transactions, even if the calculated priority is high enough that a fee would not be required, so this change adds a global configuration option to remove this check and always attach a fee.
This commit is contained in:
parent
57df957687
commit
845d54da55
3 changed files with 10 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue