utxoset

package
v0.0.0-...-bcfd2cf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package utxoset package to keep track of utxoset during parsing. Currently NOT USED

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Btoi

func Btoi(b []byte) (v int)

Btoi returns a decimal representation of a 8-byte big endian

func Itob

func Itob(v int) (b []byte)

Itob returns an 8-byte big endian representation of v

Types

type Config

type Config struct {
	Path string
	Disk bool
}

Config struct containing initialization fields

func Conf

func Conf(file string, disk bool) *Config

Conf exports the Config object to initialize indexing Utxoset

type UtxoSet

type UtxoSet struct {
	// contains filtered or unexported fields
}

UtxoSet unspent transaction output in memory and persistant storage

func Instance

func Instance(conf *Config) *UtxoSet

Instance implements the singleton pattern to return the UtxoSet instance

func (*UtxoSet) CheckUtxoSet

func (u *UtxoSet) CheckUtxoSet(hash string) bool

CheckUtxoSet returns true if the utxo set is stored

func (*UtxoSet) Close

func (u *UtxoSet) Close() error

Close closed bolt connection

func (*UtxoSet) DeleteUtxo

func (u *UtxoSet) DeleteUtxo(hash string, vout uint32) (err error)

DeleteUtxo deletes the uid in the tx bucket

func (*UtxoSet) DeleteUtxoSet

func (u *UtxoSet) DeleteUtxoSet(hash string) (err error)

DeleteUtxoSet deletes the tx bucket

func (*UtxoSet) GetStoredUtxo

func (u *UtxoSet) GetStoredUtxo(hash string, vout uint32) (uid string, err error)

GetStoredUtxo returns the bolt stored output

func (*UtxoSet) GetUtxo

func (u *UtxoSet) GetUtxo(hash string, vout uint32) (uid string, err error)

GetUtxo returns the required output

func (*UtxoSet) GetUtxoSet

func (u *UtxoSet) GetUtxoSet(hash string) (uids map[uint32]string, err error)

GetUtxoSet returns the required output set (outputs of a transaction)

func (*UtxoSet) Restore

func (u *UtxoSet) Restore(last string) (err error)

Restore initialize memory set mapping the stored set

func (*UtxoSet) StoreUtxoSet

func (u *UtxoSet) StoreUtxoSet(hash string, outputs map[uint32]string) (err error)

StoreUtxoSet write a new tx outputs set to the struct

Jump to

Keyboard shortcuts

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