ombutil

package
v0.0.0-...-5da9300 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2016 License: GPL-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDataDir

func AppDataDir(appName string, roaming bool) string

AppDataDir returns an operating system specific directory to be used for storing application data for an application.

The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice. An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.

The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default.

Example results:

dir := AppDataDir("myapp", false)
 POSIX (Linux/BSD): ~/.myapp
 Mac OS: $HOME/Library/Application Support/Myapp
 Windows: %LOCALAPPDATA%\Myapp
 Plan 9: $home/myapp

func PastPegDate

func PastPegDate(blk *btcutil.Block, net *chaincfg.Params) bool

PastPegDate determines if the passed block was created after the target peg date after which entries can be added to the public record.

Types

type Author

type Author string

func ParseAuthor

func ParseAuthor(tx *wire.MsgTx, net *chaincfg.Params) (Author, error)

Returns the "Author" who signed the first txin of the transaction

type Bulletin

type Bulletin struct {
	// pulled from the enclosing tx
	Author Author

	// The containing transaction
	Tx *wire.MsgTx

	Block *btcutil.Block

	// Derived types
	Json *ombjson.Bulletin
	Wire *ombwire.Bulletin
}

Bulletin is a utility type that holds data and references. The unexported fields can be nil.

func NewBltn

func NewBltn(w *ombwire.Bulletin, tx *btcutil.Tx, blk *btcutil.Block, net *chaincfg.Params) (*Bulletin, error)

NewBltn takes what looks like a bulletin and prepares it for insertion into the public record. If there any problems NewBltn throws an error.

func (*Bulletin) AddBlock

func (bltn *Bulletin) AddBlock(blk *btcutil.Block)

func (*Bulletin) Tags

func (bltn *Bulletin) Tags() Tags

Tags returns all of the tags encoded within the message body of the bulletin. Only the first 5 tags are counted and returned.

type Endorsement

type Endorsement struct {
	Block  *btcutil.Block
	Tx     *wire.MsgTx
	Author Author

	Wire *ombwire.Endorsement
	Json *ombjson.Endorsement
}

func NewEndo

func NewEndo(w *ombwire.Endorsement, tx *btcutil.Tx, blk *btcutil.Block, net *chaincfg.Params) (*Endorsement, error)

NewEndo functions very similarly to NewBltn. It bails out if there are any problems with the passed wire, tx, or blk.

type Tag

type Tag string

type Tags

type Tags map[Tag]struct{}

func ParseTags

func ParseTags(m string) Tags

ParseTags returns up to maxNum tags in the passed string. Tags are pulled out in iterative order and they are started with a '#' and concluded with a tag break character.

type UBlock

type UBlock struct {
	Block        *btcutil.Block
	Bulletins    []*Bulletin
	Endorsements []*Endorsement
}

A helper struct that contains all of the data relevant to ombuds in a Bitcoin block.

func CreateUBlock

func CreateUBlock(blk *btcutil.Block, log btclog.Logger, net *chaincfg.Params) *UBlock

CreateUBlock parses a btcutil block and parses out the relevant records. If logger is not nil, it is used to report strange problems as the functions parses through a block.

Jump to

Keyboard shortcuts

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