Skip to content

Commit

Permalink
eth: Fix nil pointer in client.Vote()
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko authored Feb 3, 2022
1 parent 09ef673 commit 8efdade
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

- \#2216 Fix Accept Multiline message on Windows (@leszko)
- \#2218 Display http status codes in livepeer_cli (@noisersup)
- \#2227 Fix nil pointer in client.Vote() (@leszko)

#### Broadcaster

Expand Down
6 changes: 5 additions & 1 deletion eth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ type client struct {
verifierAddr ethcommon.Address
faucetAddr ethcommon.Address

transactOpts *bind.TransactOpts

// Embedded contract sessions
*contracts.ControllerSession
*contracts.LivepeerTokenSession
Expand Down Expand Up @@ -174,6 +176,8 @@ func NewClient(cfg LivepeerEthClientConfig) (LivepeerEthClient, error) {
}

func (c *client) setContracts(opts *bind.TransactOpts) error {
c.transactOpts = opts

controller, err := contracts.NewController(c.controllerAddr, c.backend)
if err != nil {
glog.Errorf("Error creating Controller binding: %v", err)
Expand Down Expand Up @@ -768,7 +772,7 @@ func (c *client) Vote(pollAddr ethcommon.Address, choiceID *big.Int) (*types.Tra
return nil, err
}

return poll.Vote(nil, choiceID)
return poll.Vote(c.transactOpts, choiceID)
}

func (c *client) Reward() (*types.Transaction, error) {
Expand Down

0 comments on commit 8efdade

Please sign in to comment.