utils

package
v0.0.0-...-c0f8dde Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: GPL-3.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	BTC_ID              uint64 = 1
	HDR_LIMIT_PER_BATCH        = 1000
)

Variables

View Source
var (
	SleepTime time.Duration = 10
)

Functions

func GetCurrHeightFromPoly

func GetCurrHeightFromPoly(poly *poly_go_sdk.PolySdk) (uint32, string, error)

func GetHeaderHashFromPoly

func GetHeaderHashFromPoly(poly *poly_go_sdk.PolySdk, height uint32) (string, error)

func NeedRetry

func NeedRetry(msg string) bool

func SetUpPoly

func SetUpPoly(poly *poly_go_sdk.PolySdk, rpcAddr string) error

func Wait

func Wait(dura time.Duration)

Types

type CrossChainItem

type CrossChainItem struct {
	Tx     []byte
	Proof  []byte
	Height uint32
	Txid   chainhash.Hash
}

func (*CrossChainItem) Deserialize

func (cci *CrossChainItem) Deserialize(buf []byte) error

func (*CrossChainItem) Serialize

func (cci *CrossChainItem) Serialize() ([]byte, error)

type CrossChainItemArr

type CrossChainItemArr []*CrossChainItem

func (*CrossChainItemArr) Deserialize

func (arr *CrossChainItemArr) Deserialize(buf []byte) error

func (CrossChainItemArr) Serialize

func (arr CrossChainItemArr) Serialize() ([]byte, error)

type FromPolyItem

type FromPolyItem struct {
	Tx string
}
type Header struct {
	Raw    []byte
	Height uint32
	Hash   string
}

type Headers

type Headers []*Header

func (Headers) GetSortedRawHeaders

func (h Headers) GetSortedRawHeaders() [][]byte

func (Headers) Len

func (h Headers) Len() int

func (Headers) Less

func (h Headers) Less(i, j int) bool

func (Headers) Swap

func (h Headers) Swap(i, j int)

type NeedToRetryErr

type NeedToRetryErr struct {
	Err error
}

func (NeedToRetryErr) Error

func (err NeedToRetryErr) Error() string

func (*NeedToRetryErr) String

func (err *NeedToRetryErr) String() string

type NetErr

type NetErr struct {
	Err error
}

func (NetErr) Error

func (err NetErr) Error() string

type Request

type Request struct {
	Jsonrpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	Id      int           `json:"id"`
}

type Response

type Response struct {
	Result interface{}       `json:"result"`
	Error  *btcjson.RPCError `json:"error"`
	Id     int               `json:"id"`
}

type RestCli

type RestCli struct {
	Addr string
	Cli  *http.Client
}

Get tx in block; Get proof;

func NewRestCli

func NewRestCli(addr, user, pwd string) *RestCli

func (*RestCli) BroadcastTx

func (cli *RestCli) BroadcastTx(tx string) (string, error)

func (*RestCli) GetCurrentHeightAndHash

func (cli *RestCli) GetCurrentHeightAndHash() (uint32, string, error)

func (*RestCli) GetHeader

func (cli *RestCli) GetHeader(hash string) (*wire.BlockHeader, error)

func (*RestCli) GetProof

func (cli *RestCli) GetProof(txids []string) (string, error)

func (*RestCli) GetScriptPubKey

func (cli *RestCli) GetScriptPubKey(txid string, index uint32) (string, error)

func (*RestCli) GetTxsAndHeader

func (cli *RestCli) GetTxsAndHeader(height, after uint32) ([]*wire.MsgTx, *wire.BlockHeader, string, error)

func (*RestCli) GetTxsInBlock

func (cli *RestCli) GetTxsInBlock(hash string) (*wire.MsgBlock, error)

func (*RestCli) IsHeaderReady

func (cli *RestCli) IsHeaderReady(height uint32) error

Jump to

Keyboard shortcuts

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