deniability

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

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("denial not found")

ErrNotFound is returned when no denial matches the ID and state of the call.

Functions

func Cancel

func Cancel(ctx context.Context, db *sql.DB, id int64, reason string) error

func Pause

func Pause(ctx context.Context, db *sql.DB, id int64) error

func RecordExecution

func RecordExecution(ctx context.Context, db *sql.DB, denialID int64, fromTxID string, fromVout int32, toTxID string, toVout uint32) error

RecordExecution records a completed denial transaction

func Resume

func Resume(ctx context.Context, db *sql.DB, id int64) error

Resume resumes a paused deniability plan

func Update

func Update(ctx context.Context, db *sql.DB, id int64, delay time.Duration, numHops int32, targetSizes TargetSizes, txid string, vout int32) error

Update adds numHops to a plan, sets its delay and target sizes, moves its start to txid:vout and clears its cancel.

Types

type Denial

type Denial struct {
	ID              int64         `db:"id"`
	WalletID        *string       `db:"wallet_id"`
	TipTXID         string        `db:"tip_txid"`
	TipVout         int32         `db:"tip_vout"`
	DelayDuration   time.Duration `db:"delay_duration"`
	NumHops         int32         `db:"num_hops"`
	TargetUTXOSizes TargetSizes   `db:"target_utxo_sizes"`
	CreatedAt       time.Time     `db:"created_at"`
	UpdatedAt       time.Time     `db:"updated_at"`
	CancelledAt     *time.Time    `db:"cancelled_at"`
	CancelReason    *string       `db:"cancelled_reason"`
	PausedAt        *time.Time    `db:"paused_at"`
	NextExecution   *time.Time
	ExecutedDenials []ExecutedDenial
}

func Create

func Create(ctx context.Context, db *sql.DB, walletID string, txid string, vout int32, delayDuration time.Duration, numHops int32, targetUTXOSizes []int64) (Denial, error)

func Get

func Get(ctx context.Context, db *sql.DB, id int64) (Denial, error)

func GetByTip

func GetByTip(ctx context.Context, db *sql.DB, tipTxID string, tipVout *int32) (*Denial, error)

func List

func List(ctx context.Context, db *sql.DB, opts ...Option) ([]Denial, error)

type ExecutedDenial

type ExecutedDenial struct {
	ID        int64     `db:"id"`
	DenialID  int64     `db:"denial_id"`
	FromTxID  string    `db:"from_txid"`
	FromVout  int32     `db:"from_vout"`
	ToTxID    string    `db:"to_txid"`
	CreatedAt time.Time `db:"created_at"`
}

type Option

type Option func(c *config)

func WithExcludeCancelled

func WithExcludeCancelled() Option

type TargetSizes

type TargetSizes []int64

TargetSizes holds the UTXO sizes to create, one per hop. The database stores them as comma-separated text.

func (*TargetSizes) Scan

func (t *TargetSizes) Scan(src any) error

func (TargetSizes) Value

func (t TargetSizes) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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