database

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB encapsulates a leveldb.DB storage

func New

func New(path string) (*DB, error)

New creates an instance of DB

func (*DB) Clear

func (db *DB) Clear() error

Clear all information from the database.

func (*DB) Close

func (db *DB) Close() error

Close the storage

func (*DB) Delete

func (db *DB) Delete(key []byte) error

Delete an entry identified by the specified key

func (*DB) FetchBalance

func (db *DB) FetchBalance(decryptionKey []byte) (uint64, uint64, error)

FetchBalance calculates the balance

func (*DB) FetchInputs

func (db *DB) FetchInputs(decryptionKey []byte, amount int64) ([]*transactions.Input, int64, error)

FetchInputs fetches transaction inputs amounting to the specified amount. Inputs are decrypted using a decryption key (view key)

func (*DB) FetchTxRecords

func (db *DB) FetchTxRecords() ([]txrecords.TxRecord, error)

FetchTxRecords transaction records

func (*DB) Get

func (db *DB) Get(key []byte) ([]byte, error)

Get a value using a key

func (*DB) GetPubKey

func (db *DB) GetPubKey(keyImage []byte) ([]byte, error)

GetPubKey returns the public key retrieved through the specifie key image

func (*DB) GetWalletHeight

func (db *DB) GetWalletHeight() (uint64, error)

GetWalletHeight returns the height of the blockchain known to the wallet

func (*DB) Put

func (db *DB) Put(key, value []byte) error

Put inserts a key and a value in the storage

func (*DB) PutInput

func (db *DB) PutInput(encryptionKey []byte, pubkey ristretto.Point, amount, mask, privKey ristretto.Scalar, unlockHeight uint64) error

PutInput inserts a UTXO input (i.e. a Ristretto point) in the DB

func (*DB) PutKeyImage

func (db *DB) PutKeyImage(keyImage []byte, outputKey []byte) error

PutKeyImage saves the transaction's key image used to prevent double spending

func (*DB) PutTxRecord

func (db *DB) PutTxRecord(tx transactions.Transaction, direction txrecords.Direction, privView *key.PrivateView) error

PutTxRecord saves the transaction record on the DB

func (*DB) RemoveInput

func (db *DB) RemoveInput(pubkey []byte, keyImage []byte) error

RemoveInput removes a UTXO input from the DB

func (*DB) UpdateLockedInputs

func (db *DB) UpdateLockedInputs(decryptionKey []byte, height uint64) error

UpdateLockedInputs will set the lockheight for an input to 0 if the given `height` is greater or equal than the input lockheight, signifying that this input is unlocked.

func (*DB) UpdateWalletHeight

func (db *DB) UpdateWalletHeight(newHeight uint64) error

UpdateWalletHeight updates the wallet height

Jump to

Keyboard shortcuts

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