blockstorage

package
v0.0.0-...-c9d2d86 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Copyright (C) 2017, Zipper Team. All rights reserved.

This file is part of zipper

The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The zipper 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 ISC License for more details.

You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain struct {
	// contains filtered or unexported fields
}

Blockchain represents block

func NewBlockchain

func NewBlockchain(db *db.BlockchainDB) *Blockchain

NewBlockchain initialization

func (*Blockchain) AppendBlock

func (blockchain *Blockchain) AppendBlock(block *pb.Block) []*db.WriteBatch

AppendBlock appends a block

func (*Blockchain) GetBlockByHash

func (blockchain *Blockchain) GetBlockByHash(blockHash []byte) (*pb.BlockHeader, error)

GetBlockByHash gets block by block hash

func (*Blockchain) GetBlockByNumber

func (blockchain *Blockchain) GetBlockByNumber(blockNum uint32) (*pb.BlockHeader, error)

GetBlockByNumber gets block by block height number

func (*Blockchain) GetBlockCF

func (blockchain *Blockchain) GetBlockCF() string

GetBlockCF return block columnFamily

func (*Blockchain) GetBlockHashByNumber

func (blockchain *Blockchain) GetBlockHashByNumber(blockNum uint32) ([]byte, error)

GetBlockHashByNumber get block hash by block number

func (*Blockchain) GetBlockchainHeight

func (blockchain *Blockchain) GetBlockchainHeight() (uint32, error)

GetBlockchainHeight gets blockchain height

func (*Blockchain) GetIndexCF

func (blockchain *Blockchain) GetIndexCF() string

GetIndexCF return index of block and transaction columnFamily

func (*Blockchain) GetTransactionByTxHash

func (blockchain *Blockchain) GetTransactionByTxHash(txHash []byte) (*pb.Transaction, error)

GetTransactionByTxHash gets transaction by transaction hash

func (*Blockchain) GetTransactionCF

func (blockchain *Blockchain) GetTransactionCF() string

GetTransactionCF return transaction columnFamily

func (*Blockchain) GetTransactionHashList

func (blockchain *Blockchain) GetTransactionHashList(blockHeight uint32) ([]byte, error)

GetTransactionHashList get transaction hash list by block height

func (*Blockchain) GetTransactionInBlock

func (blockchain *Blockchain) GetTransactionInBlock(data []byte, typ string) (map[string][]crypto.Hash, bool)

GetTransactionInBlock return transactions of block

func (*Blockchain) GetTransactionsByHash

func (blockchain *Blockchain) GetTransactionsByHash(blockHash []byte, transactionType uint32) (pb.Transactions, error)

GetTransactionsByHash by block hash

func (*Blockchain) GetTransactionsByNumber

func (blockchain *Blockchain) GetTransactionsByNumber(blockNum uint32, transactionType uint32) (pb.Transactions, error)

GetTransactionsByNumber by block height number

Jump to

Keyboard shortcuts

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