mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
hot fix
This commit is contained in:
parent
1861c13bcd
commit
b493f4b6ca
4 changed files with 24 additions and 53 deletions
|
|
@ -18,8 +18,10 @@ package eth
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/ethereum/go-ethereum/consensus/XDPoS"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -236,10 +238,24 @@ func (b *EthApiBackend) GetEngine() consensus.Engine {
|
|||
}
|
||||
|
||||
func (s *EthApiBackend) GetRewardByHash(hash common.Hash) map[string]interface{} {
|
||||
if c, ok := s.eth.Engine().(*XDPoS.XDPoS); ok {
|
||||
rewards := c.GetRewards(hash)
|
||||
if rewards != nil {
|
||||
return rewards
|
||||
header := s.eth.blockchain.GetHeaderByHash(hash)
|
||||
if header != nil {
|
||||
data, err := ioutil.ReadFile(filepath.Join(common.StoreRewardFolder, header.Number.String()+"."+header.Hash().Hex()))
|
||||
if err == nil {
|
||||
rewards := make(map[string]interface{})
|
||||
err = json.Unmarshal(data, &rewards)
|
||||
if err == nil {
|
||||
return rewards
|
||||
}
|
||||
} else {
|
||||
data, err = ioutil.ReadFile(filepath.Join(common.StoreRewardFolder, header.Number.String()+"."+header.HashNoValidator().Hex()))
|
||||
if err == nil {
|
||||
rewards := make(map[string]interface{})
|
||||
err = json.Unmarshal(data, &rewards)
|
||||
if err == nil {
|
||||
return rewards
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return make(map[string]interface{})
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ type Config struct {
|
|||
|
||||
// Miscellaneous options
|
||||
DocRoot string `toml:"-"`
|
||||
|
||||
StoreRewardFolder string
|
||||
}
|
||||
|
||||
type configMarshaling struct {
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright 2015 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Contains the metrics collected by the downloader.
|
||||
|
||||
package downloader
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/metrics"
|
||||
)
|
||||
|
||||
var (
|
||||
headerInMeter = metrics.NewRegisteredMeter("eth/downloader/headers/in", nil)
|
||||
headerReqTimer = metrics.NewRegisteredTimer("eth/downloader/headers/req", nil)
|
||||
headerDropMeter = metrics.NewRegisteredMeter("eth/downloader/headers/drop", nil)
|
||||
headerTimeoutMeter = metrics.NewRegisteredMeter("eth/downloader/headers/timeout", nil)
|
||||
|
||||
bodyInMeter = metrics.NewRegisteredMeter("eth/downloader/bodies/in", nil)
|
||||
bodyReqTimer = metrics.NewRegisteredTimer("eth/downloader/bodies/req", nil)
|
||||
bodyDropMeter = metrics.NewRegisteredMeter("eth/downloader/bodies/drop", nil)
|
||||
bodyTimeoutMeter = metrics.NewRegisteredMeter("eth/downloader/bodies/timeout", nil)
|
||||
|
||||
receiptInMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/in", nil)
|
||||
receiptReqTimer = metrics.NewRegisteredTimer("eth/downloader/receipts/req", nil)
|
||||
receiptDropMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/drop", nil)
|
||||
receiptTimeoutMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/timeout", nil)
|
||||
|
||||
stateInMeter = metrics.NewRegisteredMeter("eth/downloader/states/in", nil)
|
||||
stateDropMeter = metrics.NewRegisteredMeter("eth/downloader/states/drop", nil)
|
||||
)
|
||||
|
|
@ -30,7 +30,6 @@ import (
|
|||
)
|
||||
|
||||
var maxPrice = big.NewInt(500 * params.Shannon)
|
||||
var minPrice = big.NewInt(common.MinGasPrice)
|
||||
|
||||
type Config struct {
|
||||
Blocks int
|
||||
|
|
@ -142,8 +141,9 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
|||
}
|
||||
|
||||
// Check gas price min.
|
||||
if price.Cmp(minPrice) < 0 {
|
||||
price = new(big.Int).Set(minPrice)
|
||||
minGasPrice := big.NewInt(common.MinGasPrice)
|
||||
if price.Cmp(minGasPrice) < 0 {
|
||||
price = new(big.Int).Set(minGasPrice)
|
||||
}
|
||||
|
||||
gpo.cacheLock.Lock()
|
||||
|
|
|
|||
Loading…
Reference in a new issue