Documentation
¶
Index ¶
- type SideChain
- func (s *SideChain) AddTx(tx *transaction.Transaction) error
- func (s *SideChain) Height() uint32
- func (s *SideChain) Magic() uint32
- func (s *SideChain) Run(ctx context.Context) error
- func (s *SideChain) Stop()
- func (s *SideChain) SubscribeForBlocks(ch chan *block.Header)
- func (s *SideChain) SubscribeForNotifications(ch chan *state.ContainedNotificationEvent)
- func (s *SideChain) TransactionTestInvocation(tx *transaction.Transaction) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SideChain ¶
type SideChain struct {
// contains filtered or unexported fields
}
SideChain defines side chain that runs independently but with redefined native contracts, see [metachain.NewCustomNatives] for details. It must be created with New.
func (*SideChain) AddTx ¶
func (s *SideChain) AddTx(tx *transaction.Transaction) error
AddTx adds transaction to node's transaction pools. Non-nil return value _does not mean_ transaction is included, use SideChain.SubscribeForNotifications or SideChain.SubscribeForBlocks to be notified about accepted chain changes.
func (*SideChain) Run ¶
Run starts SideChain. Must be called only on instances created with New. Blocked until either context is done or side chais is in sync with specified seed nodes. To cancel this func, SideChain.Stop should be called.
func (*SideChain) Stop ¶
func (s *SideChain) Stop()
Stop stops the side chain. Must be called only after a successful SideChain.Run.
func (*SideChain) SubscribeForBlocks ¶
SubscribeForBlocks subscribes for chain block headers. Channel must be read to prevent deadlock.
func (*SideChain) SubscribeForNotifications ¶
func (s *SideChain) SubscribeForNotifications(ch chan *state.ContainedNotificationEvent)
SubscribeForNotifications subscribes for chain notifications. Channel must be read to prevent deadlock.
func (*SideChain) TransactionTestInvocation ¶
func (s *SideChain) TransactionTestInvocation(tx *transaction.Transaction) error
TransactionTestInvocation runs a test with transaction's script without persisting it, and returns consumed GAS by the system. Returned value is actual for the moment of SystemFee call, sending the transaction later may lead to an increased (or decreased) GAS comsumption due to possible chain state differences.