generator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Identifier = "73424348"
View Source
var ShaGateAddress = "14f8c7e99fd4e867c34cbd5968e35575fd5919a4"
View Source
var Version = "00"

Functions

func Init

func Init()

func ReorgBlock

func ReorgBlock()

Types

type BlockCountResp

type BlockCountResp struct {
	Result int64         `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type BlockHashResp

type BlockHashResp struct {
	Result string        `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type BlockInfo

type BlockInfo struct {
	Hash              string   `json:"hash"`
	Confirmations     int      `json:"confirmations"`
	Size              int      `json:"size"`
	Height            int64    `json:"height"`
	Version           int      `json:"version"`
	VersionHex        string   `json:"versionHex"`
	Merkleroot        string   `json:"merkleroot"`
	Tx                []string `json:"tx"`
	Time              int64    `json:"time"`
	MedianTime        int64    `json:"mediantime"`
	Nonce             int      `json:"nonce"`
	Bits              string   `json:"bits"`
	Difficulty        float64  `json:"difficulty"`
	Chainwork         string   `json:"chainwork"`
	NumTx             int      `json:"nTx"`
	PreviousBlockhash string   `json:"previousblockhash"`
}

func BuildBlockRespWithCoinbaseTx

func BuildBlockRespWithCoinbaseTx(pubkey string) *BlockInfo

func BuildBlockWithCrossChainTx

func BuildBlockWithCrossChainTx(pubkey string) *BlockInfo

type BlockInfoResp

type BlockInfoResp struct {
	Result BlockInfo     `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type CoinbaseVin

type CoinbaseVin struct {
	Coinbase string `json:"coinbase"`
	Sequence int    `json:"sequence"`
}

type Context

type Context struct {
	RWLock sync.RWMutex

	Log      *log.Logger
	BlockLog *log.Logger

	Producer *Producer

	TxByHash           map[string]*TxInfo
	BlkByHash          map[string]*BlockInfo
	BlkHashByHeight    map[int64]string
	PubkeyInfoByPubkey map[string]*PubKeyInfo
	NextBlockHeight    int64

	//internal
	PubKeyInfoSet   []PubKeyInfo
	PubkeyInfoIndex int
}
var Ctx Context

type JsonRpcError

type JsonRpcError struct {
	Code    int `json:"code"`
	Message int `json:"messsage"`
}

type Producer

type Producer struct {
	Exit              chan bool
	Reorg             chan bool
	Tx                chan string
	Lock              sync.Mutex
	BlockIntervalTime int64 //uint: second
}

func (*Producer) Start

func (p *Producer) Start()

type PubKeyInfo

type PubKeyInfo struct {
	Pubkey      string
	VotingPower int64
	RemainCount int64 //init same with Voting power
}

type TxInfo

type TxInfo struct {
	TxID          string                   `json:"txid"`
	Hash          string                   `json:"hash"`
	Version       int                      `json:"version"`
	Size          int                      `json:"size"`
	Locktime      int                      `json:"locktime"`
	VinList       []map[string]interface{} `json:"vin"`
	VoutList      []Vout                   `json:"vout"`
	Hex           string                   `json:"hex"`
	Blockhash     string                   `json:"blockhash"`
	Confirmations int                      `json:"confirmations"`
	Time          int64                    `json:"time"`
	BlockTime     int64                    `json:"blocktime"`
}

func BuildCCTxWithPubkey

func BuildCCTxWithPubkey(txIndex int64, blockHash, pubkey string) *TxInfo

func BuildTxWithPubkey

func BuildTxWithPubkey(txIndex int64, blockHash, pubkey string) *TxInfo

type Vout

type Vout struct {
	Value        int64                  `json:"value"`
	N            int                    `json:"n"`
	ScriptPubKey map[string]interface{} `json:"scriptPubKey"`
}

Jump to

Keyboard shortcuts

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