cryptozoic

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.

Index

Constants

View Source
const (
	//BLOCK_CHAIN_BUCKET = "blockchain" //区块链数据集合
	//periodOfTask      = 5 * time.Second //定时任务执行隔间
	MAX_EXTRACTING_SIZE = 15 //并发的扫描线程数

	BLOCK_HASH_KEY   = "BlockHash"
	BLOCK_HEIGHT_KEY = "BlockHeight"
)
View Source
const (
	Symbol = "VCC"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtractResult

type ExtractResult struct {

	//Recharges   []*openwallet.Recharge
	TxID        string
	BlockHeight uint64
	Success     bool
	// contains filtered or unexported fields
}

ExtractResult 扫描完成的提取结果

type SaveResult

type SaveResult struct {
	TxID        string
	BlockHeight uint64
	Success     bool
}

SaveResult 保存结果

type VCCBlockScanner

type VCCBlockScanner struct {
	*openwallet.BlockScannerBase
	CurrentBlockHeight uint64 //当前区块高度

	IsScanMemPool        bool   //是否扫描交易池
	RescanLastBlockCount uint64 //重扫上N个区块数量
	// contains filtered or unexported fields
}

func NewVCCBlockScanner

func NewVCCBlockScanner(wm *WalletManager) *VCCBlockScanner

NewVCCBlockScanner 创建区块链扫描器

func (*VCCBlockScanner) BatchExtractTransaction

func (this *VCCBlockScanner) BatchExtractTransaction(txs []ethereum.BlockTransaction) error

BatchExtractTransaction 批量提取交易单 bitcoin 1M的区块链可以容纳3000笔交易,批量多线程处理,速度更快

func (*VCCBlockScanner) DeleteUnscanRecord added in v1.1.0

func (bs *VCCBlockScanner) DeleteUnscanRecord(height uint64) error

DeleteUnscanRecord 删除指定高度的未扫记录

func (*VCCBlockScanner) DeleteUnscanRecordByID added in v1.1.0

func (bs *VCCBlockScanner) DeleteUnscanRecordByID(id string) error

DeleteUnscanRecordByID 删除指定的未扫记录

func (*VCCBlockScanner) ExtractTransactionData

func (this *VCCBlockScanner) ExtractTransactionData(txid string, scanTargetFunc openwallet.BlockScanTargetFunc) (map[string][]*openwallet.TxExtractData, error)

ExtractTransactionData 扫描一笔交易

func (*VCCBlockScanner) GetBalanceByAddress

func (this *VCCBlockScanner) GetBalanceByAddress(address ...string) ([]*openwallet.Balance, error)

func (*VCCBlockScanner) GetCurrentBlockHeader

func (this *VCCBlockScanner) GetCurrentBlockHeader() (*openwallet.BlockHeader, error)

GetCurrentBlockHeader 获取当前区块高度

func (*VCCBlockScanner) GetGlobalMaxBlockHeight

func (this *VCCBlockScanner) GetGlobalMaxBlockHeight() uint64

func (*VCCBlockScanner) GetLocalBlock added in v1.1.0

func (bs *VCCBlockScanner) GetLocalBlock(height uint64) (*ethereum.EthBlock, error)

GetLocalBlock 获取本地区块数据

func (*VCCBlockScanner) GetLocalBlockHead added in v1.1.0

func (bs *VCCBlockScanner) GetLocalBlockHead() (uint64, string, error)

GetLocalBlockHead 获取本地记录的区块高度和hash

func (*VCCBlockScanner) GetScannedBlockHeader

func (this *VCCBlockScanner) GetScannedBlockHeader() (*openwallet.BlockHeader, error)

GetScannedBlockHeader 获取当前已扫区块高度

func (*VCCBlockScanner) GetTxPoolPendingTxs

func (this *VCCBlockScanner) GetTxPoolPendingTxs() ([]ethereum.BlockTransaction, error)

func (*VCCBlockScanner) GetUnscanRecords added in v1.1.0

func (bs *VCCBlockScanner) GetUnscanRecords() ([]*openwallet.UnscanRecord, error)

func (*VCCBlockScanner) MakeFromExtractData

func (this *VCCBlockScanner) MakeFromExtractData(tx *ethereum.BlockTransaction, tokenEvent *ethereum.TransferEvent) (string, []*openwallet.TxExtractData, error)

func (*VCCBlockScanner) MakeSimpleToExtractData

func (this *VCCBlockScanner) MakeSimpleToExtractData(tx *ethereum.BlockTransaction) (string, []*openwallet.TxExtractData, error)

func (*VCCBlockScanner) MakeSimpleTxFromExtractData

func (this *VCCBlockScanner) MakeSimpleTxFromExtractData(tx *ethereum.BlockTransaction) (string, []*openwallet.TxExtractData, error)

func (*VCCBlockScanner) MakeToExtractData

func (this *VCCBlockScanner) MakeToExtractData(tx *ethereum.BlockTransaction, tokenEvent *ethereum.TransferEvent) (string, []*openwallet.TxExtractData, error)

func (*VCCBlockScanner) MakeTokenToExtractData

func (this *VCCBlockScanner) MakeTokenToExtractData(tx *ethereum.BlockTransaction, tokenEvent *ethereum.TransferEvent) (string, []*openwallet.TxExtractData, error)

func (*VCCBlockScanner) MakeTokenTxFromExtractData

func (this *VCCBlockScanner) MakeTokenTxFromExtractData(tx *ethereum.BlockTransaction, tokenEvent *ethereum.TransferEvent) (string, []*openwallet.TxExtractData, error)

func (*VCCBlockScanner) RescanFailedTransactions

func (this *VCCBlockScanner) RescanFailedTransactions() error

func (*VCCBlockScanner) SaveLocalBlock added in v1.1.0

func (bs *VCCBlockScanner) SaveLocalBlock(blockHeader *ethereum.EthBlock) error

SaveLocalBlock 记录本地新区块

func (*VCCBlockScanner) SaveLocalBlockHead added in v1.1.0

func (bs *VCCBlockScanner) SaveLocalBlockHead(blockHeight uint64, blockHash string) error

SaveLocalBlockHead 记录区块高度和hash到本地

func (*VCCBlockScanner) SaveUnscanRecord added in v1.1.0

func (bs *VCCBlockScanner) SaveUnscanRecord(record *openwallet.UnscanRecord) error

SaveUnscanRecord 保存交易记录到钱包数据库

func (*VCCBlockScanner) SaveUnscannedTransaction added in v1.1.0

func (this *VCCBlockScanner) SaveUnscannedTransaction(tx *ethereum.BlockTransaction, reason string) error

func (*VCCBlockScanner) ScanBlock

func (this *VCCBlockScanner) ScanBlock(height uint64) error

func (*VCCBlockScanner) ScanBlockTask

func (this *VCCBlockScanner) ScanBlockTask()

func (*VCCBlockScanner) ScanTxMemPool

func (this *VCCBlockScanner) ScanTxMemPool() error

func (*VCCBlockScanner) SetRescanBlockHeight

func (this *VCCBlockScanner) SetRescanBlockHeight(height uint64) error

SetRescanBlockHeight 重置区块链扫描高度

func (*VCCBlockScanner) SupportBlockchainDAI added in v1.1.0

func (bs *VCCBlockScanner) SupportBlockchainDAI() bool

SupportBlockchainDAI 支持外部设置区块链数据访问接口 @optional

func (*VCCBlockScanner) TransactionScanning

func (this *VCCBlockScanner) TransactionScanning(tx *ethereum.BlockTransaction) (*ExtractResult, error)

func (*VCCBlockScanner) UpdateTxByReceipt

func (this *VCCBlockScanner) UpdateTxByReceipt(tx *ethereum.BlockTransaction) (map[string][]*ethereum.TransferEvent, error)

type WalletManager

type WalletManager struct {
	*ethereum.WalletManager
}

func NewWalletManager

func NewWalletManager() *WalletManager

func (*WalletManager) FullName

func (wm *WalletManager) FullName() string

FullName 币种全名

func (*WalletManager) GetErc20TokenEvent

func (this *WalletManager) GetErc20TokenEvent(transactionID string) (map[string][]*ethereum.TransferEvent, error)

Jump to

Keyboard shortcuts

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