worker

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: GPL-3.0 Imports: 26 Imported by: 1

Documentation

Overview

Package worker includes all the tasks and jobs to process bridge 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 v0.3.7

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

AddAcceptRecord add accept record

func AddSwapJob added in v0.3.0

func AddSwapJob(pairCfg *tokens.TokenPairConfig)

AddSwapJob add swap job

func AddTokenPairDynamically added in v0.3.0

func AddTokenPairDynamically()

AddTokenPairDynamically add token pair dynamically

func CheckAcceptRecord added in v0.3.7

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

CheckAcceptRecord check accept record

func DeleteCachedSwap added in v0.3.7

func DeleteCachedSwap(isSwapin bool, txid, bind string)

DeleteCachedSwap delete cached swap

func FindAcceptRecords added in v0.3.7

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

FindAcceptRecords find accept records

func ReplaceSwapin added in v0.3.5

func ReplaceSwapin(txid, pairID, bind, gasPrice string) (string, error)

ReplaceSwapin api

func ReplaceSwapout added in v0.3.5

func ReplaceSwapout(txid, pairID, bind, gasPrice string) (string, error)

ReplaceSwapout api

func StartAcceptSignJob

func StartAcceptSignJob()

StartAcceptSignJob accept job

func StartAggregateJob

func StartAggregateJob()

StartAggregateJob aggregate job

func StartPassBigValueJob added in v0.3.7

func StartPassBigValueJob()

StartPassBigValueJob pass big value job

func StartReplaceJob added in v0.3.5

func StartReplaceJob()

StartReplaceJob replace job

func StartScanJob

func StartScanJob(isServer bool)

StartScanJob scan job

func StartStableJob

func StartStableJob()

StartStableJob stable job

func StartSwapJob

func StartSwapJob()

StartSwapJob swap job

func StartUpdateLatestBlockHeightJob

func StartUpdateLatestBlockHeightJob()

StartUpdateLatestBlockHeightJob update latest block height job

func StartVerifyJob

func StartVerifyJob()

StartVerifyJob verify job

func StartWork

func StartWork(isServer bool)

StartWork start swap server work

Types

type MatchTx

type MatchTx struct {
	SwapTx     string
	SwapHeight uint64
	SwapTime   uint64
	SwapValue  string
	SwapType   tokens.SwapType
	SwapNonce  uint64
}

MatchTx struct

Jump to

Keyboard shortcuts

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