util

package
v0.0.0-...-6ac58e8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockToDelOPs

func BlockToDelOPs(
	blk *btcutil.Block) []wire.OutPoint

blockToDelOPs gives all the UTXOs in a block that need proofs in order to be deleted. All txinputs except for the coinbase input and utxos created within the same block (on the skiplist)

func CheckMagicByte

func CheckMagicByte(bytesgiven []byte) bool

CheckMagicByte checks for the Bitcoin magic bytes. returns false if it didn't read the Bitcoin magic bytes. Checks only for testnet3 and mainnet

func DedupeBlock

func DedupeBlock(
	blk *btcutil.Block) (inCount, outCount uint32, inskip, outskip []uint32)

DedupeBlock takes a bitcoin block, and returns two int slices: the indexes of inputs, and idexes of outputs which can be removed. These are indexes within the block as a whole, even the coinbase tx. So the coinbase tx in & output numbers affect the skip lists even though the coinbase ins/outs can never be deduped. it's simpler that way.

func HasAccess

func HasAccess(fileName string) bool

HasAccess reports whether we have access to the named file. Returns true if HasAccess, false if it doesn't. Does NOT tell us if the file exists or not. File might exist but may not be available to us

func IsUnspendable

func IsUnspendable(o *wire.TxOut) bool

IsUnspendable determines whether a tx is spendable or not. returns true if spendable, false if unspendable.

func OutpointToBytes

func OutpointToBytes(op *wire.OutPoint) (b [36]byte)

turns an outpoint into a 36 byte... mixed endian thing. (the 32 bytes txid is "reversed" and the 4 byte index is in order (big)

func PopPrefixLen16

func PopPrefixLen16(b []byte) ([]byte, []byte, error)

func PrefixLen16

func PrefixLen16(b []byte) []byte

PrefixLen16 puts a 2 byte length prefix in front of a byte slice

Types

type Hash

type Hash [32]byte

func GenHashForNet

func GenHashForNet(p chaincfg.Params) (*Hash, error)

For a given BitcoinNet, yields the genesis hash If the BitcoinNet is not supported, an error is returned.

func HashFromString

func HashFromString(s string) Hash

HashFromString hashes the given string with sha256

Jump to

Keyboard shortcuts

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