Documentation ¶
Index ¶
- type BalanceStorageHandler
- func (h *BalanceStorageHandler) AccountsReconciled(ctx context.Context, dbTx database.Transaction, count int) error
- func (h *BalanceStorageHandler) AccountsSeen(ctx context.Context, dbTx database.Transaction, count int) error
- func (h *BalanceStorageHandler) BlockAdded(ctx context.Context, block *types.Block, changes []*parser.BalanceChange) error
- func (h *BalanceStorageHandler) BlockRemoved(ctx context.Context, block *types.Block, changes []*parser.BalanceChange) error
- type BalanceStorageHelper
- func (h *BalanceStorageHelper) AccountBalance(ctx context.Context, account *types.AccountIdentifier, ...) (*types.Amount, error)
- func (h *BalanceStorageHelper) AccountsReconciled(ctx context.Context, dbTx database.Transaction) (*big.Int, error)
- func (h *BalanceStorageHelper) AccountsSeen(ctx context.Context, dbTx database.Transaction) (*big.Int, error)
- func (h *BalanceStorageHelper) AddInterestingAddress(address string)
- func (h *BalanceStorageHelper) Asserter() *asserter.Asserter
- func (h *BalanceStorageHelper) BalanceExemptions() []*types.BalanceExemption
- func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation
- type BroadcastStorageHandler
- func (h *BroadcastStorageHandler) BroadcastFailed(ctx context.Context, dbTx database.Transaction, identifier string, ...) error
- func (h *BroadcastStorageHandler) TransactionConfirmed(ctx context.Context, dbTx database.Transaction, identifier string, ...) error
- func (h *BroadcastStorageHandler) TransactionStale(ctx context.Context, dbTx database.Transaction, identifier string, ...) error
- type BroadcastStorageHelper
- func (h *BroadcastStorageHelper) AtTip(ctx context.Context, tipDelay int64) (bool, error)
- func (h *BroadcastStorageHelper) BroadcastTransaction(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (*types.TransactionIdentifier, error)
- func (h *BroadcastStorageHelper) CurrentBlockIdentifier(ctx context.Context) (*types.BlockIdentifier, error)
- func (h *BroadcastStorageHelper) FindTransaction(ctx context.Context, transactionIdentifier *types.TransactionIdentifier, ...) (*types.BlockIdentifier, *types.Transaction, error)
- type CoinStorageHelper
- type CoordinatorHandler
- type CoordinatorHelper
- func (c *CoordinatorHelper) AllAccounts(ctx context.Context, dbTx database.Transaction) ([]*types.AccountIdentifier, error)
- func (c *CoordinatorHelper) AllBroadcasts(ctx context.Context) ([]*modules.Broadcast, error)
- func (c *CoordinatorHelper) Balance(ctx context.Context, dbTx database.Transaction, ...) (*types.Amount, error)
- func (c *CoordinatorHelper) Broadcast(ctx context.Context, dbTx database.Transaction, identifier string, ...) error
- func (c *CoordinatorHelper) BroadcastAll(ctx context.Context) error
- func (c *CoordinatorHelper) ClearBroadcasts(ctx context.Context) ([]*modules.Broadcast, error)
- func (c *CoordinatorHelper) Coins(ctx context.Context, dbTx database.Transaction, ...) ([]*types.Coin, error)
- func (c *CoordinatorHelper) Combine(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (string, error)
- func (c *CoordinatorHelper) DatabaseTransaction(ctx context.Context) database.Transaction
- func (c *CoordinatorHelper) Derive(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (*types.AccountIdentifier, map[string]interface{}, error)
- func (c *CoordinatorHelper) GetBlob(ctx context.Context, dbTx database.Transaction, key string) (bool, []byte, error)
- func (c *CoordinatorHelper) GetKey(ctx context.Context, dbTx database.Transaction, ...) (*keys.KeyPair, error)
- func (c *CoordinatorHelper) Hash(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (*types.TransactionIdentifier, error)
- func (c *CoordinatorHelper) HeadBlockExists(ctx context.Context) bool
- func (c *CoordinatorHelper) LockedAccounts(ctx context.Context, dbTx database.Transaction) ([]*types.AccountIdentifier, error)
- func (c *CoordinatorHelper) Metadata(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (map[string]interface{}, []*types.Amount, error)
- func (c *CoordinatorHelper) Parse(ctx context.Context, networkIdentifier *types.NetworkIdentifier, signed bool, ...) ([]*types.Operation, []*types.AccountIdentifier, map[string]interface{}, error)
- func (c *CoordinatorHelper) Payloads(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (string, []*types.SigningPayload, error)
- func (c *CoordinatorHelper) Preprocess(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (map[string]interface{}, []*types.AccountIdentifier, error)
- func (c *CoordinatorHelper) SetBlob(ctx context.Context, dbTx database.Transaction, key string, value []byte) error
- func (c *CoordinatorHelper) Sign(ctx context.Context, payloads []*types.SigningPayload) ([]*types.Signature, error)
- func (c *CoordinatorHelper) StoreKey(ctx context.Context, dbTx database.Transaction, ...) error
- type ReconcilerHandler
- func (h *ReconcilerHandler) ReconciliationExempt(ctx context.Context, reconciliationType string, ...) error
- func (h *ReconcilerHandler) ReconciliationFailed(ctx context.Context, reconciliationType string, ...) error
- func (h *ReconcilerHandler) ReconciliationSkipped(ctx context.Context, reconciliationType string, ...) error
- func (h *ReconcilerHandler) ReconciliationSucceeded(ctx context.Context, reconciliationType string, ...) error
- func (h *ReconcilerHandler) UpdateCounts(ctx context.Context) error
- func (h *ReconcilerHandler) Updater(ctx context.Context) error
- type ReconcilerHelper
- func (h *ReconcilerHelper) CanonicalBlock(ctx context.Context, dbTx database.Transaction, block *types.BlockIdentifier) (bool, error)
- func (h *ReconcilerHelper) ComputedBalance(ctx context.Context, dbTx database.Transaction, ...) (*types.Amount, error)
- func (h *ReconcilerHelper) CurrentBlock(ctx context.Context, dbTx database.Transaction) (*types.BlockIdentifier, error)
- func (h *ReconcilerHelper) DatabaseTransaction(ctx context.Context) database.Transaction
- func (h *ReconcilerHelper) ForceInactiveReconciliation(ctx context.Context, account *types.AccountIdentifier, ...) bool
- func (h *ReconcilerHelper) IndexAtTip(ctx context.Context, index int64) (bool, error)
- func (h *ReconcilerHelper) LiveBalance(ctx context.Context, account *types.AccountIdentifier, ...) (*types.Amount, *types.BlockIdentifier, error)
- func (h *ReconcilerHelper) PruneBalances(ctx context.Context, account *types.AccountIdentifier, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalanceStorageHandler ¶
type BalanceStorageHandler struct {
// contains filtered or unexported fields
}
BalanceStorageHandler is invoked whenever a block is added or removed from block storage so that balance changes can be sent to other functions (ex: reconciler).
func NewBalanceStorageHandler ¶
func NewBalanceStorageHandler( logger *logger.Logger, reconciler *reconciler.Reconciler, counterStorage *modules.CounterStorage, reconcile bool, interestingAccount *types.AccountCurrency, ) *BalanceStorageHandler
NewBalanceStorageHandler returns a new *BalanceStorageHandler.
func (*BalanceStorageHandler) AccountsReconciled ¶
func (h *BalanceStorageHandler) AccountsReconciled( ctx context.Context, dbTx database.Transaction, count int, ) error
AccountsReconciled updates the total accounts reconciled by count.
func (*BalanceStorageHandler) AccountsSeen ¶
func (h *BalanceStorageHandler) AccountsSeen( ctx context.Context, dbTx database.Transaction, count int, ) error
AccountsSeen updates the total accounts seen by count.
func (*BalanceStorageHandler) BlockAdded ¶
func (h *BalanceStorageHandler) BlockAdded( ctx context.Context, block *types.Block, changes []*parser.BalanceChange, ) error
BlockAdded is called whenever a block is committed to BlockStorage.
func (*BalanceStorageHandler) BlockRemoved ¶
func (h *BalanceStorageHandler) BlockRemoved( ctx context.Context, block *types.Block, changes []*parser.BalanceChange, ) error
BlockRemoved is called whenever a block is removed from BlockStorage.
type BalanceStorageHelper ¶
type BalanceStorageHelper struct {
// contains filtered or unexported fields
}
BalanceStorageHelper implements the storage.Helper interface.
func NewBalanceStorageHelper ¶
func NewBalanceStorageHelper( network *types.NetworkIdentifier, fetcher *fetcher.Fetcher, counterStorage *modules.CounterStorage, lookupBalanceByBlock bool, exemptAccounts []*types.AccountCurrency, interestingOnly bool, balanceExemptions []*types.BalanceExemption, initialFetchDisabled bool, ) *BalanceStorageHelper
NewBalanceStorageHelper returns a new BalanceStorageHelper.
func (*BalanceStorageHelper) AccountBalance ¶
func (h *BalanceStorageHelper) AccountBalance( ctx context.Context, account *types.AccountIdentifier, currency *types.Currency, lookupBlock *types.BlockIdentifier, ) (*types.Amount, error)
AccountBalance attempts to fetch the balance for a missing account in storage. This is necessary for running the "check" command at an arbitrary height instead of syncing from genesis.
func (*BalanceStorageHelper) AccountsReconciled ¶
func (h *BalanceStorageHelper) AccountsReconciled( ctx context.Context, dbTx database.Transaction, ) (*big.Int, error)
AccountsReconciled returns the total accounts reconciled by count.
func (*BalanceStorageHelper) AccountsSeen ¶
func (h *BalanceStorageHelper) AccountsSeen( ctx context.Context, dbTx database.Transaction, ) (*big.Int, error)
AccountsSeen returns the total accounts seen by count.
func (*BalanceStorageHelper) AddInterestingAddress ¶
func (h *BalanceStorageHelper) AddInterestingAddress(address string)
AddInterestingAddress adds an address to track the balance of. This is often done after generating an account.
func (*BalanceStorageHelper) Asserter ¶
func (h *BalanceStorageHelper) Asserter() *asserter.Asserter
Asserter returns a *asserter.Asserter.
func (*BalanceStorageHelper) BalanceExemptions ¶
func (h *BalanceStorageHelper) BalanceExemptions() []*types.BalanceExemption
BalanceExemptions returns a list of *types.BalanceExemption.
func (*BalanceStorageHelper) ExemptFunc ¶
func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation
ExemptFunc returns a parser.ExemptOperation.
type BroadcastStorageHandler ¶
type BroadcastStorageHandler struct {
// contains filtered or unexported fields
}
BroadcastStorageHandler is invoked whenever a block is added or removed from block storage so that balance changes can be sent to other functions (ex: reconciler).
func NewBroadcastStorageHandler ¶
func NewBroadcastStorageHandler( config *configuration.Configuration, blockStorage *modules.BlockStorage, counterStorage *modules.CounterStorage, coordinator *coordinator.Coordinator, parser *parser.Parser, ) *BroadcastStorageHandler
NewBroadcastStorageHandler returns a new *BroadcastStorageHandler.
func (*BroadcastStorageHandler) BroadcastFailed ¶
func (h *BroadcastStorageHandler) BroadcastFailed( ctx context.Context, dbTx database.Transaction, identifier string, transactionIdentifier *types.TransactionIdentifier, intent []*types.Operation, ) error
BroadcastFailed is called when another transaction broadcast would put it over the provided broadcast limit.
func (*BroadcastStorageHandler) TransactionConfirmed ¶
func (h *BroadcastStorageHandler) TransactionConfirmed( ctx context.Context, dbTx database.Transaction, identifier string, blockIdentifier *types.BlockIdentifier, transaction *types.Transaction, intent []*types.Operation, intentMetadata map[string]interface{}, ) error
TransactionConfirmed is called when a transaction is observed on-chain for the last time at a block height < current block height - confirmationDepth.
func (*BroadcastStorageHandler) TransactionStale ¶
func (h *BroadcastStorageHandler) TransactionStale( ctx context.Context, dbTx database.Transaction, identifier string, transactionIdentifier *types.TransactionIdentifier, ) error
TransactionStale is called when a transaction has not yet been seen on-chain and is considered stale. This occurs when current block height - last broadcast > staleDepth.
type BroadcastStorageHelper ¶
type BroadcastStorageHelper struct {
// contains filtered or unexported fields
}
BroadcastStorageHelper implements the storage.Helper interface.
func NewBroadcastStorageHelper ¶
func NewBroadcastStorageHelper( network *types.NetworkIdentifier, blockStorage *modules.BlockStorage, fetcher *fetcher.Fetcher, ) *BroadcastStorageHelper
NewBroadcastStorageHelper returns a new BroadcastStorageHelper.
func (*BroadcastStorageHelper) AtTip ¶
AtTip is called before transaction broadcast to determine if we are at tip.
func (*BroadcastStorageHelper) BroadcastTransaction ¶
func (h *BroadcastStorageHelper) BroadcastTransaction( ctx context.Context, networkIdentifier *types.NetworkIdentifier, networkTransaction string, ) (*types.TransactionIdentifier, error)
BroadcastTransaction broadcasts a transaction to a Rosetta implementation and returns the *types.TransactionIdentifier returned by the implementation.
func (*BroadcastStorageHelper) CurrentBlockIdentifier ¶
func (h *BroadcastStorageHelper) CurrentBlockIdentifier( ctx context.Context, ) (*types.BlockIdentifier, error)
CurrentBlockIdentifier is called before transaction broadcast and is used to determine if a transaction broadcast is stale.
func (*BroadcastStorageHelper) FindTransaction ¶
func (h *BroadcastStorageHelper) FindTransaction( ctx context.Context, transactionIdentifier *types.TransactionIdentifier, txn database.Transaction, ) (*types.BlockIdentifier, *types.Transaction, error)
FindTransaction looks for the provided TransactionIdentifier in processed blocks and returns the block identifier containing the most recent sighting and the transaction seen in that block.
type CoinStorageHelper ¶
type CoinStorageHelper struct {
// contains filtered or unexported fields
}
CoinStorageHelper implements the storage.CoinStorageHelper interface.
func NewCoinStorageHelper ¶
func NewCoinStorageHelper(blockStorage *modules.BlockStorage) *CoinStorageHelper
NewCoinStorageHelper returns a new *CoinStorageHelper.
func (*CoinStorageHelper) CurrentBlockIdentifier ¶
func (c *CoinStorageHelper) CurrentBlockIdentifier( ctx context.Context, transaction database.Transaction, ) (*types.BlockIdentifier, error)
CurrentBlockIdentifier returns the head *types.BlockIdentifier in the context of a storage.DatabaseTransaction.
type CoordinatorHandler ¶
type CoordinatorHandler struct {
// contains filtered or unexported fields
}
CoordinatorHandler is invoked by the Coordinator when addresses are created or transactions are created.
func NewCoordinatorHandler ¶
func NewCoordinatorHandler( counterStorage *modules.CounterStorage, ) *CoordinatorHandler
NewCoordinatorHandler returns a new *CoordinatorHandler.
func (*CoordinatorHandler) TransactionCreated ¶
func (h *CoordinatorHandler) TransactionCreated( ctx context.Context, jobIdentifier string, transactionIdentifier *types.TransactionIdentifier, ) error
TransactionCreated increments the TransactionsCreatedCounter in CounterStorage.
type CoordinatorHelper ¶
type CoordinatorHelper struct {
// contains filtered or unexported fields
}
CoordinatorHelper implements the Coordinator.Helper interface.
func NewCoordinatorHelper ¶
func NewCoordinatorHelper( offlineFetcher *fetcher.Fetcher, onlineFetcher *fetcher.Fetcher, database database.Database, blockStorage *modules.BlockStorage, keyStorage *modules.KeyStorage, balanceStorage *modules.BalanceStorage, coinStorage *modules.CoinStorage, broadcastStorage *modules.BroadcastStorage, balanceStorageHelper *BalanceStorageHelper, counterStorage *modules.CounterStorage, quiet bool, ) *CoordinatorHelper
NewCoordinatorHelper returns a new *CoordinatorHelper.
func (*CoordinatorHelper) AllAccounts ¶
func (c *CoordinatorHelper) AllAccounts( ctx context.Context, dbTx database.Transaction, ) ([]*types.AccountIdentifier, error)
AllAccounts returns a slice of all known accounts.
func (*CoordinatorHelper) AllBroadcasts ¶
AllBroadcasts returns a slice of all in-progress broadcasts in BroadcastStorage.
func (*CoordinatorHelper) Balance ¶
func (c *CoordinatorHelper) Balance( ctx context.Context, dbTx database.Transaction, accountIdentifier *types.AccountIdentifier, currency *types.Currency, ) (*types.Amount, error)
Balance returns the balance for a provided address using BalanceStorage. If the address balance does not exist, 0 will be returned.
func (*CoordinatorHelper) Broadcast ¶
func (c *CoordinatorHelper) Broadcast( ctx context.Context, dbTx database.Transaction, identifier string, network *types.NetworkIdentifier, intent []*types.Operation, transactionIdentifier *types.TransactionIdentifier, payload string, confirmationDepth int64, transactionMetadata map[string]interface{}, ) error
Broadcast enqueues a particular intent for broadcast.
func (*CoordinatorHelper) BroadcastAll ¶
func (c *CoordinatorHelper) BroadcastAll( ctx context.Context, ) error
BroadcastAll attempts to broadcast all ready transactions.
func (*CoordinatorHelper) ClearBroadcasts ¶
ClearBroadcasts deletes all pending broadcasts.
func (*CoordinatorHelper) Coins ¶
func (c *CoordinatorHelper) Coins( ctx context.Context, dbTx database.Transaction, accountIdentifier *types.AccountIdentifier, currency *types.Currency, ) ([]*types.Coin, error)
Coins returns all *types.Coin owned by an account.
func (*CoordinatorHelper) Combine ¶
func (c *CoordinatorHelper) Combine( ctx context.Context, networkIdentifier *types.NetworkIdentifier, unsignedTransaction string, signatures []*types.Signature, ) (string, error)
Combine calls the /construction/combine endpoint using the offline node.
func (*CoordinatorHelper) DatabaseTransaction ¶
func (c *CoordinatorHelper) DatabaseTransaction(ctx context.Context) database.Transaction
DatabaseTransaction returns a new write-ready database.Transaction.
func (*CoordinatorHelper) Derive ¶
func (c *CoordinatorHelper) Derive( ctx context.Context, networkIdentifier *types.NetworkIdentifier, publicKey *types.PublicKey, metadata map[string]interface{}, ) (*types.AccountIdentifier, map[string]interface{}, error)
Derive returns a new address for a provided publicKey.
func (*CoordinatorHelper) GetBlob ¶
func (c *CoordinatorHelper) GetBlob( ctx context.Context, dbTx database.Transaction, key string, ) (bool, []byte, error)
GetBlob transactionally retrieves a key and value.
func (*CoordinatorHelper) GetKey ¶
func (c *CoordinatorHelper) GetKey( ctx context.Context, dbTx database.Transaction, account *types.AccountIdentifier, ) (*keys.KeyPair, error)
GetKey is called to get the *types.KeyPair associated with an address.
func (*CoordinatorHelper) Hash ¶
func (c *CoordinatorHelper) Hash( ctx context.Context, networkIdentifier *types.NetworkIdentifier, networkTransaction string, ) (*types.TransactionIdentifier, error)
Hash calls the /construction/hash endpoint using the offline node.
func (*CoordinatorHelper) HeadBlockExists ¶
func (c *CoordinatorHelper) HeadBlockExists(ctx context.Context) bool
HeadBlockExists returns a boolean indicating if a block has been synced by BlockStorage.
func (*CoordinatorHelper) LockedAccounts ¶
func (c *CoordinatorHelper) LockedAccounts( ctx context.Context, dbTx database.Transaction, ) ([]*types.AccountIdentifier, error)
LockedAccounts returns a slice of all accounts currently sending or receiving funds.
func (*CoordinatorHelper) Metadata ¶
func (c *CoordinatorHelper) Metadata( ctx context.Context, networkIdentifier *types.NetworkIdentifier, metadataRequest map[string]interface{}, publicKeys []*types.PublicKey, ) (map[string]interface{}, []*types.Amount, error)
Metadata calls the /construction/metadata endpoint using the online node.
func (*CoordinatorHelper) Parse ¶
func (c *CoordinatorHelper) Parse( ctx context.Context, networkIdentifier *types.NetworkIdentifier, signed bool, transaction string, ) ([]*types.Operation, []*types.AccountIdentifier, map[string]interface{}, error)
Parse calls the /construction/parse endpoint using the offline node.
func (*CoordinatorHelper) Payloads ¶
func (c *CoordinatorHelper) Payloads( ctx context.Context, networkIdentifier *types.NetworkIdentifier, intent []*types.Operation, requiredMetadata map[string]interface{}, publicKeys []*types.PublicKey, ) (string, []*types.SigningPayload, error)
Payloads calls the /construction/payloads endpoint using the offline node.
func (*CoordinatorHelper) Preprocess ¶
func (c *CoordinatorHelper) Preprocess( ctx context.Context, networkIdentifier *types.NetworkIdentifier, intent []*types.Operation, metadata map[string]interface{}, ) (map[string]interface{}, []*types.AccountIdentifier, error)
Preprocess calls the /construction/preprocess endpoint on an offline node.
func (*CoordinatorHelper) SetBlob ¶
func (c *CoordinatorHelper) SetBlob( ctx context.Context, dbTx database.Transaction, key string, value []byte, ) error
SetBlob transactionally persists a key and value.
func (*CoordinatorHelper) Sign ¶
func (c *CoordinatorHelper) Sign( ctx context.Context, payloads []*types.SigningPayload, ) ([]*types.Signature, error)
Sign invokes the KeyStorage backend to sign some payloads.
func (*CoordinatorHelper) StoreKey ¶
func (c *CoordinatorHelper) StoreKey( ctx context.Context, dbTx database.Transaction, account *types.AccountIdentifier, keyPair *keys.KeyPair, ) error
StoreKey stores a KeyPair and address in KeyStorage.
type ReconcilerHandler ¶
type ReconcilerHandler struct { InactiveFailure *types.AccountCurrency InactiveFailureBlock *types.BlockIdentifier ActiveFailureBlock *types.BlockIdentifier // contains filtered or unexported fields }
ReconcilerHandler implements the Reconciler.Handler interface.
func NewReconcilerHandler ¶
func NewReconcilerHandler( logger *logger.Logger, counterStorage *modules.CounterStorage, balanceStorage *modules.BalanceStorage, haltOnReconciliationError bool, ) *ReconcilerHandler
NewReconcilerHandler creates a new ReconcilerHandler.
func (*ReconcilerHandler) ReconciliationExempt ¶
func (h *ReconcilerHandler) ReconciliationExempt( ctx context.Context, reconciliationType string, account *types.AccountIdentifier, currency *types.Currency, computedBalance string, liveBalance string, block *types.BlockIdentifier, exemption *types.BalanceExemption, ) error
ReconciliationExempt is called each time a reconciliation fails but is considered exempt because of provided []*types.BalanceExemption.
func (*ReconcilerHandler) ReconciliationFailed ¶
func (h *ReconcilerHandler) ReconciliationFailed( ctx context.Context, reconciliationType string, account *types.AccountIdentifier, currency *types.Currency, computedBalance string, liveBalance string, block *types.BlockIdentifier, ) error
ReconciliationFailed is called each time a reconciliation fails. In this Handler implementation, we halt if haltOnReconciliationError was set to true. We also cancel the context.
func (*ReconcilerHandler) ReconciliationSkipped ¶
func (h *ReconcilerHandler) ReconciliationSkipped( ctx context.Context, reconciliationType string, account *types.AccountIdentifier, currency *types.Currency, cause string, ) error
ReconciliationSkipped is called each time a reconciliation is skipped.
func (*ReconcilerHandler) ReconciliationSucceeded ¶
func (h *ReconcilerHandler) ReconciliationSucceeded( ctx context.Context, reconciliationType string, account *types.AccountIdentifier, currency *types.Currency, balance string, block *types.BlockIdentifier, ) error
ReconciliationSucceeded is called each time a reconciliation succeeds.
func (*ReconcilerHandler) UpdateCounts ¶
func (h *ReconcilerHandler) UpdateCounts(ctx context.Context) error
UpdateCounts forces cached counts to be written to modules.
type ReconcilerHelper ¶
type ReconcilerHelper struct {
// contains filtered or unexported fields
}
ReconcilerHelper implements the Reconciler.Helper interface.
func NewReconcilerHelper ¶
func NewReconcilerHelper( config *configuration.Configuration, network *types.NetworkIdentifier, fetcher *fetcher.Fetcher, database database.Database, blockStorage *modules.BlockStorage, balanceStorage *modules.BalanceStorage, forceInactiveReconciliation *bool, ) *ReconcilerHelper
NewReconcilerHelper returns a new ReconcilerHelper.
func (*ReconcilerHelper) CanonicalBlock ¶
func (h *ReconcilerHelper) CanonicalBlock( ctx context.Context, dbTx database.Transaction, block *types.BlockIdentifier, ) (bool, error)
CanonicalBlock returns a boolean indicating if a block is in the canonical chain. This is necessary to reconcile across reorgs. If the block returned on an account balance fetch does not exist, reconciliation will be skipped.
func (*ReconcilerHelper) ComputedBalance ¶
func (h *ReconcilerHelper) ComputedBalance( ctx context.Context, dbTx database.Transaction, account *types.AccountIdentifier, currency *types.Currency, index int64, ) (*types.Amount, error)
ComputedBalance returns the balance of an account in block storage. It is necessary to perform this check outside of the Reconciler package to allow for separation from a default storage backend.
func (*ReconcilerHelper) CurrentBlock ¶
func (h *ReconcilerHelper) CurrentBlock( ctx context.Context, dbTx database.Transaction, ) (*types.BlockIdentifier, error)
CurrentBlock returns the last processed block and is used to determine which block to check account balances at during inactive reconciliation.
func (*ReconcilerHelper) DatabaseTransaction ¶
func (h *ReconcilerHelper) DatabaseTransaction( ctx context.Context, ) database.Transaction
DatabaseTransaction returns a new read-only database.Transaction.
func (*ReconcilerHelper) ForceInactiveReconciliation ¶
func (h *ReconcilerHelper) ForceInactiveReconciliation( ctx context.Context, account *types.AccountIdentifier, currency *types.Currency, lastChecked *types.BlockIdentifier, ) bool
ForceInactiveReconciliation overrides the default calculation to determine if an account should be reconciled inactively.
func (*ReconcilerHelper) IndexAtTip ¶
IndexAtTip returns a boolean indicating if a block index is at tip (provided some acceptable tip delay). If the index is ahead of the head block and the head block is at tip, we consider the index at tip.
func (*ReconcilerHelper) LiveBalance ¶
func (h *ReconcilerHelper) LiveBalance( ctx context.Context, account *types.AccountIdentifier, currency *types.Currency, index int64, ) (*types.Amount, *types.BlockIdentifier, error)
LiveBalance returns the live balance of an account.
func (*ReconcilerHelper) PruneBalances ¶
func (h *ReconcilerHelper) PruneBalances( ctx context.Context, account *types.AccountIdentifier, currency *types.Currency, index int64, ) error
PruneBalances removes all historical balance states <= some index. This can significantly reduce storage usage in scenarios where historical balances are only retrieved once (like reconciliation).