|
|
|
@ -20,15 +20,16 @@ import ( |
|
|
|
const txCheckInterval = 5 * time.Second |
|
|
|
const txCheckInterval = 5 * time.Second |
|
|
|
|
|
|
|
|
|
|
|
type PayoutsConfig struct { |
|
|
|
type PayoutsConfig struct { |
|
|
|
Enabled bool `json:"enabled"` |
|
|
|
Enabled bool `json:"enabled"` |
|
|
|
RequirePeers int64 `json:"requirePeers"` |
|
|
|
RequirePeers int64 `json:"requirePeers"` |
|
|
|
Interval string `json:"interval"` |
|
|
|
Interval string `json:"interval"` |
|
|
|
Daemon string `json:"daemon"` |
|
|
|
Daemon string `json:"daemon"` |
|
|
|
Timeout string `json:"timeout"` |
|
|
|
Timeout string `json:"timeout"` |
|
|
|
Address string `json:"address"` |
|
|
|
Address string `json:"address"` |
|
|
|
Gas string `json:"gas"` |
|
|
|
Gas string `json:"gas"` |
|
|
|
GasPrice string `json:"gasPrice"` |
|
|
|
GasPrice string `json:"gasPrice"` |
|
|
|
AutoGas bool `json:"autoGas"` |
|
|
|
AutoGas bool `json:"autoGas"` |
|
|
|
|
|
|
|
MaxPriorityFee string `json:"maxPriorityFee"` |
|
|
|
// In Shannon
|
|
|
|
// In Shannon
|
|
|
|
Threshold int64 `json:"threshold"` |
|
|
|
Threshold int64 `json:"threshold"` |
|
|
|
BgSave bool `json:"bgsave"` |
|
|
|
BgSave bool `json:"bgsave"` |
|
|
|
@ -45,6 +46,11 @@ func (self PayoutsConfig) GasPriceHex() string { |
|
|
|
return hexutil.EncodeBig(x) |
|
|
|
return hexutil.EncodeBig(x) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (self PayoutsConfig) MaxPriorityFeeHex() string { |
|
|
|
|
|
|
|
x := util.String2Big(self.MaxPriorityFee) |
|
|
|
|
|
|
|
return hexutil.EncodeBig(x) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type PayoutsProcessor struct { |
|
|
|
type PayoutsProcessor struct { |
|
|
|
config *PayoutsConfig |
|
|
|
config *PayoutsConfig |
|
|
|
backend *storage.RedisClient |
|
|
|
backend *storage.RedisClient |
|
|
|
@ -179,7 +185,7 @@ func (u *PayoutsProcessor) process() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
value := hexutil.EncodeBig(amountInWei) |
|
|
|
value := hexutil.EncodeBig(amountInWei) |
|
|
|
txHash, err := u.rpc.SendTransaction(u.config.Address, login, u.config.GasHex(), u.config.GasPriceHex(), value, u.config.AutoGas) |
|
|
|
txHash, err := u.rpc.SendTransaction(u.config.Address, login, u.config.GasHex(), u.config.GasPriceHex(), u.config.MaxPriorityFeeHex(), value, u.config.AutoGas) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Printf("Failed to send payment to %s, %v Shannon: %v. Check outgoing tx for %s in block explorer and docs/PAYOUTS.md", |
|
|
|
log.Printf("Failed to send payment to %s, %v Shannon: %v. Check outgoing tx for %s in block explorer and docs/PAYOUTS.md", |
|
|
|
login, amount, err, login) |
|
|
|
login, amount, err, login) |
|
|
|
|