Documentation ¶
Overview ¶
Package estimate produces estimates of the models defined in package sim (TxSource / BlockSource).
Index ¶
- Variables
- func IndBlockSource(height int64, c IndBlockSourceConfig, db BlockStatDB) (*sim.IndBlockSource, error)
- func IndBlockSourceSMFR(height int64, c IndBlockSourceConfig, db BlockStatDB) (*sim.IndBlockSource, error)
- func MultiTxSource(t int64, c *MultiTxSourceConfig, db TxDB) (*sim.MultiTxSource, error)
- type BlockCoverageError
- type BlockSFRData
- type BlockSizeData
- type BlockSourceEstimator
- type BlockStat
- type BlockStatDB
- type IndBlockSourceConfig
- type MultiTxSourceConfig
- type SFRStat
- type SFRTx
- type SFRTxSlice
- type Tx
- type TxDB
- type TxSourceEstimator
- type TxWindowError
- type UniTxSource
- type UniTxSourceConfig
Constants ¶
This section is empty.
Variables ¶
var ErrInsufficientBlocks = errors.New("too few blocks to estimate blocksource")
This error should rarely happen, if block coverage is met.
Functions ¶
func IndBlockSource ¶
func IndBlockSource(height int64, c IndBlockSourceConfig, db BlockStatDB) (*sim.IndBlockSource, error)
IndBlockSource returns an estimate of sim.IndBlockSource based on BlockStats from heights [height-window+1, height].
func IndBlockSourceSMFR ¶
func IndBlockSourceSMFR(height int64, c IndBlockSourceConfig, db BlockStatDB) (*sim.IndBlockSource, error)
IndBlockSourceSMFR is IndBlockSource with a static minfeerate. The reason for this is that the miner policy estimation wasn't designed to work with constantly full blocks. Constantly full blocks causes minfeerate policy estimates to be inflated, which in turn inflates fee estimates. To avoid this, we just assume that miner minfeerates are equal to the lowest observed sfr.
func MultiTxSource ¶
func MultiTxSource(t int64, c *MultiTxSourceConfig, db TxDB) (*sim.MultiTxSource, error)
Types ¶
type BlockCoverageError ¶
type BlockCoverageError struct {
// contains filtered or unexported fields
}
func (BlockCoverageError) Error ¶
func (err BlockCoverageError) Error() string
type BlockSFRData ¶
type BlockSFRData []struct {
// contains filtered or unexported fields
}
func (BlockSFRData) Len ¶
func (b BlockSFRData) Len() int
func (BlockSFRData) Less ¶
func (b BlockSFRData) Less(i, j int) bool
func (BlockSFRData) Swap ¶
func (b BlockSFRData) Swap(i, j int)
type BlockSizeData ¶
type BlockSizeData []struct {
// contains filtered or unexported fields
}
func (BlockSizeData) Len ¶
func (b BlockSizeData) Len() int
func (BlockSizeData) Less ¶
func (b BlockSizeData) Less(i, j int) bool
func (BlockSizeData) Swap ¶
func (b BlockSizeData) Swap(i, j int)
type BlockSourceEstimator ¶
type BlockSourceEstimator func(h int64) (sim.BlockSource, error)
Successive calls have non-decreasing h.
type BlockStat ¶
type BlockStat struct { // Block height Height int64 `json:"height"` // Block size Size int64 `json:"size"` // Stranding fee rate stats SFRStat SFRStat `json:"sfrstat"` // Mempool size just prior to block discovery MempoolSize int64 `json:"mempoolsize"` // Mempool size just after block discovery MempoolSizeRemain int64 `json:"mempoolsizeremain"` // Block time (as measured locally; not the block timestamp) // Unit is Unix time in seconds. Time int64 `json:"time"` // Expected number of hashes used to solve this block (function of nBits) NumHashes float64 `json:"numhashes"` }
type BlockStatDB ¶
type IndBlockSourceConfig ¶
type MultiTxSourceConfig ¶
type SFRStat ¶
type SFRTxSlice ¶
type SFRTxSlice []SFRTx
func (SFRTxSlice) ABKN ¶
func (t SFRTxSlice) ABKN(sfr sim.FeeRate) (ak, an, bk, bn int64)
Calculate the Above/Below K/N values
func (SFRTxSlice) Len ¶
func (t SFRTxSlice) Len() int
func (SFRTxSlice) Less ¶
func (t SFRTxSlice) Less(i, j int) bool
func (SFRTxSlice) Sort ¶
func (t SFRTxSlice) Sort()
func (SFRTxSlice) StrandingFeeRate ¶
func (t SFRTxSlice) StrandingFeeRate(minrelaytxfee sim.FeeRate) (stat SFRStat)
func (SFRTxSlice) Swap ¶
func (t SFRTxSlice) Swap(i, j int)
type TxSourceEstimator ¶
Successive calls have non-decreasing t.
type TxWindowError ¶
type TxWindowError struct {
Window, MinWindow int64
}
func (TxWindowError) Error ¶
func (err TxWindowError) Error() string
type UniTxSource ¶
type UniTxSource struct {
// contains filtered or unexported fields
}
func NewUniTxSource ¶
func NewUniTxSource(db TxDB, cfg UniTxSourceConfig, rng *rand.Rand) *UniTxSource
func (*UniTxSource) Estimate ¶
func (s *UniTxSource) Estimate(currTime int64) (*sim.UniTxSource, error)