network

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidMagic = errors.New("invalid network magic")
)

Functions

func GetNetworkParams

func GetNetworkParams(magic Network) (*chaincfg.Params, error)

Types

type Network

type Network uint32

/ Network represents the byte sequences used to identify different Safecoin networks.

const (
	// Mainnet identifies the Safecoin mainnet
	Mainnet Network = 0x8fe2edf1
	// Testnet identifies Safecoin public testnet
	Testnet Network = 0x627E1F5A
	// Regtest identifies the regression test network
	Regtest Network = 0xf5f38eaa
)

func Decode

func Decode(data []byte) (Network, error)

Decode parses a valid network identifier from a byte slice. It returns the identifier on success, zero and an error on failure.

func (Network) Marshal

func (m Network) Marshal(dst []byte) (out []byte)

Marshal appends the 4-byte, little endian encoding of a network identifier to the dst slice and returns the resulting slice. If there is sufficient room in the dst slice, Marshal does not allocate.

Jump to

Keyboard shortcuts

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