worker

package
v3.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package worker includes all the tasks and jobs to process router swaps.

It contains the following main steps (concurrently):

verify
	verify registered swaps.
swap
	build swaptx, mpc sign the tx, and send the tx to blockchain.
accept
	the `oracle` node do the accept job, agree or disagree the signing after verifying by oralce itself.
stable
	mark swap status to `stabe` status.
replace
	replace swap with the same tx nonce value when the sent swaptx is not packed into block because of lack fee or other reasons.
passbigvalue
	pass big value swap if the swap value is too large.

Most the above jobs is assigned to the `server` node, the `oracle` node mainly do the `accept` job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAcceptRecord added in v3.4.0

func AddAcceptRecord(args *tokens.BuildTxArgs, swapTx string) (err error)

AddAcceptRecord add accept record

func AddInitialSwapResult added in v3.1.0

func AddInitialSwapResult(swapInfo *tokens.SwapTxInfo, status mongodb.SwapStatus) (err error)

AddInitialSwapResult add initial result

func CheckAcceptRecord added in v3.4.0

func CheckAcceptRecord(args *tokens.BuildTxArgs) (err error)

CheckAcceptRecord check accept record

func DeleteCachedSwap

func DeleteCachedSwap(fromChainID, txid string, logIndex int)

DeleteCachedSwap delete cached swap

func DeleteCachedVerifyingSwap added in v3.4.0

func DeleteCachedVerifyingSwap(key string)

DeleteCachedVerifyingSwap delete cached verifying swap

func DoAggregateJob added in v3.6.1

func DoAggregateJob()

func FindAcceptRecords added in v3.4.0

func FindAcceptRecords(args *tokens.BuildTxArgs) map[string]int64

FindAcceptRecords find accept records

func ReplaceRouterSwap

func ReplaceRouterSwap(res *mongodb.MgoSwapResult, gasPrice *big.Int, isManual bool) error

ReplaceRouterSwap api

func StartAcceptSignJob

func StartAcceptSignJob()

StartAcceptSignJob accept job

func StartAggregateJob added in v3.6.1

func StartAggregateJob()

StartAggregateJob aggregate job

func StartCheckFailedSwapJob added in v3.4.0

func StartCheckFailedSwapJob()

StartCheckFailedSwapJob check failed swap job

func StartPassBigValueJob added in v3.2.0

func StartPassBigValueJob()

StartPassBigValueJob pass big value job

func StartReplaceJob

func StartReplaceJob()

StartReplaceJob replace job

func StartReportStatJob added in v3.4.0

func StartReportStatJob()

StartReportStatJob report stat job

func StartRouterSwapWork

func StartRouterSwapWork(isServer bool)

StartRouterSwapWork start router swap job

func StartStableJob

func StartStableJob()

StartStableJob stable job

func StartSwapJob

func StartSwapJob()

StartSwapJob swap job

func StartVerifyJob

func StartVerifyJob()

StartVerifyJob verify job

Types

type MatchTx

type MatchTx struct {
	MPC        string
	SwapTx     string
	SwapHeight uint64
	SwapTime   uint64
	SwapValue  string
	SwapNonce  uint64
}

MatchTx struct

Jump to

Keyboard shortcuts

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