powless

package
v0.0.0-...-8c3d3b4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRawTx

func GetRawTx(txid string) (*wire.MsgTx, error)

GetRawTx is a helper function to get a tx from the insight api

Types

type APILink struct {

	// TrackingAdrs and OPs are slices of addresses and outpoints to watch for.
	// Using struct{} saves a byte of RAM but is ugly so I'll use bool.
	TrackingAdrs    map[[20]byte]bool
	TrackingAdrsMtx sync.Mutex

	TrackingOPs    map[wire.OutPoint]bool
	TrackingOPsMtx sync.Mutex

	TxUpToWallit chan lnutil.TxAndHeight

	CurrentHeightChan chan int32

	// Might as well add this in here too
	HeightDistribute []chan int32
	// contains filtered or unexported fields
}

APILink is a link to a web API that can tell you about blockchain data.

func (*APILink) DirtyCheckLoop

func (a *APILink) DirtyCheckLoop()

DirtyCheckLoop checks with the server once things have changed on the client end. this is actually a bit ugly because it checks *everything* when *anything* has changed. It could be much more efficient if, eg it checks for a newly created address by itself.

func (*APILink) GetOPTxs

func (a *APILink) GetOPTxs() error

func (*APILink) GetVAdrTxos

func (a *APILink) GetVAdrTxos() error

GetVAdrTxos gets new utxos for the wallet from the indexer.

func (*APILink) GetVOPTxs

func (a *APILink) GetVOPTxs() error

func (*APILink) NewHeightChannel

func (a *APILink) NewHeightChannel() chan int32

NewHeightChannel creates a new channel that should be pushed to whenever the height changes. If multiple things have separate or obscured handlers which require the height, use this.

func (*APILink) NewRawBlocksChannel

func (a *APILink) NewRawBlocksChannel() chan *wire.MsgBlock

NewRawBlocksChannel returns a dummy channel that does nothing. In the future make this more like NewHeightChannel if that feature is going to be in APILink. Included to satisfy ChainHook interface.

func (*APILink) NsightGetAdrTxos

func (a *APILink) NsightGetAdrTxos() error

...use insight api. at least that's open source, can run yourself, seems to have some dev activity behind it.

func (*APILink) PushTx

func (a *APILink) PushTx(tx *wire.MsgTx) error

PushTx for indexer

func (*APILink) PushTxSmartBit

func (a *APILink) PushTxSmartBit(tx *wire.MsgTx) error

PushTx pushes a tx to the network via the smartbit site / api smartbit supports segwit so

func (*APILink) RawBlocks

func (a *APILink) RawBlocks() chan *wire.MsgBlock

RawBlocks returns a dummy channel for now

func (*APILink) RegisterAddress

func (a *APILink) RegisterAddress(adr160 [20]byte) error

RegisterAddress gets a 20 byte address from the wallit and starts watching for utxos at that address.

func (*APILink) RegisterOutPoint

func (a *APILink) RegisterOutPoint(op wire.OutPoint) error

RegisterOutPoint gets an outpoint from the wallit and starts looking for txins that spend it.

func (*APILink) Start

func (a *APILink) Start(
	startHeight int32, host, path string, proxyURL string, params *coinparam.Params) (
	chan lnutil.TxAndHeight, chan int32, error)

Start starts the APIlink

func (*APILink) TipRefreshLoop

func (a *APILink) TipRefreshLoop() error

TipRefreshLoop checks for a change in the highest block hash if so it sets the dirty flag to true to trigger a refresh

func (*APILink) UnregisterOutPoint

func (a *APILink) UnregisterOutPoint(op wire.OutPoint) error

UnregisterOutPoint stops watching an outpoint for spends.

func (*APILink) UpdateHeight

func (a *APILink) UpdateHeight(height int32)

UpdateHeight updates APILink height variables and channels after the height supposedly changed.

func (*APILink) VGetRawTx

func (a *APILink) VGetRawTx(txid string) (*wire.MsgTx, error)

VGetRawTx is a helper function to get a tx from the indexer

type AdrUtxoResponse

type AdrUtxoResponse struct {
	Txid     string
	Height   int32
	Satoshis int64
}

ARGHGH all fields have to be exported (caps) or the json unmarshaller won't populate them !

type RawTxResponse

type RawTxResponse struct {
	RawTx string
}

do you even need a struct here..?

type TxResponse

type TxResponse struct {
	Txid        string
	Blockheight int32
	Vout        []VoutJson
}

type VBlock

type VBlock struct {
	Height   int32
	Hash     string
	Time     int64
	TxLength int32
	Size     int32
	PoolInfo string
}

VBlock is the json data that comes back from the /blocks query to the indexer

type VBlocksResponse

type VBlocksResponse []VBlock

VBlocksResponse is a list of Vblocks, which comes back from the /blocks query to the indexer

type VRawResponse

type VRawResponse []VRawTx

type VRawTx

type VRawTx struct {
	Height  int32
	Spender string
	Tx      string
}

type VSpendResponse

type VSpendResponse struct {
	Error      bool
	Spender    string
	SpenderRaw string
	Spent      bool
}

VSpendResponse is the JSON response from the / outpointSpend call

type VoutJson

type VoutJson struct {
	N           uint32
	SpentTxId   string
	SpentHeight int32
}

Get txid of spending tx

Jump to

Keyboard shortcuts

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