promoter

package
v1.0.1-lp-billion-1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// emitted when a promotion occurred
	EventPromotion event.Event = 200
	// emitted when a reattachment occurred
	EventReattachment event.Event = 201
)

own emitted events

Variables

View Source
var ErrUnableToPromote = errors.New("unable to promote")
View Source
var ErrUnableToReattach = errors.New("unable to reattach")
View Source
var ErrUnpromotableTail = errors.New("tail is unpromoteable")

Functions

This section is empty.

Types

type Promoter

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

Promoter is an account plugin which takes care of trying to get pending transfers to get confirmed by issuing promotion transactions and creating reattachments. The Promoter will only run one promotion/reattachment task at any given time.

func NewPromoter

func NewPromoter(setts *account.Settings, interval time.Duration) *Promoter

NewPromoter creates a new Promoter. If the interval is set to 0, the Promoter will only promote/reattach through PromoteReattach().

func (*Promoter) Name

func (p *Promoter) Name() string

func (*Promoter) PromoteReattach

func (p *Promoter) PromoteReattach() error

PromoteReattach awaits the current promotion/reattachment task to finish (in case it's ongoing), pauses the task, executes a manual task, resumes the repeated task and then returns. PromoteReattach will block infinitely if called after the account has been shutdown.

func (*Promoter) Shutdown

func (p *Promoter) Shutdown() error

func (*Promoter) Start

func (p *Promoter) Start(acc account.Account) error

type PromotionReattachmentEvent

type PromotionReattachmentEvent struct {
	// The tail tx hash of the first bundle broadcasted to the network.
	OriginTailTxHash Hash `json:"original_tail_tx_hash"`
	// The bundle hash of the promoted/reattached bundle.
	BundleHash Hash `json:"bundle_hash"`
	// The tail tx hash of the promotion transaction.
	PromotionTailTxHash Hash `json:"promotion_tail_tx_hash"`
	// The tail tx hash of the reattached bundle.
	ReattachmentTailTxHash Hash `json:"reattachment_tail_tx_hash"`
}

PromotionReattachmentEvent is emitted when a promotion or reattachment happened.

Jump to

Keyboard shortcuts

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