Documentation ¶
Index ¶
- Constants
- Variables
- type BTCConfig
- type BTCTransitionContext
- type LockScriptStore
- type Tracker
- func (t *Tracker) AddSignature(signatureBytes []byte, addr keys.Address) error
- func (t *Tracker) GetAddress() ([]byte, error)
- func (t *Tracker) GetBalance() int64
- func (t *Tracker) GetBalanceSatoshi() int64
- func (t *Tracker) GetJobID(state TrackerState) string
- func (t *Tracker) GetSignatures() [][]byte
- func (t *Tracker) HasEnoughSignatures() bool
- func (t *Tracker) HasVotedFinality(addr keys.Address) bool
- func (t *Tracker) IsAvailable() bool
- func (t *Tracker) IsBusy() bool
- func (t Tracker) NextStep() string
- func (t *Tracker) ProcessLock(newUTXO *UTXO, txn []byte, validatorsPubKeys []keys.Address) error
- func (t *Tracker) StateChangeBroadcast() bool
- type TrackerState
- type TrackerStore
- func (ts *TrackerStore) Get(name string) (*Tracker, error)
- func (ts *TrackerStore) GetConfig() BTCConfig
- func (ts *TrackerStore) GetLockScript(lockAddress []byte) ([]byte, error)
- func (ts *TrackerStore) GetMaxAvailableBalance() int64
- func (ts *TrackerStore) GetOption() bitcoin.ChainDriverOption
- func (ts *TrackerStore) GetTrackerForLock() (*Tracker, error)
- func (ts *TrackerStore) GetTrackerForRedeem() (*Tracker, error)
- func (ts *TrackerStore) Iterate(fn func(k, v []byte) bool)
- func (ts *TrackerStore) SetConfig(config BTCConfig)
- func (ts *TrackerStore) SetLockScript(lockAddress, lockScript []byte) error
- func (ts *TrackerStore) SetOption(option bitcoin.ChainDriverOption)
- func (ts *TrackerStore) SetTracker(name string, tracker *Tracker) error
- func (ts *TrackerStore) WithState(state *storage.State) *TrackerStore
- type UTXO
Constants ¶
View Source
const ( RESERVE = "reserveTracker" FREEZE_FOR_BROADCAST = "freezeForBroadcast" REPORT_BROADCAST = "reportBroadcastSuccess" CLEANUP = "cleanup" )
View Source
const ( ProcessTypeNone = 0x00 ProcessTypeLock = 0x01 ProcessTypeRedeem = 0x02 )
Variables ¶
View Source
var ( ErrTrackerBusy = errors.New("tracker is busy") ErrTrackerNotCollectionSignatures = errors.New("tracker not collecting signatures") )
View Source
var (
ErrTrackerNotFound = errors.New("tracker not found")
)
View Source
var NilTxHash *chainhash.Hash
Functions ¶
This section is empty.
Types ¶
type BTCConfig ¶ added in v0.14.0
type BTCConfig struct { BTCAddress string BTCRPCPort string BTCRPCUsername string BTCRPCPassword string BTCChainnet string BTCParams *chaincfg.Params BlockCypherToken string BlockCypherChainType string }
func NewBTCConfig ¶ added in v0.14.0
func NewBTCConfig(cfg *config.ChainDriverConfig, chainType string) BTCConfig
type BTCTransitionContext ¶
type BTCTransitionContext struct { Tracker *Tracker JobStore *jobs.JobStore Validators *identity.ValidatorStore }
func NewTrackerCtx ¶
func NewTrackerCtx(tracker *Tracker, js *jobs.JobStore, vs *identity.ValidatorStore) *BTCTransitionContext
type LockScriptStore ¶
type LockScriptStore struct { storage.SessionedStorage // contains filtered or unexported fields }
func NewLockScriptStore ¶
func NewLockScriptStore(config config.Server, dbDir string) *LockScriptStore
func (*LockScriptStore) GetLockScript ¶
func (ls *LockScriptStore) GetLockScript(lockScriptAddress []byte) ([]byte, error)
func (*LockScriptStore) SaveLockScript ¶
func (ls *LockScriptStore) SaveLockScript(lockScriptAddress, lockScript []byte) error
type Tracker ¶
type Tracker struct { Name string // Multisig manages the signature collection and storage in a distributed way Multisig *keys.BTCMultiSig `json:"multisig"` // State tracks the current state of the tracker, Also used for locking distributed access State TrackerState `json:"state"` // Is the transaction ID of the latest UTXO that has all the tracker bitcoin CurrentTxId *chainhash.Hash // the balance of the latest UTXO in satoshi (10^-8 BTC) CurrentBalance int64 CurrentLockScriptAddress []byte ProcessTxId *chainhash.Hash ProcessBalance int64 ProcessLockScriptAddress []byte ProcessUnsignedTx []byte ProcessOwner keys.Address ProcessType int // validator addresses who have voted to finalize the current in process transaction FinalityVotes []keys.Address // validator addresses who have voted to reset the current in process transaction ResetVotes []keys.Address }
Tracker
func NewTracker ¶
func (*Tracker) AddSignature ¶
func (*Tracker) GetAddress ¶
func (*Tracker) GetBalance ¶
func (*Tracker) GetBalanceSatoshi ¶
GetBalance gets the current balance of the utxo tracker
func (*Tracker) GetJobID ¶
func (t *Tracker) GetJobID(state TrackerState) string
func (*Tracker) GetSignatures ¶
func (*Tracker) HasEnoughSignatures ¶
func (*Tracker) IsAvailable ¶
IsAvailable returns whether the tracker is available for new transaction
func (*Tracker) ProcessLock ¶
func (*Tracker) StateChangeBroadcast ¶
type TrackerState ¶
type TrackerState int
const ( Available TrackerState = iota Requested BusySigning BusyScheduleBroadcasting BusyBroadcasting BusyScheduleFinalizing BusyFinalizing Finalized )
type TrackerStore ¶
func NewTrackerStore ¶
func NewTrackerStore(prefix string, state *storage.State) *TrackerStore
func (*TrackerStore) GetConfig ¶ added in v0.14.0
func (ts *TrackerStore) GetConfig() BTCConfig
func (*TrackerStore) GetLockScript ¶
func (ts *TrackerStore) GetLockScript(lockAddress []byte) ([]byte, error)
func (*TrackerStore) GetMaxAvailableBalance ¶ added in v0.14.0
func (ts *TrackerStore) GetMaxAvailableBalance() int64
func (*TrackerStore) GetOption ¶ added in v0.14.0
func (ts *TrackerStore) GetOption() bitcoin.ChainDriverOption
func (*TrackerStore) GetTrackerForLock ¶
func (ts *TrackerStore) GetTrackerForLock() (*Tracker, error)
func (*TrackerStore) GetTrackerForRedeem ¶
func (ts *TrackerStore) GetTrackerForRedeem() (*Tracker, error)
func (*TrackerStore) Iterate ¶
func (ts *TrackerStore) Iterate(fn func(k, v []byte) bool)
func (*TrackerStore) SetConfig ¶ added in v0.14.0
func (ts *TrackerStore) SetConfig(config BTCConfig)
func (*TrackerStore) SetLockScript ¶
func (ts *TrackerStore) SetLockScript(lockAddress, lockScript []byte) error
func (*TrackerStore) SetOption ¶ added in v0.14.0
func (ts *TrackerStore) SetOption(option bitcoin.ChainDriverOption)
func (*TrackerStore) SetTracker ¶
func (ts *TrackerStore) SetTracker(name string, tracker *Tracker) error
func (*TrackerStore) WithState ¶
func (ts *TrackerStore) WithState(state *storage.State) *TrackerStore
WithState updates the storage state of the tracker and returns the tracker address back
Click to show internal directories.
Click to hide internal directories.