sidechain

package
v0.58.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

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 New

func New(cfg config.Config, log *zap.Logger, errCh chan error) (*SideChain, error)

New creates SideChain.

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) Height

func (s *SideChain) Height() uint32

Height returns the last known current height network is operating with.

func (*SideChain) Magic

func (s *SideChain) Magic() uint32

Magic returns chain's magic number.

func (*SideChain) Run

func (s *SideChain) Run(ctx context.Context) error

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

func (s *SideChain) SubscribeForBlocks(ch chan *block.Header)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL