Documentation ¶
Index ¶
- Variables
- func BumpGas(config orm.ConfigReader, originalGasPrice *big.Int) *big.Int
- func FatalSendError(e error) *sendError
- func FindEthTxsRequiringNewAttempt(db *gorm.DB, blockNum int64, gasBumpThreshold int64) ([]models.EthTx, error)
- func GetNextNonce(db *gorm.DB, address gethCommon.Address) (int64, error)
- func IncrementNextNonce(db *gorm.DB, address gethCommon.Address, currentNonce int64) error
- func NewEthConfirmer(store *store.Store, config orm.ConfigReader) *ethConfirmer
- func NewFatalSendError(s string) *sendError
- func NewSendError(s string) *sendError
- func SendError(e error) *sendError
- func SendEther(s *strpkg.Store, from, to gethCommon.Address, value assets.Eth) (models.EthTx, error)
- type EthBroadcaster
- type EthConfirmer
Constants ¶
This section is empty.
Variables ¶
var (
// ErrExternalWalletUsedNonce is the error string we save if we come to the conclusion that the transaction nonce was used by an external account
ErrExternalWalletUsedNonce = "external wallet used nonce"
)
Functions ¶
func BumpGas ¶
BumpGas returns a new gas price increased by the largest of: - A configured percentage bump (ETH_GAS_BUMP_PERCENT) - A configured fixed amount of Wei (ETH_GAS_PRICE_WEI) - The configured default base gas price (ETH_GAS_PRICE_DEFAULT)
func FatalSendError ¶
func FatalSendError(e error) *sendError
func FindEthTxsRequiringNewAttempt ¶
func FindEthTxsRequiringNewAttempt(db *gorm.DB, blockNum int64, gasBumpThreshold int64) ([]models.EthTx, error)
FindEthTxsRequiringNewAttempt returns transactions that have all attempts which are unconfirmed for at least gasBumpThreshold blocks
func GetNextNonce ¶
GetNextNonce returns keys.next_nonce for the given address
func IncrementNextNonce ¶
IncrementNextNonce increments keys.next_nonce by 1
func NewEthConfirmer ¶
func NewEthConfirmer(store *store.Store, config orm.ConfigReader) *ethConfirmer
func NewFatalSendError ¶
func NewFatalSendError(s string) *sendError
func NewSendError ¶
func NewSendError(s string) *sendError
Types ¶
type EthBroadcaster ¶
type EthBroadcaster interface { Start() error Stop() error Trigger() ProcessUnstartedEthTxs(models.Key) error }
EthBroadcaster monitors eth_txes for transactions that need to be broadcast, assigns nonces and ensures that at least one eth node somewhere has received the transaction successfully.
This does not guarantee delivery! A whole host of other things can subsequently go wrong such as transctions being evicted from the mempool, eth nodes going offline etc. Responsibility for ensuring eventual inclusion into the chain falls on the shoulders of the ethConfirmer.
What ethBroadcaster does guarantee is: - a monotonic series of increasing nonces for eth_txes that can all eventually be confirmed if you retry enough times - transition of eth_txes out of unstarted into either fatal_error or unconfirmed - existence of a saved eth_tx_attempt
func NewEthBroadcaster ¶
func NewEthBroadcaster(store *store.Store, config orm.ConfigReader) EthBroadcaster
NewEthBroadcaster returns a new concrete ethBroadcaster
type EthConfirmer ¶
type EthConfirmer interface { store.HeadTrackable }
EthConfirmer is a broad service which performs four different tasks in sequence on every new longest chain Step 1: Mark that all currently pending transaction attempts were broadcast before this block Step 2: Check pending transactions for receipts Step 3: See if any transactions have exceeded the gas bumping block threshold and, if so, bump them Step 4: Check confirmed transactions to make sure they are still in the longest chain (reorg protection)