Skip to content

Commit

Permalink
Merge pull request #331 from XinFinOrg/dev-upgrade
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
liam-lai authored Oct 12, 2023
2 parents 78d25c6 + 493a013 commit e4577a6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions common/constants/constants.go.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
EpocBlockOpening = 850
EpocBlockRandomize = 900
MaxMasternodes = 18
MaxMasternodesV2 = 108
MaxMasternodesV2 = 10
LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000)
Expand All @@ -36,7 +36,7 @@ var TIP2019Block = big.NewInt(1)
var TIPSigning = big.NewInt(3000000)
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 TIPNoHalvingMNReward = big.NewInt(23779191) // hardfork no halving masternodes reward
Expand Down
6 changes: 5 additions & 1 deletion core/database_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
"math/big"

"github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
"github.com/XinFinOrg/XDPoSChain/core/types"
"github.com/XinFinOrg/XDPoSChain/ethdb"
"github.com/XinFinOrg/XDPoSChain/log"
Expand Down Expand Up @@ -259,6 +259,10 @@ func GetBlockReceipts(db DatabaseReader, hash common.Hash, number uint64) types.
receipts := make(types.Receipts, len(storageReceipts))
for i, receipt := range storageReceipts {
receipts[i] = (*types.Receipt)(receipt)
for _, log := range receipts[i].Logs {
// update BlockHash to fix #208
log.BlockHash = hash
}
}
return receipts
}
Expand Down
5 changes: 5 additions & 0 deletions eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
ethereum "github.com/XinFinOrg/XDPoSChain"
"github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/common/hexutil"
"github.com/XinFinOrg/XDPoSChain/core"
"github.com/XinFinOrg/XDPoSChain/core/types"
"github.com/XinFinOrg/XDPoSChain/ethdb"
"github.com/XinFinOrg/XDPoSChain/event"
Expand Down Expand Up @@ -418,6 +419,10 @@ func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
case LogsSubscription:
logs := f.logs
f.logs = nil
for _, log := range logs {
// update BlockHash to fix #208
log.BlockHash = core.GetCanonicalHash(api.chainDb, log.BlockNumber)
}
return returnLogs(logs), nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var (
TestnetV2Configs = map[uint64]*V2Config{
Default: {
SwitchRound: 0,
CertThreshold: 7,
CertThreshold: 7, //based on masternode is 10
TimeoutSyncThreshold: 3,
TimeoutPeriod: 60,
MinePeriod: 2,
Expand Down
4 changes: 2 additions & 2 deletions params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release
VersionPatch = 8 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string
VersionPatch = 9 // Patch version component of the current release
VersionMeta = "beta" // Version metadata to append to the version string
)

// Version holds the textual version string.
Expand Down

0 comments on commit e4577a6

Please sign in to comment.