Documentation ¶
Overview ¶
Package tools provides tools for scanning and registering swaps.
Index ¶
- func AdjustGatewayOrder(isSrc bool)
- func GetLatestScanHeight(isSrc bool) uint64
- func GetP2shBindAddress(p2shAddress string) (bindAddress string)
- func IsAddressRegistered(address string) bool
- func IsSwapAlreadyExistRegisterError(err error) bool
- func IsSwapExist(txid, pairID, bind string, isSwapin bool) bool
- func LoopGetLatestBlockNumber(b tokens.CrossChainBridge) uint64
- func RegisterP2shSwapin(txid string, swapInfo *tokens.TxSwapInfo, verifyError error)
- func RegisterSwapin(txid string, swapInfos []*tokens.TxSwapInfo, verifyErrors []error)
- func RegisterSwapout(txid string, swapInfos []*tokens.TxSwapInfo, verifyErrors []error)
- func UpdateLatestScanInfo(isSrc bool, height uint64) error
- type CachedScannedBlocks
- type CachedScannedTxs
- type WeightedString
- type WeightedStringSlice
- func (s WeightedStringSlice) Add(content string, weight uint64) WeightedStringSlice
- func (s WeightedStringSlice) GetStrings() (result []string)
- func (s WeightedStringSlice) Len() int
- func (s WeightedStringSlice) Less(i, j int) bool
- func (s WeightedStringSlice) Reverse()
- func (s WeightedStringSlice) Sort() WeightedStringSlice
- func (s WeightedStringSlice) String() (result string)
- func (s WeightedStringSlice) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjustGatewayOrder ¶
func AdjustGatewayOrder(isSrc bool)
AdjustGatewayOrder adjust gateway order by block height
func GetLatestScanHeight ¶
GetLatestScanHeight get latest scanned block height
func GetP2shBindAddress ¶
GetP2shBindAddress get p2sh bind address
func IsAddressRegistered ¶
IsAddressRegistered is address registered
func IsSwapAlreadyExistRegisterError ¶
IsSwapAlreadyExistRegisterError is err of swap already exist
func IsSwapExist ¶
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 ¶
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 ¶
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) Less ¶
func (s WeightedStringSlice) Less(i, j int) bool
Less impl Sortable
func (WeightedStringSlice) Sort ¶
func (s WeightedStringSlice) Sort() WeightedStringSlice
Sort sort items
func (WeightedStringSlice) String ¶
func (s WeightedStringSlice) String() (result string)