node

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BurnAddress is the mainnet burn address
	BurnAddress = "EC2BURNFCT2PEGNETooo1oooo1oooo1oooo1oooo1oooo19wthin"
	// BurnRCD is the rcd representation of the burn address
	BurnRCD = [32]byte{}
)
View Source
var GradingV2Activation uint32 = 210330
View Source
var OPRChain = *factom.NewBytes32FromString("a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef")
View Source
var PegnetActivation uint32 = 206421
View Source
var TransactionChain = *factom.NewBytes32FromString("cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d")
View Source
var TransactionConversionActivation uint32 = 213237

TransactionConversionActivation indicates when tx/conversions go live on mainnet. Target Activation Height is Oct 7, 2019 15 UTC

Functions

func ComputeChainIDFromFields

func ComputeChainIDFromFields(fields [][]byte) [32]byte

ComputeChainIDFromFields Takes the binary fields that define a chainID and hashes them together to create the ChainID expected by the APIs. These fields are treated as binary, but could be simple text, like: "Bob's" "Favorite" "Chain"

func ComputeChainIDFromStrings

func ComputeChainIDFromStrings(fields []string) [32]byte

ComputeChainIDFromStrings Take a set of strings, and compute the chainID. If you have binary fields, you can call factom.ComputeChainIDFromFields directly.

func FactomClientFromConfig

func FactomClientFromConfig(conf *viper.Viper) *factom.Client

Types

type Pegnetd

type Pegnetd struct {
	FactomClient *factom.Client
	Config       *viper.Viper

	Sync   *pegnet.BlockSync
	Pegnet *pegnet.Pegnet
}

func NewPegnetd

func NewPegnetd(ctx context.Context, conf *viper.Viper) (*Pegnetd, error)

func (*Pegnetd) ApplyFactoidBlock

func (d *Pegnetd) ApplyFactoidBlock(ctx context.Context, tx *sql.Tx, dblock *factom.DBlock) error

ApplyFactoidBlock applies the FCT burns that occurred within the given DBlock. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) ApplyGradedOPRBlock

func (d *Pegnetd) ApplyGradedOPRBlock(tx *sql.Tx, gradedBlock grader.GradedBlock) error

ApplyGradedOPRBlock pays out PEG to the winners of the given GradedBlock. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) ApplyTransactionBatchesInHolding

func (d *Pegnetd) ApplyTransactionBatchesInHolding(ctx context.Context, sqlTx *sql.Tx, currentHeight uint32) error

ApplyTransactionBatchesInHolding attempts to apply the transaction batches from previous blocks that were put into holding because they contained conversions. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) ApplyTransactionBlock

func (d *Pegnetd) ApplyTransactionBlock(sqlTx *sql.Tx, eblock *factom.EBlock) error

ApplyTransactionBlock puts conversion-containing transaction batches into holding, and applys the balance updates for all transaction batches able to be executed immediately. If an error is returned, the sql.Tx should be rolled back by the caller.

func (*Pegnetd) DBlockSync

func (d *Pegnetd) DBlockSync(ctx context.Context)

DBlockSync iterates through dblocks and syncs the various chains

func (*Pegnetd) GetCurrentSync

func (d *Pegnetd) GetCurrentSync() uint32

func (*Pegnetd) Grade

func (d *Pegnetd) Grade(ctx context.Context, block *factom.EBlock) (grader.GradedBlock, error)

func (*Pegnetd) SyncBlock

func (d *Pegnetd) SyncBlock(ctx context.Context, tx *sql.Tx, height uint32) error

If SyncBlock returns no error, than that height was synced and saved. If any part of the sync fails, the whole sync should be rolled back and not applied. An error should then be returned. The context should be respected if it is cancelled

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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