alliance

package
v0.0.0-...-37869b2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_RETURN_SCRIPT_FLAG = byte(0x66)
	BTC_CHAINID           = 0
	MIN_FEE               = 100
)

Variables

View Source
var (
	BKTWaiting = []byte("Waiting")
	BKTVoted   = []byte("voted")
	BKTHeight  = []byte("last")
	KEYHeight  = []byte("last")
)

Functions

func GetAccountByPassword

func GetAccountByPassword(sdk *sdk.MultiChainSdk, path, pwd string) (*sdk.Account, error)

Types

type Checkpoint

type Checkpoint struct {
	Height uint32
}

type LessConfirmationError

type LessConfirmationError struct {
	Err error
}

func (LessConfirmationError) Error

func (err LessConfirmationError) Error() string

func (*LessConfirmationError) String

func (err *LessConfirmationError) String() string

type Observer

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

func NewObserver

func NewObserver(allia *sdk.MultiChainSdk, voting chan *btc.BtcProof, txchan chan *ToSignItem, loopWaitTime int64,
	watchingKey, watchingMakeTxKey, netType string, db *WaitingDB, circle uint32) *Observer

func (*Observer) Listen

func (ob *Observer) Listen()

type OverSizeErr

type OverSizeErr struct {
	Err error
}

func (OverSizeErr) Error

func (err OverSizeErr) Error() string

type Signer

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

func NewSigner

func NewSigner(privkFile string, txchan chan *ToSignItem, acct *sdk.Account, allia *sdk.MultiChainSdk,
	params *chaincfg.Params) (*Signer, error)

func (*Signer) Signing

func (signer *Signer) Signing()

type ToSignItem

type ToSignItem struct {
	Mtx    *wire.MsgTx
	Redeem []byte
}

type ToVoteItem

type ToVoteItem struct {
	MsgTx        *wire.MsgTx
	Height       uint32
	Proof        []byte
	BlocksToWait uint64
}

type Voter

type Voter struct {
	WaitingDB *WaitingDB
	// contains filtered or unexported fields
}

func NewVoter

func NewVoter(allia *sdk.MultiChainSdk, voting chan *btc.BtcProof, wallet *spvclient.SPVWallet, redeem []byte,
	acct *sdk.Account, wdb *WaitingDB, blksToWait uint64) (*Voter, error)

func (*Voter) Restart

func (v *Voter) Restart(wallet *spvclient.SPVWallet)

func (*Voter) Stop

func (v *Voter) Stop()

func (*Voter) Vote

func (v *Voter) Vote()

func (*Voter) WaitingRetry

func (v *Voter) WaitingRetry()

type WaitingDB

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

func NewWaitingDB

func NewWaitingDB(filePath string, maxReadSize int64) (*WaitingDB, error)

func (*WaitingDB) CheckIfVoted

func (w *WaitingDB) CheckIfVoted(txid []byte) bool

func (*WaitingDB) CheckIfWaiting

func (w *WaitingDB) CheckIfWaiting(txid []byte) bool

func (*WaitingDB) Close

func (w *WaitingDB) Close()

func (*WaitingDB) DelIfExist

func (w *WaitingDB) DelIfExist(txid []byte) bool

func (*WaitingDB) Get

func (w *WaitingDB) Get(txid []byte) (p *btc.BtcProof, err error)

func (*WaitingDB) GetHeight

func (w *WaitingDB) GetHeight() uint32

func (*WaitingDB) GetUnderHeightAndDelete

func (w *WaitingDB) GetUnderHeightAndDelete(height uint32) ([]*btc.BtcProof, [][]byte, error)

func (*WaitingDB) MarkVotedTx

func (w *WaitingDB) MarkVotedTx(txid []byte) error

func (*WaitingDB) Put

func (w *WaitingDB) Put(txid []byte, item *btc.BtcProof) error

func (*WaitingDB) SetHeight

func (w *WaitingDB) SetHeight(height uint32) error

Jump to

Keyboard shortcuts

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