daemon

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

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ExtraDataAmountKey = "amount"

Variables

This section is empty.

Functions

func ConvertSPRecipient

func ConvertSPRecipient(recipient *bip352.Recipient) *src.Recipient

ConvertSPRecipient converts a bip352.Recipient to a Recipient native to this program

func CreateUnsignedPsbt

func CreateUnsignedPsbt(recipients []*src.Recipient, vins []*bip352.Vin) (*psbt.Packet, error)

func ParseRecipients

func ParseRecipients(recipients []*src.Recipient, vins []*bip352.Vin, chainParam *chaincfg.Params) ([]*src.Recipient, error)

ParseRecipients Checks all recipients and adds the PkScript based on the given address. Silent Payment addresses are also parsed and the outputs will be computed based on the vins. For that reason this function has to be called after the final coinSelection is done. Otherwise, the SP outputs will NOT be found by the receiver. SP Recipients are always at the end. Hence, the tx must be sorted according to BIP 69 to avoid a specific signature of this wallet.

NOTE: Existing PkScripts will NOT be overridden, those recipients will be skipped and returned as given todo keep original order in case that is relevant for any use case?

func SignPsbt

func SignPsbt(packet *psbt.Packet, vins []*bip352.Vin) error

SignPsbt fails if inputs in packet have a different order than vins

Types

type Daemon

type Daemon struct {
	Status            pb.Status
	Password          []byte
	Locked            bool
	ReadyChan         chan struct{} // for the startup signal; either unlocking or setting password on initial startup
	ShutdownChan      chan struct{}
	Mnemonic          string
	ClientElectrum    *electrum.Client
	ClientBlindBit    *networking.ClientBlindBit
	Wallet            *src.Wallet
	NewBlockChan      <-chan *electrum.SubscribeHeadersResult
	TriggerRescanChan chan uint64
}

func NewDaemon

func NewDaemon(wallet *src.Wallet, clientBlindBit *networking.ClientBlindBit, clientElectrum *electrum.Client) (*Daemon, error)

func (*Daemon) BroadcastTx

func (d *Daemon) BroadcastTx(rawTx []byte) (string, error)

BroadcastTx broadcasts a transaction and returns the txid

func (*Daemon) CheckUnspentUTXOs

func (d *Daemon) CheckUnspentUTXOs() error

CheckUnspentUTXOs checks against electrum whether unspent owned UTXOs are now unspent

func (*Daemon) ContinuousScan

func (d *Daemon) ContinuousScan() error

func (*Daemon) CreateNewKeys

func (d *Daemon) CreateNewKeys(seedPassphrase string) error

CreateNewKeys WARNING: Must only be called if no other wallet is present. Will overwrite the old keys.

func (*Daemon) ForceSyncFrom

func (d *Daemon) ForceSyncFrom(fromHeight uint64) error

func (*Daemon) LoadDataFromDB

func (d *Daemon) LoadDataFromDB() error

LoadDataFromDB Load keys and wallet data from disk

func (*Daemon) LoadTestData

func (d *Daemon) LoadTestData() error

func (*Daemon) MarkSpentUTXOs

func (d *Daemon) MarkSpentUTXOs(blockHeight uint64) error

func (*Daemon) RecoverFromSeed

func (d *Daemon) RecoverFromSeed(mnemonic, seedPassphrase string, birthHeight uint64) error

func (*Daemon) Run

func (d *Daemon) Run() error

func (*Daemon) RunTests

func (d *Daemon) RunTests()

func (*Daemon) SendToRecipients

func (d *Daemon) SendToRecipients(recipients []*src.Recipient, feeRate int64, markSpent, useSpentUnconfirmed bool) ([]byte, error)

SendToRecipients creates a signed transaction that sends to the specified recipients todo should all these functions just be Daemon functions use markSpent to set the used UTXOs to spent_unconfirmed use useSpentUnconfirmed to also include spent_undconfirmed UTXOs in the coinSelection process

func (*Daemon) Shutdown

func (d *Daemon) Shutdown() error

func (*Daemon) SyncToTip

func (d *Daemon) SyncToTip(chainTip uint64) error

Jump to

Keyboard shortcuts

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