Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pool: Reinstate Fetch txBroadcaster/txCreator. #421

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pool/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ func NewHub(hcfg *HubConfig) (*Hub, error) {
WalletAccount: h.cfg.WalletAccount,
WalletPass: h.cfg.WalletPass,
GetBlockConfirmations: h.getBlockConfirmations,
TxCreator: h.nodeConn,
TxBroadcaster: h.walletConn,
FetchTxCreator: func() txCreator { return h.nodeConn },
FetchTxBroadcaster: func() txBroadcaster { return h.walletConn },
CoinbaseConfTimeout: h.cfg.CoinbaseConfTimeout,
SignalCache: h.SignalCache,
}
Expand Down
16 changes: 8 additions & 8 deletions pool/paymentmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ type PaymentMgrConfig struct {
// GetBlockConfirmations returns the number of block confirmations for the
// provided block hash.
GetBlockConfirmations func(context.Context, *chainhash.Hash) (int64, error)
// TxCreator is a transaction creator that allows coinbase lookups and
// payment transaction creation.
TxCreator txCreator
// TxBroadcaster is a transaction broadcaster that allows signing and
// publishing of transactions.
TxBroadcaster txBroadcaster
// FetchTxCreator returns a transaction creator that allows coinbase lookups
// and payment transaction creation.
FetchTxCreator func() txCreator
// FetchTxBroadcaster returns a transaction broadcaster that allows signing
// and publishing of transactions.
FetchTxBroadcaster func() txBroadcaster
// CoinbaseConfTimeout is the duration to wait for coinbase confirmations
// when generating a payout transaction.
CoinbaseConfTimeout time.Duration
Expand Down Expand Up @@ -718,7 +718,7 @@ func (pm *PaymentMgr) payDividends(ctx context.Context, height uint32, coinbaseI
pm.mtx.Unlock()
}()

txB := pm.cfg.TxBroadcaster
txB := pm.cfg.FetchTxBroadcaster()
if txB == nil {
desc := fmt.Sprintf("%s: tx broadcaster cannot be nil", funcName)
return errs.PoolError(errs.Disconnected, desc)
Expand Down Expand Up @@ -775,7 +775,7 @@ func (pm *PaymentMgr) payDividends(ctx context.Context, height uint32, coinbaseI
}
}

txC := pm.cfg.TxCreator
txC := pm.cfg.FetchTxCreator()
if txC == nil {
desc := fmt.Sprintf("%s: tx creator cannot be nil", funcName)
return errs.PoolError(errs.Disconnected, desc)
Expand Down
Loading
Loading