Documentation
¶
Index ¶
- Constants
- type ReorgConfig
- type ReorgController
- func (rc *ReorgController) Complete() bool
- func (rc *ReorgController) ReOrg(depth int)
- func (rc *ReorgController) ReceiveHeader(header blockchain.NodeHeader) error
- func (rc *ReorgController) VerifyReorgComplete() error
- func (rc *ReorgController) Wait() error
- func (rc *ReorgController) WaitDepthReached() error
- func (rc *ReorgController) WaitReorgStarted()
Constants ¶
const ( InitConsensus int64 = iota NetworkFork CheckBlocks Consensus Wait )
The steps are: 1. Await initial network consensus for N blocks 2. Fork the network, separate node 0 from 1 and 2 3. Await alternative blocks mined on node zero, nodes 1 and 2 will have longer chain with more block difficulty so blocks of node 0 must be replaced 4. Await consensus for N blocks, check alt block hashes now
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReorgConfig ¶
type ReorgConfig struct { FromPodLabel string ToPodLabel string Network blockchain.EVMClient Env *environment.Environment BlockConsensusThreshold int Timeout time.Duration }
type ReorgController ¶
type ReorgController struct { ReorgDepth int // contains filtered or unexported fields }
ReorgController reorg stats collecting struct
func NewReorgController ¶
func NewReorgController(cfg *ReorgConfig) (*ReorgController, error)
NewReorgController creates a type that can create reorg chaos and confirm reorg has happened
func (*ReorgController) Complete ¶
func (rc *ReorgController) Complete() bool
func (*ReorgController) ReceiveHeader ¶
func (rc *ReorgController) ReceiveHeader(header blockchain.NodeHeader) error
ReceiveHeader receives header marked by node that mined it, forks the network and record all alternative block numbers on node 0
func (*ReorgController) VerifyReorgComplete ¶
func (rc *ReorgController) VerifyReorgComplete() error
VerifyReorgComplete verifies that all blocks are replaced by reorg
func (*ReorgController) Wait ¶
func (rc *ReorgController) Wait() error
Wait wait until reorg is done
func (*ReorgController) WaitDepthReached ¶
func (rc *ReorgController) WaitDepthReached() error
WaitDepthReached wait until N alternative blocks are mined
func (*ReorgController) WaitReorgStarted ¶
func (rc *ReorgController) WaitReorgStarted()
WaitReorgStarted waits until first alternative block is present