mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-09-03 20:35:10 +00:00
mempool: add non-standard tx relaying to policy config
This commit is contained in:
parent
15bace88dc
commit
dc5486a579
2 changed files with 9 additions and 2 deletions
|
@ -78,6 +78,12 @@ type Policy struct {
|
||||||
// transactions that do not have enough priority to be relayed.
|
// transactions that do not have enough priority to be relayed.
|
||||||
DisableRelayPriority bool
|
DisableRelayPriority bool
|
||||||
|
|
||||||
|
// RelayNonStd defines whether to relay non-standard transactions. If
|
||||||
|
// true, non-standard transactions will be accepted into the mempool
|
||||||
|
// and relayed. Otherwise, all non-standard transactions will be
|
||||||
|
// rejected.
|
||||||
|
RelayNonStd bool
|
||||||
|
|
||||||
// FreeTxRelayLimit defines the given amount in thousands of bytes
|
// FreeTxRelayLimit defines the given amount in thousands of bytes
|
||||||
// per minute that transactions with no fee are rate limited to.
|
// per minute that transactions with no fee are rate limited to.
|
||||||
FreeTxRelayLimit float64
|
FreeTxRelayLimit float64
|
||||||
|
@ -537,7 +543,7 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit bool)
|
||||||
|
|
||||||
// Don't allow non-standard transactions if the network parameters
|
// Don't allow non-standard transactions if the network parameters
|
||||||
// forbid their relaying.
|
// forbid their relaying.
|
||||||
if !mp.cfg.ChainParams.RelayNonStdTxs {
|
if !mp.cfg.Policy.RelayNonStd {
|
||||||
err := checkTransactionStandard(tx, nextBlockHeight,
|
err := checkTransactionStandard(tx, nextBlockHeight,
|
||||||
mp.cfg.TimeSource, mp.cfg.Policy.MinRelayTxFee)
|
mp.cfg.TimeSource, mp.cfg.Policy.MinRelayTxFee)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -622,7 +628,7 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit bool)
|
||||||
|
|
||||||
// Don't allow transactions with non-standard inputs if the network
|
// Don't allow transactions with non-standard inputs if the network
|
||||||
// parameters forbid their relaying.
|
// parameters forbid their relaying.
|
||||||
if !mp.cfg.ChainParams.RelayNonStdTxs {
|
if !mp.cfg.Policy.RelayNonStd {
|
||||||
err := checkInputsStandard(tx, utxoView)
|
err := checkInputsStandard(tx, utxoView)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Attempt to extract a reject code from the error so
|
// Attempt to extract a reject code from the error so
|
||||||
|
|
|
@ -2519,6 +2519,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
|
||||||
txC := mempool.Config{
|
txC := mempool.Config{
|
||||||
Policy: mempool.Policy{
|
Policy: mempool.Policy{
|
||||||
DisableRelayPriority: cfg.NoRelayPriority,
|
DisableRelayPriority: cfg.NoRelayPriority,
|
||||||
|
RelayNonStd: chainParams.RelayNonStdTxs,
|
||||||
FreeTxRelayLimit: cfg.FreeTxRelayLimit,
|
FreeTxRelayLimit: cfg.FreeTxRelayLimit,
|
||||||
MaxOrphanTxs: cfg.MaxOrphanTxs,
|
MaxOrphanTxs: cfg.MaxOrphanTxs,
|
||||||
MaxOrphanTxSize: defaultMaxOrphanTxSize,
|
MaxOrphanTxSize: defaultMaxOrphanTxSize,
|
||||||
|
|
Loading…
Add table
Reference in a new issue