Documentation
¶
Index ¶
- Constants
- Variables
- func BuildCoderFromBlock(m *MinedBlock) (*coder.MinedBlock, error)
- func BuildCoderFromBytes(data []byte) (*coder.MinedBlock, error)
- func BuildTxsMap(txs []*statechain.Transaction) statechain.TransactionsMap
- func CheckBlockHashAgainstDifficulty(block *mainchain.Block) (bool, error)
- func CheckHashAgainstDifficulty(hashHex string, difficulty uint64) (bool, error)
- func VerifyMerkleTreeFromMinedBlock(ctx context.Context, minedBlock *MinedBlock) (bool, error)
- func VerifyMinedBlock(ctx context.Context, p2pSvc p2p.Interface, sbSvc sandbox.Interface, ...) (bool, error)
- func VerifyStateBlocksFromMinedBlock(ctx context.Context, p2pSvc p2p.Interface, sbSvc sandbox.Interface, ...) (bool, error)
- func VerifyTransaction(tx *statechain.Transaction) (bool, error)
- type Interface
- type MinedBlock
- type Props
- type Service
Constants ¶
View Source
const ( // StateFileName ... StateFileName string = "state.txt" )
Variables ¶
View Source
var ( // ErrNilBlock ... ErrNilBlock = errors.New("block is nil") // ErrNoHash ... ErrNoHash = errors.New("no hash present") // ErrNilTx ... ErrNilTx = errors.New("transaction is nil") // ErrNoSig ... ErrNoSig = errors.New("no signature present") // ErrInvalidFromAddress ... ErrInvalidFromAddress = errors.New("from address is not valid") // ErrInvalidTx ... ErrInvalidTx = errors.New("transaction is not valid") // ErrNilDiff ... ErrNilDiff = errors.New("diff is nil") )
Functions ¶
func BuildCoderFromBlock ¶
func BuildCoderFromBlock(m *MinedBlock) (*coder.MinedBlock, error)
BuildCoderFromBlock ...
func BuildCoderFromBytes ¶
func BuildCoderFromBytes(data []byte) (*coder.MinedBlock, error)
BuildCoderFromBytes ...
func BuildTxsMap ¶
func BuildTxsMap(txs []*statechain.Transaction) statechain.TransactionsMap
BuildTxsMap ...
func CheckBlockHashAgainstDifficulty ¶
CheckBlockHashAgainstDifficulty ...
func CheckHashAgainstDifficulty ¶
CheckHashAgainstDifficulty ...
func VerifyMerkleTreeFromMinedBlock ¶
func VerifyMerkleTreeFromMinedBlock(ctx context.Context, minedBlock *MinedBlock) (bool, error)
VerifyMerkleTreeFromMinedBlock ...
func VerifyMinedBlock ¶
func VerifyMinedBlock(ctx context.Context, p2pSvc p2p.Interface, sbSvc sandbox.Interface, minedBlock *MinedBlock) (bool, error)
VerifyMinedBlock ...
func VerifyStateBlocksFromMinedBlock ¶
func VerifyStateBlocksFromMinedBlock(ctx context.Context, p2pSvc p2p.Interface, sbSvc sandbox.Interface, minedBlock *MinedBlock) (bool, error)
VerifyStateBlocksFromMinedBlock ... note: this function also checks the merkle tree. That check is not required to be performed, separately.
func VerifyTransaction ¶
func VerifyTransaction(tx *statechain.Transaction) (bool, error)
VerifyTransaction ...
Types ¶
type MinedBlock ¶
type MinedBlock struct { NextBlock *mainchain.Block `json:"nextBlock"` PreviousBlock *mainchain.Block `json:"previousBlock"` StatechainBlocksMap map[string]*statechain.Block `json:"statechainBlocksMap"` TransactionsMap map[string]*statechain.Transaction `json:"transactionsMap"` DiffsMap map[string]*statechain.Diff `json:"diffsMap"` MerkleTreesMap map[string]*merkle.Tree `json:"merkleTreesMap"` // contains filtered or unexported fields }
MinedBlock ...
func BuildBlockFromBytes ¶
func BuildBlockFromBytes(data []byte) (*MinedBlock, error)
BuildBlockFromBytes ...
func BuildBlockFromCoder ¶
func BuildBlockFromCoder(tmp *coder.MinedBlock) (*MinedBlock, error)
BuildBlockFromCoder ...
func (*MinedBlock) Deserialize ¶
func (m *MinedBlock) Deserialize(data []byte) error
Deserialize ...
func (*MinedBlock) DeserializeString ¶
func (m *MinedBlock) DeserializeString(hexStr string) error
DeserializeString ...
func (*MinedBlock) SerializeString ¶
func (m *MinedBlock) SerializeString() (string, error)
SerializeString ...
type Props ¶
type Props struct { Context context.Context PreviousBlock *mainchain.Block Difficulty uint64 Channel chan interface{} Async bool // note: build state blocks asynchronously? EncodedMinerAddress string P2P p2p.Interface Sandbox sandbox.Interface PendingTransactions []*statechain.Transaction RemoveTx func(hash string) error }
Props is passed to the new function
Click to show internal directories.
Click to hide internal directories.