Merge pull request #331 from XinFinOrg/dev-upgrade

* core: fix blockHash for eth_getLogs, eth_getFilterLogs, eth_getTransactionReceipt (#208)

* eth/filters: fix blockHash in eth_getfilterchanges (#208)

* set testnet v2 block (#330)

* set testnet v2 block

* set testnet v2 block
This commit is contained in:
Liam 2023-10-12 20:19:45 +11:00 committed by GitHub
commit e4577a6861
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 6 deletions

View file

@ -15,7 +15,7 @@ const (
EpocBlockOpening = 850 EpocBlockOpening = 850
EpocBlockRandomize = 900 EpocBlockRandomize = 900
MaxMasternodes = 18 MaxMasternodes = 18
MaxMasternodesV2 = 108 MaxMasternodesV2 = 10
LimitPenaltyEpoch = 4 LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0 LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000) BlocksPerYearTest = uint64(200000)
@ -36,7 +36,7 @@ var TIP2019Block = big.NewInt(1)
var TIPSigning = big.NewInt(3000000) var TIPSigning = big.NewInt(3000000)
var TIPRandomize = big.NewInt(3464000) var TIPRandomize = big.NewInt(3464000)
var TIPV2SwitchBlock = big.NewInt(99999999999) var TIPV2SwitchBlock = big.NewInt(56000000)
var TIPIncreaseMasternodes = big.NewInt(5000000) // Upgrade MN Count at Block. var TIPIncreaseMasternodes = big.NewInt(5000000) // Upgrade MN Count at Block.
var TIPNoHalvingMNReward = big.NewInt(23779191) // hardfork no halving masternodes reward var TIPNoHalvingMNReward = big.NewInt(23779191) // hardfork no halving masternodes reward

View file

@ -22,10 +22,10 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
"math/big" "math/big"
"github.com/XinFinOrg/XDPoSChain/common" "github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
"github.com/XinFinOrg/XDPoSChain/core/types" "github.com/XinFinOrg/XDPoSChain/core/types"
"github.com/XinFinOrg/XDPoSChain/ethdb" "github.com/XinFinOrg/XDPoSChain/ethdb"
"github.com/XinFinOrg/XDPoSChain/log" "github.com/XinFinOrg/XDPoSChain/log"
@ -259,6 +259,10 @@ func GetBlockReceipts(db DatabaseReader, hash common.Hash, number uint64) types.
receipts := make(types.Receipts, len(storageReceipts)) receipts := make(types.Receipts, len(storageReceipts))
for i, receipt := range storageReceipts { for i, receipt := range storageReceipts {
receipts[i] = (*types.Receipt)(receipt) receipts[i] = (*types.Receipt)(receipt)
for _, log := range receipts[i].Logs {
// update BlockHash to fix #208
log.BlockHash = hash
}
} }
return receipts return receipts
} }

View file

@ -28,6 +28,7 @@ import (
ethereum "github.com/XinFinOrg/XDPoSChain" ethereum "github.com/XinFinOrg/XDPoSChain"
"github.com/XinFinOrg/XDPoSChain/common" "github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/common/hexutil" "github.com/XinFinOrg/XDPoSChain/common/hexutil"
"github.com/XinFinOrg/XDPoSChain/core"
"github.com/XinFinOrg/XDPoSChain/core/types" "github.com/XinFinOrg/XDPoSChain/core/types"
"github.com/XinFinOrg/XDPoSChain/ethdb" "github.com/XinFinOrg/XDPoSChain/ethdb"
"github.com/XinFinOrg/XDPoSChain/event" "github.com/XinFinOrg/XDPoSChain/event"
@ -418,6 +419,10 @@ func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
case LogsSubscription: case LogsSubscription:
logs := f.logs logs := f.logs
f.logs = nil f.logs = nil
for _, log := range logs {
// update BlockHash to fix #208
log.BlockHash = core.GetCanonicalHash(api.chainDb, log.BlockNumber)
}
return returnLogs(logs), nil return returnLogs(logs), nil
} }
} }

View file

@ -52,7 +52,7 @@ var (
TestnetV2Configs = map[uint64]*V2Config{ TestnetV2Configs = map[uint64]*V2Config{
Default: { Default: {
SwitchRound: 0, SwitchRound: 0,
CertThreshold: 7, CertThreshold: 7, //based on masternode is 10
TimeoutSyncThreshold: 3, TimeoutSyncThreshold: 3,
TimeoutPeriod: 60, TimeoutPeriod: 60,
MinePeriod: 2, MinePeriod: 2,

View file

@ -23,8 +23,8 @@ import (
const ( const (
VersionMajor = 1 // Major version component of the current release VersionMajor = 1 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release VersionMinor = 4 // Minor version component of the current release
VersionPatch = 8 // Patch version component of the current release VersionPatch = 9 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string VersionMeta = "beta" // Version metadata to append to the version string
) )
// Version holds the textual version string. // Version holds the textual version string.