pool

package
v0.0.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PushPool

type PushPool struct {
	// contains filtered or unexported fields
}

PushPool implements types.PushPool.

func NewPushPool

func NewPushPool(cap int, logic core.Logic) *PushPool

NewPushPool creates an instance of PushPool

func (*PushPool) Add

func (p *PushPool) Add(note types.PushNote) error

Add a note to the pool.

Check all the references to ensure there are no identical (same repo, reference and nonce) references in the pool. A valid reference is one which has no identical reference with a higher fee rate in the pool.

If an identical reference exist in the pool with a lower fee rate, the existing note holding the reference will be replaced by new note holding the reference with a superior fee rate.

In cases where more than one references of note is superior to multiple references in multiple push notes, replacement will only happen if the fee rate of note is higher than the combined fee rate of the replaceable push notes.

func (*PushPool) Full

func (p *PushPool) Full() bool

Full returns true if the pool is full

func (*PushPool) Get

func (p *PushPool) Get(noteID string) *types.Note

Get finds and returns a push note

func (*PushPool) HasSeen

func (p *PushPool) HasSeen(noteID string) bool

HasSeen checks whether a note with the given ID was recently added

func (*PushPool) Len

func (p *PushPool) Len() int

Len returns the number of push notes in the pool

func (*PushPool) Remove

func (p *PushPool) Remove(pushNote types.PushNote)

Remove removes a push note

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL