Browse Source

mempool: make it clear overwriting of pre/postCheck filters is intent… (#5054)

…ional

Closes #4773
pull/5062/head
Anton Kaliaev 5 years ago
committed by GitHub
parent
commit
659c4be60f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      mempool/clist_mempool.go

+ 4
- 2
mempool/clist_mempool.go View File

@ -112,13 +112,15 @@ func (mem *CListMempool) SetLogger(l log.Logger) {
} }
// WithPreCheck sets a filter for the mempool to reject a tx if f(tx) returns // WithPreCheck sets a filter for the mempool to reject a tx if f(tx) returns
// false. This is ran before CheckTx.
// false. This is ran before CheckTx. Only applies to the first created block.
// After that, Update overwrites the existing value.
func WithPreCheck(f PreCheckFunc) CListMempoolOption { func WithPreCheck(f PreCheckFunc) CListMempoolOption {
return func(mem *CListMempool) { mem.preCheck = f } return func(mem *CListMempool) { mem.preCheck = f }
} }
// WithPostCheck sets a filter for the mempool to reject a tx if f(tx) returns // WithPostCheck sets a filter for the mempool to reject a tx if f(tx) returns
// false. This is ran after CheckTx.
// false. This is ran after CheckTx. Only applies to the first created block.
// After that, Update overwrites the existing value.
func WithPostCheck(f PostCheckFunc) CListMempoolOption { func WithPostCheck(f PostCheckFunc) CListMempoolOption {
return func(mem *CListMempool) { mem.postCheck = f } return func(mem *CListMempool) { mem.postCheck = f }
} }


Loading…
Cancel
Save