mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-23 07:04:35 +00:00
Disable xdcx related tx creation (#430)
* stop create xdcx tx * refactor disable flag * disable miner only
This commit is contained in:
parent
07d40a0038
commit
753729c28c
5 changed files with 29 additions and 28 deletions
|
|
@ -45,6 +45,7 @@ var TIPXDCX = big.NewInt(38383838)
|
|||
var TIPXDCXLending = big.NewInt(38383838)
|
||||
var TIPXDCXCancellationFee = big.NewInt(38383838)
|
||||
var TIPXDCXCancellationFeeTestnet = big.NewInt(38383838)
|
||||
var TIPXDCXDISABLE = big.NewInt(99999999900)
|
||||
var BerlinBlock = big.NewInt(9999999999)
|
||||
var LondonBlock = big.NewInt(9999999999)
|
||||
var MergeBlock = big.NewInt(9999999999)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ var TIPXDCX = big.NewInt(225000)
|
|||
var TIPXDCXLending = big.NewInt(225000)
|
||||
var TIPXDCXCancellationFee = big.NewInt(225000)
|
||||
var TIPXDCXCancellationFeeTestnet = big.NewInt(225000)
|
||||
var TIPXDCXDISABLE = big.NewInt(15894900)
|
||||
var BerlinBlock = big.NewInt(9999999999)
|
||||
var LondonBlock = big.NewInt(9999999999)
|
||||
var MergeBlock = big.NewInt(9999999999)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ var TIPXDCX = big.NewInt(23779191)
|
|||
var TIPXDCXLending = big.NewInt(23779191)
|
||||
var TIPXDCXCancellationFee = big.NewInt(23779191)
|
||||
var TIPXDCXCancellationFeeTestnet = big.NewInt(23779191)
|
||||
var TIPXDCXDISABLE = big.NewInt(99999999900)
|
||||
var BerlinBlock = big.NewInt(9999999999)
|
||||
var LondonBlock = big.NewInt(9999999999)
|
||||
var MergeBlock = big.NewInt(9999999999)
|
||||
|
|
|
|||
|
|
@ -652,7 +652,7 @@ func (self *worker) commitNewWork() {
|
|||
log.Warn("Can't find coinbase account wallet", "coinbase", self.coinbase, "err", err)
|
||||
return
|
||||
}
|
||||
if self.config.XDPoS != nil && self.chain.Config().IsTIPXDCX(header.Number) {
|
||||
if self.config.XDPoS != nil && self.chain.Config().IsTIPXDCXMiner(header.Number) {
|
||||
XDCX := self.eth.GetXDCX()
|
||||
XDCXLending := self.eth.GetXDCXLending()
|
||||
if XDCX != nil && header.Number.Uint64() > self.config.XDPoS.Epoch {
|
||||
|
|
@ -710,8 +710,13 @@ func (self *worker) commitNewWork() {
|
|||
if XDCX.IsSDKNode() {
|
||||
self.chain.AddMatchingResult(tradingTransaction.Hash(), tradingMatchingResults)
|
||||
}
|
||||
// force adding trading, lending transaction to this block
|
||||
if tradingTransaction != nil {
|
||||
specialTxs = append(specialTxs, tradingTransaction)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(lendingInput) > 0 {
|
||||
// lending transaction
|
||||
lendingBatch := &lendingstate.TxLendingBatch{
|
||||
|
|
@ -735,6 +740,9 @@ func (self *worker) commitNewWork() {
|
|||
if XDCX.IsSDKNode() {
|
||||
self.chain.AddLendingResult(lendingTransaction.Hash(), lendingMatchingResults)
|
||||
}
|
||||
if lendingTransaction != nil {
|
||||
specialTxs = append(specialTxs, lendingTransaction)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -756,32 +764,23 @@ func (self *worker) commitNewWork() {
|
|||
if XDCX.IsSDKNode() {
|
||||
self.chain.AddFinalizedTrades(lendingFinalizedTradeTransaction.Hash(), updatedTrades)
|
||||
}
|
||||
if lendingFinalizedTradeTransaction != nil {
|
||||
specialTxs = append(specialTxs, lendingFinalizedTradeTransaction)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
XDCxStateRoot := work.tradingState.IntermediateRoot()
|
||||
LendingStateRoot := work.lendingState.IntermediateRoot()
|
||||
txData := append(XDCxStateRoot.Bytes(), LendingStateRoot.Bytes()...)
|
||||
tx := types.NewTransaction(work.state.GetNonce(self.coinbase), common.HexToAddress(common.TradingStateAddr), big.NewInt(0), txMatchGasLimit, big.NewInt(0), txData)
|
||||
txStateRoot, err := wallet.SignTx(accounts.Account{Address: self.coinbase}, tx, self.config.ChainId)
|
||||
if err != nil {
|
||||
log.Error("Fail to create tx state root", "error", err)
|
||||
return
|
||||
}
|
||||
specialTxs = append(specialTxs, txStateRoot)
|
||||
}
|
||||
|
||||
// force adding trading, lending transaction to this block
|
||||
if tradingTransaction != nil {
|
||||
specialTxs = append(specialTxs, tradingTransaction)
|
||||
}
|
||||
if lendingTransaction != nil {
|
||||
specialTxs = append(specialTxs, lendingTransaction)
|
||||
}
|
||||
if lendingFinalizedTradeTransaction != nil {
|
||||
specialTxs = append(specialTxs, lendingFinalizedTradeTransaction)
|
||||
}
|
||||
|
||||
XDCxStateRoot := work.tradingState.IntermediateRoot()
|
||||
LendingStateRoot := work.lendingState.IntermediateRoot()
|
||||
txData := append(XDCxStateRoot.Bytes(), LendingStateRoot.Bytes()...)
|
||||
tx := types.NewTransaction(work.state.GetNonce(self.coinbase), common.HexToAddress(common.TradingStateAddr), big.NewInt(0), txMatchGasLimit, big.NewInt(0), txData)
|
||||
txStateRoot, err := wallet.SignTx(accounts.Account{Address: self.coinbase}, tx, self.config.ChainId)
|
||||
if err != nil {
|
||||
log.Error("Fail to create tx state root", "error", err)
|
||||
return
|
||||
}
|
||||
specialTxs = append(specialTxs, txStateRoot)
|
||||
}
|
||||
work.commitTransactions(self.mux, feeCapacity, txs, specialTxs, self.chain, self.coinbase)
|
||||
// compute uncles for the new block.
|
||||
|
|
|
|||
|
|
@ -597,11 +597,10 @@ func (c *ChainConfig) IsTIPNoHalvingMNReward(num *big.Int) bool {
|
|||
return isForked(common.TIPNoHalvingMNReward, num)
|
||||
}
|
||||
func (c *ChainConfig) IsTIPXDCX(num *big.Int) bool {
|
||||
if common.IsTestnet {
|
||||
return isForked(common.TIPXDCXTestnet, num)
|
||||
} else {
|
||||
return isForked(common.TIPXDCX, num)
|
||||
}
|
||||
return isForked(common.TIPXDCX, num)
|
||||
}
|
||||
func (c *ChainConfig) IsTIPXDCXMiner(num *big.Int) bool {
|
||||
return isForked(common.TIPXDCX, num) && !isForked(common.TIPXDCXDISABLE, num)
|
||||
}
|
||||
|
||||
func (c *ChainConfig) IsTIPXDCXLending(num *big.Int) bool {
|
||||
|
|
|
|||
Loading…
Reference in a new issue