tools

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: 10 Imported by: 1

Documentation

Overview

Package tools provides tools for scanning and registering swaps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustGatewayOrder added in v0.3.7

func AdjustGatewayOrder(isSrc bool)

AdjustGatewayOrder adjust gateway order by block height

func GetLatestScanHeight

func GetLatestScanHeight(isSrc bool) uint64

GetLatestScanHeight get latest scanned block height

func GetP2shBindAddress

func GetP2shBindAddress(p2shAddress string) (bindAddress string)

GetP2shBindAddress get p2sh bind address

func IsAddressRegistered

func IsAddressRegistered(address string) bool

IsAddressRegistered is address registered

func IsSwapAlreadyExistRegisterError added in v0.3.0

func IsSwapAlreadyExistRegisterError(err error) bool

IsSwapAlreadyExistRegisterError is err of swap already exist

func IsSwapExist added in v0.3.0

func IsSwapExist(txid, pairID, bind string, isSwapin bool) bool

IsSwapExist is swapin exist

func LoopGetLatestBlockNumber

func LoopGetLatestBlockNumber(b tokens.CrossChainBridge) uint64

LoopGetLatestBlockNumber loop and get latest block number

func RegisterP2shSwapin

func RegisterP2shSwapin(txid string, swapInfo *tokens.TxSwapInfo, verifyError error)

RegisterP2shSwapin register p2sh swapin

func RegisterSwapin

func RegisterSwapin(txid string, swapInfos []*tokens.TxSwapInfo, verifyErrors []error)

RegisterSwapin register swapin

func RegisterSwapout

func RegisterSwapout(txid string, swapInfos []*tokens.TxSwapInfo, verifyErrors []error)

RegisterSwapout register swapout

func UpdateLatestScanInfo

func UpdateLatestScanInfo(isSrc bool, height uint64) error

UpdateLatestScanInfo update latest scan info

Types

type CachedScannedBlocks

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

CachedScannedBlocks cached scanned blocks

func NewCachedScannedBlocks

func NewCachedScannedBlocks(capacity int) *CachedScannedBlocks

NewCachedScannedBlocks new cached scanned blocks

func (*CachedScannedBlocks) CacheScannedBlock

func (c *CachedScannedBlocks) CacheScannedBlock(hash string, height uint64)

CacheScannedBlock add cache block

func (*CachedScannedBlocks) IsBlockScanned

func (c *CachedScannedBlocks) IsBlockScanned(blockHash string) bool

IsBlockScanned return if cache block exist

type CachedScannedTxs

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

CachedScannedTxs cached scanned txs

func NewCachedScannedTxs

func NewCachedScannedTxs(capacity int) *CachedScannedTxs

NewCachedScannedTxs new cached scanned txs

func (*CachedScannedTxs) CacheScannedTx

func (c *CachedScannedTxs) CacheScannedTx(hash string)

CacheScannedTx add cache tx

func (*CachedScannedTxs) IsTxScanned

func (c *CachedScannedTxs) IsTxScanned(txHash string) bool

IsTxScanned return if cache tx exist

type WeightedString

type WeightedString struct {
	Content string
	Weight  uint64
}

WeightedString weighted string

type WeightedStringSlice

type WeightedStringSlice []*WeightedString

WeightedStringSlice weighted string slice

func (WeightedStringSlice) Add

func (s WeightedStringSlice) Add(content string, weight uint64) WeightedStringSlice

Add add item

func (WeightedStringSlice) GetStrings

func (s WeightedStringSlice) GetStrings() (result []string)

GetStrings get strings (commonly sort at first)

func (WeightedStringSlice) Len

func (s WeightedStringSlice) Len() int

Len impl Sortable

func (WeightedStringSlice) Less

func (s WeightedStringSlice) Less(i, j int) bool

Less impl Sortable

func (WeightedStringSlice) Reverse added in v0.3.7

func (s WeightedStringSlice) Reverse()

Reverse reverse items

func (WeightedStringSlice) Sort

Sort sort items

func (WeightedStringSlice) String

func (s WeightedStringSlice) String() (result string)

func (WeightedStringSlice) Swap

func (s WeightedStringSlice) Swap(i, j int)

Swap impl Sortable

Jump to

Keyboard shortcuts

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