core

package
v0.0.0-...-69a37e0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: LGPL-2.1 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS          = 0
	PROCESSING       = 1
	FAILED           = 2
	NORECORDONLAYER2 = 3
)
View Source
const (
	CACHE_SIZE = 1000
)

Variables

This section is empty.

Functions

func CheckHashExistInlayer2

func CheckHashExistInlayer2(layer2Sdk *ontSdk.Layer2Sdk, contract common.Address, hash []byte) (bool, error)

func GetCommitedLayer2Height

func GetCommitedLayer2Height(ontSdk *ontSdk.OntologySdk, contract common.Address) (uint32, error)

func GetCommitedLayer2StateByHeight

func GetCommitedLayer2StateByHeight(ontSdk *ontSdk.OntologySdk, contract common.Address, height uint32) ([]byte, uint32, error)

Types

type ContractTxRecord

type ContractTxRecord struct {
	TxHash      string `json:"tx_hash"`
	TxType      int    `json:"tx_type"`
	TxTime      int    `json:"tx_time"`
	BlockHeight int    `json:"block_height"`
	BlockIndex  int    `json:"block_index"`
	Fee         string `json:"fee"`
	ConfirmFlag int    `json:"confirm_flag"`
}

type ContractTxResp

type ContractTxResp struct {
	Code   int               `json:"code"`
	Msg    string            `json:"msg"`
	Result *ContractTxResult `json:"result"`
}

type ContractTxResult

type ContractTxResult struct {
	Total   int                 `json:"total"`
	Records []*ContractTxRecord `json:"records"`
}

type RequestLog

type RequestLog struct {
	Timestamp       time.Time     `json:"time"`
	ResponseStatus  int64         `json:"status"`
	ProcessDuration time.Duration `json:"process_duration"`
	HTTPMethod      string        `json:"http_method"`
	Path            string        `json:"path"`
	RequestParam    string        `json:"request_param"`
	ResponseParam   string        `json:"response_param"`
}

type SendService

type SendService struct {
	Wg      *sync.WaitGroup
	QuitS   chan bool
	Cfg     *layer2config.Config
	Enabled uint32
}
var DefSendService *SendService

func NewSendService

func NewSendService(cfg *layer2config.Config) *SendService

func (*SendService) RepeantSendLogToChain

func (self *SendService) RepeantSendLogToChain()

type VerifyResult

type VerifyResult struct {
	Code             int32  `json:"code"`
	FailedMsg        string `json:"failedMsg"`
	Key              string `json:"key"`
	Value            string `json:"value"`
	Proof            string `json:"proof"`
	Layer2Height     uint32 `json:"layer2Height"`
	CommitHeight     uint32 `json:"commitHeight"`
	WitnessStateRoot string `json:"witnessStateRoot"`
	WitnessContract  string `json:"witnessContract"`
	Layer1Tx         string `json:"layer1Tx"`
}

type VerifyService

type VerifyService struct {
	Cfg          *layer2config.Config
	VResultCache *cache.Cache
	VerifyLock   *sync.Mutex
	HttpClient   *http.Client
}
var DefVerifyService *VerifyService

func NewVerifyService

func NewVerifyService(cfg *layer2config.Config) *VerifyService

func (*VerifyService) AsyncVerifyResult

func (self *VerifyService) AsyncVerifyResult(hash string)

func (*VerifyService) StoreHashCore

func (self *VerifyService) StoreHashCore(hash []byte) (string, error)

verify the store

func (*VerifyService) VerifyHashCore

func (self *VerifyService) VerifyHashCore(hash string) (*VerifyResult, error)

verify the store

Jump to

Keyboard shortcuts

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