Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@

#### Orchestrator
- \#2493 cmd: Fix reward flag (@leszko)
- \#2481 Lower `avgGasPrice` to prevent dropping streams during the gas price spikes (@leszko)

#### Transcoder
7 changes: 3 additions & 4 deletions pm/recipient.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ var paramsExpiryBuffer = int64(1)

var evMultiplier = big.NewInt(100)

// Hardcode to 200 gwei
// Hardcode to 3 gwei
// TODO: Replace this hardcoded value by dynamically determining the average gas price during a period of time
var avgGasPrice = new(big.Int).Mul(big.NewInt(200), new(big.Int).Exp(big.NewInt(10), big.NewInt(9), nil))
var avgGasPrice = new(big.Int).Mul(big.NewInt(3), new(big.Int).Exp(big.NewInt(10), big.NewInt(9), nil))

// Recipient is an interface which describes an object capable
// of receiving tickets
Expand Down Expand Up @@ -300,8 +300,7 @@ func (r *recipient) faceValue(sender ethcommon.Address) (*big.Int, error) {
// because there is a good chance that the current gasPrice will come back down by the time a winning ticket is received
// and needs to be redeemed.
// For now, avgGasPrice is hardcoded. See the comment for avgGasPrice for TODO information.
// Use || here for lazy evaluation. If the first clause is true we ignore the second clause.
if !(faceValue.Cmp(txCost) >= 0 || faceValue.Cmp(r.txCostWithGasPrice(avgGasPrice)) >= 0) {
if faceValue.Cmp(txCost) < 0 && faceValue.Cmp(r.txCostWithGasPrice(avgGasPrice)) < 0 {
return nil, errInsufficientSenderReserve
}

Expand Down