accountstable

package
v0.0.0-...-f0b43a4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExchangeAndUpdateAccounts

func ExchangeAndUpdateAccounts(dbConnection *sql.DB, c *contracts.Contract) error

Deduct value from sender's balance Add value to recipient's balance Increment both nonces by 1

func GetAccountInfo

func GetAccountInfo(dbConnection *sql.DB, pkhash []byte) (*accountinfo.AccountInfo, error)

func GetBalance

func GetBalance(dbConnection *sql.DB, pkhash []byte) (uint64, error)

func GetStateNonce

func GetStateNonce(dbConnection *sql.DB, pkhash []byte) (uint64, error)

func InsertAccountIntoAccountBalanceTable

func InsertAccountIntoAccountBalanceTable(dbConnection *sql.DB, pkhash []byte, value uint64) error

Insert into account balance table Value set to value paramter Nonce set to zero Public Key Hash insert into pkhash column

Return every error possible with an explicit message

func MintAurumUpdateAccountBalanceTable

func MintAurumUpdateAccountBalanceTable(dbConnection *sql.DB, pkhash []byte, value uint64) error

Add value to pkhash's balanace Increment nonce by 1

func UpdateAccountTable

func UpdateAccountTable(db *sql.DB, b *block.Block) error

calculates and inserts accounts' balance and nonce into the account balance table

NOTE: the db connection passed in should be open

Types

type Connection

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

Connection struct used receiver call on a sql.DB with mutex support

func (*Connection) ExchangeAndUpdateAccounts

func (c *Connection) ExchangeAndUpdateAccounts(contract *contracts.Contract) error

ExchangeAndUpdateAccounts calls Connection.ExchangeAndUpdateAccounts using struct connection

func (*Connection) GetAccountInfo

func (c *Connection) GetAccountInfo(pkhash []byte) (*accountinfo.AccountInfo, error)

GetAccountInfo calls Connection.GetAccountInfo using struct connection

func (*Connection) GetBalance

func (c *Connection) GetBalance(pkhash []byte) (uint64, error)

GetBalance locks access and calls Connection.GetBalance using struct connection

func (*Connection) GetStateNonce

func (c *Connection) GetStateNonce(pkhash []byte) (uint64, error)

GetStateNonce calls Connection.GetStateNonce using struct connection

func (*Connection) InsertAccountIntoAccountBalanceTable

func (c *Connection) InsertAccountIntoAccountBalanceTable(pkhash []byte, value uint64) error

InsertAccountIntoAccountBalanceTable calls Connection.InsertAccountIntoAccountBalanaceTable using struct connection

func (*Connection) Lock

func (c *Connection) Lock()

Lock locks Connection for writing. If the lock is already locked for writing, Lock blocks until the lock is available.

func (*Connection) MintAurumUpdateAccountBalanceTable

func (c *Connection) MintAurumUpdateAccountBalanceTable(pkhash []byte, value uint64) error

MintAurumUpdateAccountBalanceTable calls Connection.MintAurumUpdateAccountBalanceTable using struct connection

func (*Connection) Unlock

func (c *Connection) Unlock()

Unlock unlocks Connection for writing. It is a run-time error if at is not locked for writing on entry to Unlock.

func (*Connection) UpdateAccountTable

func (c *Connection) UpdateAccountTable(b *block.Block) error

UpdateAccountTable calls Connection.UpdateAccountTable using struct connection

Jump to

Keyboard shortcuts

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