Documentation ¶
Index ¶
- Constants
- func GetAsgardAddress(chain common.Chain, bridge thorclient.ThorchainBridge) ([]common.Address, error)
- func GetConfMulBasisPoint(chain string, bridge thorclient.ThorchainBridge) (cosmos.Uint, error)
- func MaxConfAdjustment(confirm uint64, chain string, bridge thorclient.ThorchainBridge) (uint64, error)
- func PostKeysignFailure(thorchainBridge thorclient.ThorchainBridge, tx stypes.TxOutItem, ...) error
- type BlockMeta
- type PruneBlockMetaFunc
- type SignCheckpoint
- type TemporalStorage
- func (t *TemporalStorage) GetBlockMeta(height int64) (*BlockMeta, error)
- func (t *TemporalStorage) GetBlockMetas() ([]*BlockMeta, error)
- func (t *TemporalStorage) GetTransactionFee() (float64, int32, error)
- func (t *TemporalStorage) PruneBlockMeta(height int64, filter PruneBlockMetaFunc) error
- func (t *TemporalStorage) SaveBlockMeta(height int64, blockMeta *BlockMeta) error
- func (t *TemporalStorage) TrackMempoolTx(txid string) (bool, error)
- func (t *TemporalStorage) TrackObservedTx(txid string) (bool, error)
- func (t *TemporalStorage) UntrackMempoolTx(txid string) error
- func (t *TemporalStorage) UntrackObservedTx(txid string) error
- func (t *TemporalStorage) UpsertTransactionFee(fee float64, vSize int32) error
- type TransactionFee
Constants ¶
const ( // TransactionFeeKey is the LevelDB key used to store the transaction fee of the most // recent signed transaction. // TODO: trailing "-" should be removed, will this cause issues with active bifrosts? TransactionFeeKey = "transactionfee-" // PrefixBlockMeta is the LevelDB key prefix used for storing BlockMeta. The height of // the block is appended for the final key. PrefixBlockMeta = "blockmeta-" // PrefixMempool is the LevelDB key prefix used for storing transactions in the // mempool. The hash of the transaction is appended for the final key. PrefixMempool = "mempool-" // PrefixObservedTx is the LevelDB key prefix used for storing observed transactions. // The hash of the transaction is appended for the final key. PrefixObservedTx = "observed-" )
Variables ¶
This section is empty.
Functions ¶
func GetAsgardAddress ¶ added in v1.112.0
func GetAsgardAddress(chain common.Chain, bridge thorclient.ThorchainBridge) ([]common.Address, error)
func GetConfMulBasisPoint ¶ added in v1.125.0
func GetConfMulBasisPoint(chain string, bridge thorclient.ThorchainBridge) (cosmos.Uint, error)
func MaxConfAdjustment ¶ added in v1.125.0
func MaxConfAdjustment(confirm uint64, chain string, bridge thorclient.ThorchainBridge) (uint64, error)
func PostKeysignFailure ¶ added in v1.100.0
func PostKeysignFailure( thorchainBridge thorclient.ThorchainBridge, tx stypes.TxOutItem, logger zerolog.Logger, thorchainHeight int64, utxoErr error, ) error
Types ¶
type BlockMeta ¶
type BlockMeta struct { Height int64 `json:"height"` PreviousHash string `json:"previous_hash"` BlockHash string `json:"block_hash"` // SelfTransactions records txids that our vaults have broadcast. SelfTransactions []string `json:"self_transactions,omitempty"` // CustomerTransactions records txids that our vaults have received. CustomerTransactions []string `json:"customer_transactions,omitempty"` }
BlockMeta contains a subset of meta information about a block relevant to Bifrost's book keeping of pending operations.
func NewBlockMeta ¶
func (*BlockMeta) AddCustomerTransaction ¶
AddCustomerTransaction adds the provided txid to the BlockMeta customer transactions.
func (*BlockMeta) AddSelfTransaction ¶
AddSelfTransaction adds the provided txid to the BlockMeta self transactions.
func (*BlockMeta) RemoveCustomerTransaction ¶
RemoveCustomerTransaction removes the provided txid from the BlockMeta customer transactions.
func (*BlockMeta) TransactionHashExists ¶
TransactionHashExist returns true if the txid exists in either the self or customer transactions for the BlockMeta.
type PruneBlockMetaFunc ¶
PruneBlockMetaFunc defines a function type that is used to prune blocks from temporal storage. The function should return true if the block is eligible for pruning.
type SignCheckpoint ¶ added in v1.109.0
type SignCheckpoint struct { UnsignedTx []byte `json:"unsigned_tx"` IndividualAmounts map[string]int64 `json:"individual_amounts"` }
SignCheckpoint is used to checkpoint the built transaction before signing, for use in round 7 signing errors which must reuse the same inputs.
type TemporalStorage ¶
type TemporalStorage struct {
// contains filtered or unexported fields
}
TemporalStorage provides persistent storage of block and transaction data over a window of recent time. This is used to track transactions we have sent, during re-org processing, and to ensure duplicate observations are not posted to Thorchain which could result in bond slash.
func NewTemporalStorage ¶
func NewTemporalStorage(db *leveldb.DB, txidCacheSize int) (*TemporalStorage, error)
func (*TemporalStorage) GetBlockMeta ¶
func (t *TemporalStorage) GetBlockMeta(height int64) (*BlockMeta, error)
GetBlockMeta returns the BlockMeta at the provided height. Note that if the BlockMeta for the requested height is not found, we will return nil with nil error.
func (*TemporalStorage) GetBlockMetas ¶
func (t *TemporalStorage) GetBlockMetas() ([]*BlockMeta, error)
GetBlockMetas returns all the block metas in storage.
func (*TemporalStorage) GetTransactionFee ¶
func (t *TemporalStorage) GetTransactionFee() (float64, int32, error)
GetTransactionFee returns the last transaction fee written to storage.
func (*TemporalStorage) PruneBlockMeta ¶
func (t *TemporalStorage) PruneBlockMeta(height int64, filter PruneBlockMetaFunc) error
PruneBlockMeta removes all BlockMetas that are older than the provided block height and pass the provided filter function. Consumers should provide a function for the filter to ensure there are no transactions in the mempool corresponding to the block.
func (*TemporalStorage) SaveBlockMeta ¶
func (t *TemporalStorage) SaveBlockMeta(height int64, blockMeta *BlockMeta) error
SaveBlockMeta will store the provided BlockMeta at the provided height.
func (*TemporalStorage) TrackMempoolTx ¶
func (t *TemporalStorage) TrackMempoolTx(txid string) (bool, error)
TrackMempoolTx attempts to track the provided mempool txid. Returns true if the txid was successfully added, and false if the txid was already tracked or an error occurred during write.
func (*TemporalStorage) TrackObservedTx ¶
func (t *TemporalStorage) TrackObservedTx(txid string) (bool, error)
TrackObservedTx attempts to track the provided observed txid. Returns true if the txid was successfully added, and false if the txid was already tracked or an error occurred during write.
func (*TemporalStorage) UntrackMempoolTx ¶
func (t *TemporalStorage) UntrackMempoolTx(txid string) error
UntrackMempoolTx untracks the provided mempool txid.
func (*TemporalStorage) UntrackObservedTx ¶
func (t *TemporalStorage) UntrackObservedTx(txid string) error
UntrackObservedTx untracks the provided observed txid.
func (*TemporalStorage) UpsertTransactionFee ¶
func (t *TemporalStorage) UpsertTransactionFee(fee float64, vSize int32) error
UpsertTransactionFee sets the latest transaction fee, overwriting any existing value.
type TransactionFee ¶
type TransactionFee struct { // Fee is the transaction fee in the chain asset. Fee float64 `json:"fee"` // VSize is the estimated vbytes of the transaction. On chains with no concept of // transaction weight, this is simply the estimated byte size of the transaction. VSize int32 `json:"v_size"` }
TransactionFee represents the transaction fee on a UTXO chain.