mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
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
|
defaultBtcNet = btcwire.TestNet3
|
||||||
defaultLogLevel = "info"
|
defaultLogLevel = "info"
|
||||||
defaultKeypoolSize = 100
|
defaultKeypoolSize = 100
|
||||||
|
defaultAllowFree = true
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -60,6 +61,7 @@ type config struct {
|
||||||
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
||||||
MainNet bool `long:"mainnet" description:"Use the main Bitcoin network (default testnet3)"`
|
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"`
|
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)"`
|
Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
||||||
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
|
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
|
||||||
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password 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,
|
RPCKey: defaultRPCKeyFile,
|
||||||
RPCCert: defaultRPCCertFile,
|
RPCCert: defaultRPCCertFile,
|
||||||
KeypoolSize: defaultKeypoolSize,
|
KeypoolSize: defaultKeypoolSize,
|
||||||
|
AllowFree: defaultAllowFree,
|
||||||
}
|
}
|
||||||
|
|
||||||
// A config file in the current directory takes precedence.
|
// 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
|
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 {
|
if minFee := minimumFee(msgtx, noFeeAllowed); fee < minFee {
|
||||||
fee = minFee
|
fee = minFee
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
; Maximum number of addresses to generate for the keypool
|
; Maximum number of addresses to generate for the keypool
|
||||||
; keypoolsize=100
|
; 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