Class Block.Builder
java.lang.Object
com.exonum.binding.core.blockchain.Block.Builder
- Enclosing class:
- Block
public abstract static class Block.Builder
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description Builder() -
Method Summary
Modifier and Type Method Description abstract Block.BuilderadditionalHeaders(com.google.common.collect.ImmutableMap<java.lang.String,com.google.protobuf.ByteString> additionalHeaders)Sets additional block headers.abstract Block.BuilderblockHash(HashCode hash)Sets the hash of the block binary representation.Blockbuild()Creates a new block with the set arguments.abstract Block.BuildererrorHash(HashCode errorHash)Sets error hash.abstract Block.Builderheight(long height)Sets the block height, which is the distance between the block and the genesis block, which has zero height.abstract Block.BuildernumTransactions(int numTransactions)Sets the number of transactions in this block.abstract Block.BuilderpreviousBlockHash(HashCode previousBlockHash)Sets the hash of the previous block in the hash chain.abstract Block.BuilderproposerId(int proposerId)Sets the identifier of the leader node which has proposed the block.abstract Block.BuilderstateHash(HashCode blockchainStateHash)Sets the blockchain state hash at the moment this block was committed.abstract Block.BuildertxRootHash(HashCode txRootHash)Sets the Merkle root hash of the collection holding all transactions in this block.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
blockHash
Sets the hash of the block binary representation. -
proposerId
Sets the identifier of the leader node which has proposed the block. -
height
Sets the block height, which is the distance between the block and the genesis block, which has zero height. Must be non-negative. -
numTransactions
Sets the number of transactions in this block. Must be non-negative. -
previousBlockHash
Sets the hash of the previous block in the hash chain. The previous block is the block with the height, that is equal to this minus one. Genesis block has a previous hash of zeroes. -
txRootHash
Sets the Merkle root hash of the collection holding all transactions in this block. This collection and transactions can be accessed withBlockchain.getBlockTransactions(Block). -
stateHash
Sets the blockchain state hash at the moment this block was committed. The blockchain state hash reflects the state of each service in the database.- See Also:
Schema
-
errorHash
Sets error hash.- See Also:
Blockchain.getCallRecords(long)
-
additionalHeaders
public abstract Block.Builder additionalHeaders(com.google.common.collect.ImmutableMap<java.lang.String,com.google.protobuf.ByteString> additionalHeaders)Sets additional block headers. Headers should have exactly the same order as its native equivalent. Changing headers order will lead to the block hash violation. -
build
Creates a new block with the set arguments.- Throws:
java.lang.IllegalStateException- if some of the arguments were not set or aren't valid
-