viewer

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOwnerAddressInvalid error = errors.New("owner address invalid")
	ErrHashListEmpty       error = errors.New("hash list is empty")
	ErrNonTransaction      error = errors.New("no transaction found")
	ErrNonceNotExist       error = errors.New("nonce not exist")
	ErrNonceInvalid        error = errors.New("user nonce invalid")
)

Functions

func GetAllTransactionCount

func GetAllTransactionCount(ownerStr, symbol, status, typ string) (int, error)

func GetAllTransactions

func GetAllTransactions(owner, symbol, status, typ string, limit, offset int) ([]txtyp.TransactionJsonResult, error)

func GetNonce

func GetNonce(owner string) (*big.Int, error)

func GetPendingTransactions

func GetPendingTransactions(owner string) ([]txtyp.TransactionJsonResult, error)

func GetTransactionsByHash

func GetTransactionsByHash(owner string, hashList []string) ([]txtyp.TransactionJsonResult, error)

func NewTxView

func NewTxView(db *dao.RdsService)

todo(fuk): 在分布式锁以及wallet_service事件通知推送落地后使用redis缓存(当前版本暂时不考虑redis),考虑到分叉及用户tx总量, 缓存应该有三个数据类型: 1. user key 存储用户pengding&mined first page transactions,设置过期时间 2. user tx number key存储某个用户所有tx数量的key,设置过期时间 3. block key 存储某个block涉及到的用户key(用于分叉),设置过期时间

func ValidateNonce

func ValidateNonce(owner string, nonce *big.Int) error

Types

type TransactionViewer

type TransactionViewer interface {
	GetPendingTransactions(owner string) ([]txtyp.TransactionJsonResult, error)
	GetAllTransactionCount(owner, symbol, status, typ string) (int, error)
	GetAllTransactions(owner, symbol, status, typ string, limit, offset int) ([]txtyp.TransactionJsonResult, error)
	GetTransactionsByHash(owner string, hashList []string) ([]txtyp.TransactionJsonResult, error)
	GetNonce(owner string) (*big.Int, error)
	ValidateNonce(owner string, nonce *big.Int) error
}

type TransactionViewerImpl

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

func (*TransactionViewerImpl) GetAllTransactionCount

func (impl *TransactionViewerImpl) GetAllTransactionCount(ownerStr, symbolStr, statusStr, typStr string) (int, error)

func (*TransactionViewerImpl) GetAllTransactions

func (impl *TransactionViewerImpl) GetAllTransactions(ownerStr, symbolStr, statusStr, typStr string, limit, offset int) ([]txtyp.TransactionJsonResult, error)

func (*TransactionViewerImpl) GetNonce

func (impl *TransactionViewerImpl) GetNonce(ownerStr string) (*big.Int, error)

返回用户处于success/pending状态下的nonce值

func (*TransactionViewerImpl) GetPendingTransactions

func (impl *TransactionViewerImpl) GetPendingTransactions(ownerStr string) ([]txtyp.TransactionJsonResult, error)

func (*TransactionViewerImpl) GetTransactionsByHash

func (impl *TransactionViewerImpl) GetTransactionsByHash(ownerStr string, hashList []string) ([]txtyp.TransactionJsonResult, error)

func (*TransactionViewerImpl) ValidateNonce

func (impl *TransactionViewerImpl) ValidateNonce(ownerStr string, nonce *big.Int) error

校验用户nonce是否可用,用户提交的pending tx nonce值不允许小于已经成功了的tx nonce值

Jump to

Keyboard shortcuts

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