Documentation ¶
Overview ¶
Defines primitives used to build and interact with both the genesis and common budget blocks / accounts, which are special blocks in the BOScoin blockchain
Index ¶
- Variables
- func DeleteTransactionPool(st *storage.LevelDBBackend, hash string) error
- func ExistsBlock(st *storage.LevelDBBackend, hash string) (exists bool, err error)
- func ExistsBlockAccount(st *storage.LevelDBBackend, address string) (exists bool, err error)
- func ExistsBlockByHeight(st *storage.LevelDBBackend, height uint64) (exists bool, err error)
- func ExistsBlockOperation(st *storage.LevelDBBackend, hash string) (bool, error)
- func ExistsBlockTransaction(st *storage.LevelDBBackend, hash string) (bool, error)
- func ExistsTransactionPool(st *storage.LevelDBBackend, hash string) (bool, error)
- func GetBlockAccountAddressesByCreated(st *storage.LevelDBBackend, options storage.ListOptions) (func() (string, bool, []byte), func())
- func GetBlockAccountCreatedKey(created string) string
- func GetBlockAccountKey(address string) string
- func GetBlockAccountSequenceIDByAddress(st *storage.LevelDBBackend, address string, options storage.ListOptions) (func() (BlockAccountSequenceID, bool, []byte), func())
- func GetBlockAccountSequenceIDByAddressKey(address string) string
- func GetBlockAccountSequenceIDByAddressKeyPrefix(address string) string
- func GetBlockAccountSequenceIDKey(address string, sequenceID uint64) string
- func GetBlockAccountsByCreated(st *storage.LevelDBBackend, options storage.ListOptions) (func() (*BlockAccount, bool, []byte), func())
- func GetBlockHeadersByConfirmed(st *storage.LevelDBBackend, options storage.ListOptions) (func() (Header, bool, []byte), func())
- func GetBlockKeyPrefixHeight(height uint64) string
- func GetBlockOperationCreateFrozenKey(hash string, height uint64) string
- func GetBlockOperationsByBlockHeight(st *storage.LevelDBBackend, height uint64, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByFrozen(st *storage.LevelDBBackend, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByLinked(st *storage.LevelDBBackend, hash string, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByPeers(st *storage.LevelDBBackend, addr string, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByPeersAndType(st *storage.LevelDBBackend, addr string, ty operation.OperationType, ...) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsBySource(st *storage.LevelDBBackend, source string, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsBySourceAndType(st *storage.LevelDBBackend, source string, ty operation.OperationType, ...) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByTarget(st *storage.LevelDBBackend, target string, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByTargetAndType(st *storage.LevelDBBackend, target string, ty operation.OperationType, ...) (func() (BlockOperation, bool, []byte), func())
- func GetBlockOperationsByTx(st *storage.LevelDBBackend, txHash string, options storage.ListOptions) (func() (BlockOperation, bool, []byte), func())
- func GetBlockTransactionKey(hash string) string
- func GetBlockTransactionKeyPrefixAccount(accountAddress string) string
- func GetBlockTransactionKeyPrefixBlock(hash string) string
- func GetBlockTransactionKeyPrefixConfirmed(confirmed string) string
- func GetBlockTransactionKeyPrefixSource(source string) string
- func GetBlockTransactionsByAccount(st *storage.LevelDBBackend, accountAddress string, options storage.ListOptions) (func() (BlockTransaction, bool, []byte), func())
- func GetBlockTransactionsByBlock(st *storage.LevelDBBackend, hash string, options storage.ListOptions) (func() (BlockTransaction, bool, []byte), func())
- func GetBlockTransactionsByConfirmed(st *storage.LevelDBBackend, options storage.ListOptions) (func() (BlockTransaction, bool, []byte), func())
- func GetBlockTransactionsBySource(st *storage.LevelDBBackend, source string, options storage.ListOptions) (func() (BlockTransaction, bool, []byte), func())
- func GetBlocksByConfirmed(st *storage.LevelDBBackend, options storage.ListOptions) (func() (Block, bool, []byte), func())
- func GetTransactionPoolKey(hash string) string
- func InitTestBlockchain() *storage.LevelDBBackend
- func LoadBlockAccountsInsideIterator(st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), ...) (func() (*BlockAccount, bool, []byte), func())
- func LoadBlockHeadersInsideIterator(st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), ...) (func() (Header, bool, []byte), func())
- func LoadBlockOperationsInsideIterator(st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), ...) (func() (BlockOperation, bool, []byte), func())
- func LoadBlockTransactionsInsideIterator(st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), ...) (func() (BlockTransaction, bool, []byte), func())
- func LoadBlocksInsideIterator(st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), ...) (func() (Block, bool, []byte), func())
- func MakeTestBlockchain(st *storage.LevelDBBackend)
- func NewBlockOperationKey(opHash, txHash string) string
- func WalkBlocks(st *storage.LevelDBBackend, option *storage.WalkOption, ...) error
- type Block
- func GetBlock(st *storage.LevelDBBackend, hash string) (bt Block, err error)
- func GetBlockByHeight(st *storage.LevelDBBackend, height uint64) (bt Block, err error)
- func GetGenesis(st *storage.LevelDBBackend) Block
- func GetLatestBlock(st *storage.LevelDBBackend) Block
- func MakeGenesisBlock(st *storage.LevelDBBackend, genesisAccount BlockAccount, ...) (blk *Block, err error)
- func NewBlock(proposer string, basis voting.Basis, ptx string, transactions []string, ...) *Block
- func TestMakeNewBlock(transactions []string) Block
- func TestMakeNewBlockWithPrevBlock(prevBlock Block, txs []string) Block
- func (bck Block) IsEmpty() bool
- func (b *Block) MustSave(st *storage.LevelDBBackend)
- func (b Block) NewBlockKeyConfirmed() string
- func (b Block) NextBlock(st *storage.LevelDBBackend) (Block, error)
- func (b Block) PreviousBlock(st *storage.LevelDBBackend) (blk Block, err error)
- func (b *Block) Save(st *storage.LevelDBBackend) (err error)
- func (bck Block) String() string
- type BlockAccount
- func GetBlockAccount(st *storage.LevelDBBackend, address string) (b *BlockAccount, err error)
- func NewBlockAccount(address string, balance common.Amount) *BlockAccount
- func NewBlockAccountLinked(address string, balance common.Amount, linked string) *BlockAccount
- func TestMakeBlockAccount(kps ...*keypair.Full) *BlockAccount
- func (b *BlockAccount) Deposit(fund common.Amount) error
- func (b *BlockAccount) GetBalance() common.Amount
- func (b *BlockAccount) IncreaseSequenceID()
- func (b *BlockAccount) IsFrozen() bool
- func (b *BlockAccount) MustSave(st *storage.LevelDBBackend)
- func (b *BlockAccount) Save(st *storage.LevelDBBackend) (err error)
- func (b *BlockAccount) String() string
- func (b *BlockAccount) Withdraw(fund common.Amount) error
- type BlockAccountSequenceID
- type BlockOperation
- func GetBlockOperation(st *storage.LevelDBBackend, hash string) (bo BlockOperation, err error)
- func GetBlockOperationByIndex(st *storage.LevelDBBackend, txHash string, opIndex int) (BlockOperation, error)
- func NewBlockOperationFromOperation(op operation.Operation, tx transaction.Transaction, blockHeight uint64) (BlockOperation, error)
- func TestMakeNewBlockOperation(networkID []byte, n int) (bos []BlockOperation)
- func (b *BlockOperation) MustSave(st *storage.LevelDBBackend)
- func (bo BlockOperation) NewBlockOperationBlockHeightKey() string
- func (bo BlockOperation) NewBlockOperationFrozenLinkedKey(hash string) string
- func (bo BlockOperation) NewBlockOperationPeersAndTypeKey(addr string) string
- func (bo BlockOperation) NewBlockOperationPeersKey(addr string) string
- func (bo BlockOperation) NewBlockOperationSourceAndTypeKey() string
- func (bo BlockOperation) NewBlockOperationSourceKey() string
- func (bo BlockOperation) NewBlockOperationTargetAndTypeKey(target string) string
- func (bo BlockOperation) NewBlockOperationTargetKey(target string) string
- func (bo BlockOperation) NewBlockOperationTxHashKey() string
- func (bo *BlockOperation) Save(st *storage.LevelDBBackend) (err error)
- type BlockTransaction
- func (bt *BlockTransaction) GetOperationIndex(opHash string) (opIndex int, err error)
- func (b *BlockTransaction) MustSave(st *storage.LevelDBBackend)
- func (bt BlockTransaction) NewBlockTransactionKeyByAccount(accountAddress string) string
- func (bt BlockTransaction) NewBlockTransactionKeyByBlock(hash string) string
- func (bt BlockTransaction) NewBlockTransactionKeyConfirmed() string
- func (bt BlockTransaction) NewBlockTransactionKeySource() string
- func (bt *BlockTransaction) Save(st *storage.LevelDBBackend) (err error)
- func (bt *BlockTransaction) SaveBlockOperation(st *storage.LevelDBBackend, op operation.Operation) (err error)
- func (bt *BlockTransaction) SaveBlockOperations(st *storage.LevelDBBackend) (err error)
- func (bt BlockTransaction) String() string
- func (bt BlockTransaction) Transaction() transaction.Transaction
- type Header
- type TransactionPool
Constants ¶
This section is empty.
Variables ¶
var ( GenesisKP *keypair.Full CommonKP *keypair.Full )
var GetBlockTransactions = GetBlockTransactionsByConfirmed
Functions ¶
func DeleteTransactionPool ¶
func DeleteTransactionPool(st *storage.LevelDBBackend, hash string) error
func ExistsBlock ¶
func ExistsBlock(st *storage.LevelDBBackend, hash string) (exists bool, err error)
func ExistsBlockAccount ¶
func ExistsBlockAccount(st *storage.LevelDBBackend, address string) (exists bool, err error)
func ExistsBlockByHeight ¶
func ExistsBlockByHeight(st *storage.LevelDBBackend, height uint64) (exists bool, err error)
func ExistsBlockOperation ¶
func ExistsBlockOperation(st *storage.LevelDBBackend, hash string) (bool, error)
func ExistsBlockTransaction ¶
func ExistsBlockTransaction(st *storage.LevelDBBackend, hash string) (bool, error)
func ExistsTransactionPool ¶
func ExistsTransactionPool(st *storage.LevelDBBackend, hash string) (bool, error)
func GetBlockAccountAddressesByCreated ¶
func GetBlockAccountAddressesByCreated(st *storage.LevelDBBackend, options storage.ListOptions) (func() (string, bool, []byte), func())
func GetBlockAccountKey ¶
func GetBlockAccountSequenceIDByAddress ¶
func GetBlockAccountSequenceIDByAddress(st *storage.LevelDBBackend, address string, options storage.ListOptions) (func() (BlockAccountSequenceID, bool, []byte), func())
func GetBlockAccountsByCreated ¶
func GetBlockAccountsByCreated(st *storage.LevelDBBackend, options storage.ListOptions) (func() (*BlockAccount, bool, []byte), func())
func GetBlockHeadersByConfirmed ¶
func GetBlockHeadersByConfirmed(st *storage.LevelDBBackend, options storage.ListOptions) ( func() (Header, bool, []byte), func(), )
func GetBlockKeyPrefixHeight ¶
GetBlockKeyPrefixHeight returns index key by height. It is used to make cursor as height.
func GetBlockOperationsByBlockHeight ¶
func GetBlockOperationsByBlockHeight(st *storage.LevelDBBackend, height uint64, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsByFrozen ¶
func GetBlockOperationsByFrozen(st *storage.LevelDBBackend, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
Find all operations which created frozen account.
func GetBlockOperationsByLinked ¶
func GetBlockOperationsByLinked(st *storage.LevelDBBackend, hash string, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
Find all operations which created frozen account and have the link of a general account's address.
func GetBlockOperationsByPeers ¶
func GetBlockOperationsByPeers(st *storage.LevelDBBackend, addr string, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsByPeersAndType ¶
func GetBlockOperationsByPeersAndType(st *storage.LevelDBBackend, addr string, ty operation.OperationType, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsBySource ¶
func GetBlockOperationsBySource(st *storage.LevelDBBackend, source string, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsBySourceAndType ¶
func GetBlockOperationsBySourceAndType(st *storage.LevelDBBackend, source string, ty operation.OperationType, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsByTarget ¶
func GetBlockOperationsByTarget(st *storage.LevelDBBackend, target string, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsByTargetAndType ¶
func GetBlockOperationsByTargetAndType(st *storage.LevelDBBackend, target string, ty operation.OperationType, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockOperationsByTx ¶
func GetBlockOperationsByTx(st *storage.LevelDBBackend, txHash string, options storage.ListOptions) ( func() (BlockOperation, bool, []byte), func(), )
func GetBlockTransactionKey ¶
func GetBlockTransactionsByAccount ¶
func GetBlockTransactionsByAccount(st *storage.LevelDBBackend, accountAddress string, options storage.ListOptions) ( func() (BlockTransaction, bool, []byte), func(), )
func GetBlockTransactionsByBlock ¶
func GetBlockTransactionsByBlock(st *storage.LevelDBBackend, hash string, options storage.ListOptions) ( func() (BlockTransaction, bool, []byte), func(), )
func GetBlockTransactionsByConfirmed ¶
func GetBlockTransactionsByConfirmed(st *storage.LevelDBBackend, options storage.ListOptions) ( func() (BlockTransaction, bool, []byte), func(), )
func GetBlockTransactionsBySource ¶
func GetBlockTransactionsBySource(st *storage.LevelDBBackend, source string, options storage.ListOptions) ( func() (BlockTransaction, bool, []byte), func(), )
func GetBlocksByConfirmed ¶
func GetBlocksByConfirmed(st *storage.LevelDBBackend, options storage.ListOptions) ( func() (Block, bool, []byte), func(), )
func GetTransactionPoolKey ¶
func InitTestBlockchain ¶
func InitTestBlockchain() *storage.LevelDBBackend
Like `MakeTestBlockchain`, but also create a storage
func LoadBlockAccountsInsideIterator ¶
func LoadBlockAccountsInsideIterator( st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), closeFunc func(), ) ( func() (*BlockAccount, bool, []byte), func(), )
func LoadBlockOperationsInsideIterator ¶
func LoadBlockOperationsInsideIterator( st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), closeFunc func(), ) ( func() (BlockOperation, bool, []byte), func(), )
func LoadBlockTransactionsInsideIterator ¶
func LoadBlockTransactionsInsideIterator( st *storage.LevelDBBackend, iterFunc func() (storage.IterItem, bool), closeFunc func(), ) ( func() (BlockTransaction, bool, []byte), func(), )
func MakeTestBlockchain ¶
func MakeTestBlockchain(st *storage.LevelDBBackend)
Make a default-initialized test blockchain
Write to the provided storage the genesis and common account, as well as the genesis block. This provide a simple, workable chain to use within tests.
If anything goes wrong, `panic`
Params:
st = Storage to write the blockchain to
func NewBlockOperationKey ¶
func WalkBlocks ¶
func WalkBlocks(st *storage.LevelDBBackend, option *storage.WalkOption, walkFunc func(*Block, []byte) (bool, error)) error
Types ¶
type Block ¶
type Block struct { Header Transactions []string `json:"transactions"` /* []Transaction.GetHash() */ ProposerTransaction string `json:"proposer_transaction"` /* ProposerTransaction */ Hash string `json:"hash"` Proposer string `json:"proposer"` /* Node.Address() */ Round uint64 `json:"round"` Confirmed string `json:"confirmed" rlp:"-"` }
func GetBlockByHeight ¶
func GetBlockByHeight(st *storage.LevelDBBackend, height uint64) (bt Block, err error)
func GetLatestBlock ¶
func GetLatestBlock(st *storage.LevelDBBackend) Block
func MakeGenesisBlock ¶
func MakeGenesisBlock(st *storage.LevelDBBackend, genesisAccount BlockAccount, commonAccount BlockAccount, networkID []byte) (blk *Block, err error)
MakeGenesisBlock makes genesis block.
This special block has different part from the other Block * `Block.Proposer` is empty * `Block.Transaction` is empty * `Block.ProposedTime` is `common.GenesisBlockConfirmedTime` * has only one `Transaction`
This Transaction is different from other normal Transaction; * signed by `keypair.Master(string(networkID))` * must have only two `Operation`, `CreateAccount` * The first `Operation` is for genesis account
- `CreateAccount.Amount` is same with balance of genesis account
- `CreateAccount.Target` is genesis account
* The next `Operation` is for common account
- `CreateAccount.Amount` is 0
- `CreateAccount.Target` is common account
* `Transaction.B.Fee` is 0
func NewBlock ¶
func NewBlock(proposer string, basis voting.Basis, ptx string, transactions []string, proposedTime string) *Block
NewBlock creates new block; `ptx` represents the `ProposerTransaction.GetHash()`.
func TestMakeNewBlock ¶
func (*Block) MustSave ¶
func (b *Block) MustSave(st *storage.LevelDBBackend)
/ Version of `Block.Save` that panics on error, usable only in tests
func (Block) NewBlockKeyConfirmed ¶
func (Block) PreviousBlock ¶
func (b Block) PreviousBlock(st *storage.LevelDBBackend) (blk Block, err error)
type BlockAccount ¶
type BlockAccount struct { Address string `json:"address"` Balance common.Amount `json:"balance"` SequenceID uint64 `json:"sequence_id"` // An address, or "" if the account isn't frozen Linked string `json:"linked"` CodeHash []byte `json:"code_hash"` RootHash common.Hash `json:"root_hash"` }
func GetBlockAccount ¶
func GetBlockAccount(st *storage.LevelDBBackend, address string) (b *BlockAccount, err error)
func NewBlockAccount ¶
func NewBlockAccount(address string, balance common.Amount) *BlockAccount
func NewBlockAccountLinked ¶
func NewBlockAccountLinked(address string, balance common.Amount, linked string) *BlockAccount
func TestMakeBlockAccount ¶
func TestMakeBlockAccount(kps ...*keypair.Full) *BlockAccount
func (*BlockAccount) Deposit ¶
func (b *BlockAccount) Deposit(fund common.Amount) error
Add fund to an account
If the amount would make the account overflow over the full supply of coin, an `error` is returned.
func (*BlockAccount) GetBalance ¶
func (b *BlockAccount) GetBalance() common.Amount
func (*BlockAccount) IncreaseSequenceID ¶
func (b *BlockAccount) IncreaseSequenceID()
func (*BlockAccount) IsFrozen ¶
func (b *BlockAccount) IsFrozen() bool
func (*BlockAccount) MustSave ¶
func (b *BlockAccount) MustSave(st *storage.LevelDBBackend)
/ Version of `BlockAccount.Save` that panics on error, usable only in tests
func (*BlockAccount) Save ¶
func (b *BlockAccount) Save(st *storage.LevelDBBackend) (err error)
func (*BlockAccount) String ¶
func (b *BlockAccount) String() string
type BlockAccountSequenceID ¶
BlockAccountSequenceID is the one-and-one model of account and sequenceID in block. the storage should support,
- find by `Address`:
- key: "`Address`-`SequenceID`": value: `ID` of BlockAccountSequenceID
- get list by created order:
models
- 'address' and 'sequenceID'
- 'bac-<BlockAccountSequenceID.Address>-<BlockAccountSequenceID.SequenceID>': `BlockAccountSequenceID`
func GetBlockAccountSequenceID ¶
func GetBlockAccountSequenceID(st *storage.LevelDBBackend, address string, sequenceID uint64) (b BlockAccountSequenceID, err error)
func (*BlockAccountSequenceID) Save ¶
func (b *BlockAccountSequenceID) Save(st *storage.LevelDBBackend) (err error)
func (*BlockAccountSequenceID) String ¶
func (b *BlockAccountSequenceID) String() string
type BlockOperation ¶
type BlockOperation struct { Hash string `json:"hash"` OpHash string `json:"op_hash"` TxHash string `json:"tx_hash"` Type operation.OperationType `json:"type"` Source string `json:"source"` Target string `json:"target"` Body []byte `json:"body"` Height uint64 `json:"block_height"` // contains filtered or unexported fields }
func GetBlockOperation ¶
func GetBlockOperation(st *storage.LevelDBBackend, hash string) (bo BlockOperation, err error)
func GetBlockOperationByIndex ¶
func GetBlockOperationByIndex(st *storage.LevelDBBackend, txHash string, opIndex int) (BlockOperation, error)
Looks up the operation referenced by `txHash`, then get the operation's hash from it
func NewBlockOperationFromOperation ¶
func NewBlockOperationFromOperation(op operation.Operation, tx transaction.Transaction, blockHeight uint64) (BlockOperation, error)
func TestMakeNewBlockOperation ¶
func TestMakeNewBlockOperation(networkID []byte, n int) (bos []BlockOperation)
func (*BlockOperation) MustSave ¶
func (b *BlockOperation) MustSave(st *storage.LevelDBBackend)
/ Version of `BlockTransaction.Save` that panics on error, usable only in tests
func (BlockOperation) NewBlockOperationBlockHeightKey ¶
func (bo BlockOperation) NewBlockOperationBlockHeightKey() string
func (BlockOperation) NewBlockOperationFrozenLinkedKey ¶
func (bo BlockOperation) NewBlockOperationFrozenLinkedKey(hash string) string
func (BlockOperation) NewBlockOperationPeersAndTypeKey ¶
func (bo BlockOperation) NewBlockOperationPeersAndTypeKey(addr string) string
func (BlockOperation) NewBlockOperationPeersKey ¶
func (bo BlockOperation) NewBlockOperationPeersKey(addr string) string
func (BlockOperation) NewBlockOperationSourceAndTypeKey ¶
func (bo BlockOperation) NewBlockOperationSourceAndTypeKey() string
func (BlockOperation) NewBlockOperationSourceKey ¶
func (bo BlockOperation) NewBlockOperationSourceKey() string
func (BlockOperation) NewBlockOperationTargetAndTypeKey ¶
func (bo BlockOperation) NewBlockOperationTargetAndTypeKey(target string) string
func (BlockOperation) NewBlockOperationTargetKey ¶
func (bo BlockOperation) NewBlockOperationTargetKey(target string) string
func (BlockOperation) NewBlockOperationTxHashKey ¶
func (bo BlockOperation) NewBlockOperationTxHashKey() string
func (*BlockOperation) Save ¶
func (bo *BlockOperation) Save(st *storage.LevelDBBackend) (err error)
type BlockTransaction ¶
type BlockTransaction struct { Hash string `json:"hash"` Block string `json:"block"` SequenceID uint64 `json:"sequence_id"` Signature string `json:"signature"` Source string `json:"source"` Fee common.Amount `json:"fee"` Operations []string `json:"operations"` Amount common.Amount `json:"amount"` Confirmed string `json:"confirmed"` Created string `json:"created"` Message []byte `json:"message"` // contains filtered or unexported fields }
func GetBlockTransaction ¶
func GetBlockTransaction(st *storage.LevelDBBackend, hash string) (bt BlockTransaction, err error)
func NewBlockTransactionFromTransaction ¶
func NewBlockTransactionFromTransaction(blockHash string, blockHeight uint64, confirmed string, tx transaction.Transaction) BlockTransaction
func (*BlockTransaction) GetOperationIndex ¶
func (bt *BlockTransaction) GetOperationIndex(opHash string) (opIndex int, err error)
TODO: This function is no longer required when Index for operation is applied
func (*BlockTransaction) MustSave ¶
func (b *BlockTransaction) MustSave(st *storage.LevelDBBackend)
/ Version of `BlockTransaction.Save` that panics on error, usable only in tests
func (BlockTransaction) NewBlockTransactionKeyByAccount ¶
func (bt BlockTransaction) NewBlockTransactionKeyByAccount(accountAddress string) string
func (BlockTransaction) NewBlockTransactionKeyByBlock ¶
func (bt BlockTransaction) NewBlockTransactionKeyByBlock(hash string) string
func (BlockTransaction) NewBlockTransactionKeyConfirmed ¶
func (bt BlockTransaction) NewBlockTransactionKeyConfirmed() string
func (BlockTransaction) NewBlockTransactionKeySource ¶
func (bt BlockTransaction) NewBlockTransactionKeySource() string
func (*BlockTransaction) Save ¶
func (bt *BlockTransaction) Save(st *storage.LevelDBBackend) (err error)
func (*BlockTransaction) SaveBlockOperation ¶
func (bt *BlockTransaction) SaveBlockOperation(st *storage.LevelDBBackend, op operation.Operation) (err error)
func (*BlockTransaction) SaveBlockOperations ¶
func (bt *BlockTransaction) SaveBlockOperations(st *storage.LevelDBBackend) (err error)
func (BlockTransaction) String ¶
func (bt BlockTransaction) String() string
func (BlockTransaction) Transaction ¶
func (bt BlockTransaction) Transaction() transaction.Transaction
type Header ¶
type Header struct { // TODO rename `Header` to `BlockHeader` Version uint32 `json:"version"` PrevBlockHash string `json:"prev_block_hash"` // TODO Uint256 type TransactionsRoot string `json:"transactions_root"` // Merkle root of Txs // TODO Uint256 type ProposedTime string `json:"proposed_time"` Height uint64 `json:"height"` TotalTxs uint64 `json:"total-txs"` TotalOps uint64 `json:"total-ops"` }
func GetBlockHeader ¶
func GetBlockHeader(st *storage.LevelDBBackend, hash string) (bt Header, err error)
func GetBlockHeaderByHeight ¶
func GetBlockHeaderByHeight(st *storage.LevelDBBackend, height uint64) (bt Header, err error)
func NewBlockHeader ¶
type TransactionPool ¶
type TransactionPool struct { Hash string `json:"hash"` Message []byte `json:"message"` // contains filtered or unexported fields }
TransactionPool is not `transaction.Pool`; this contains the all the valid transactions. The unconfirmed transactions of `TransactionPool` can be removed, but confirmed transactions must be here.
NOTE The sync process must store the confirmed transactions.
func GetTransactionPool ¶
func GetTransactionPool(st *storage.LevelDBBackend, hash string) (tp TransactionPool, err error)
func NewTransactionPool ¶
func NewTransactionPool(tx transaction.Transaction) (tp TransactionPool, err error)
func SaveTransactionPool ¶
func SaveTransactionPool(st *storage.LevelDBBackend, tx transaction.Transaction) (tp TransactionPool, err error)
func (TransactionPool) Save ¶
func (tp TransactionPool) Save(st *storage.LevelDBBackend) (err error)
func (TransactionPool) Serialize ¶
func (tp TransactionPool) Serialize() ([]byte, error)
func (TransactionPool) String ¶
func (tp TransactionPool) String() string
func (TransactionPool) Transaction ¶
func (tp TransactionPool) Transaction() transaction.Transaction