From 4c2ebb039ddcf2ec6829a1bd1aa8f79f1865bd64 Mon Sep 17 00:00:00 2001 From: Antony Shchukin Date: Mon, 14 May 2018 15:13:36 +0300 Subject: [PATCH] fix: invalidation of contract creation transaction this fix remove rule of transaction interaction only deployed from authority address fix constraints new contract creation only --- core/tx_pool.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 0231280bd1..3207c89999 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -33,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/params" "gopkg.in/karalabe/cookiejar.v2/collections/prque" - "github.com/ethereum/go-ethereum/crypto" ) const ( @@ -213,7 +212,6 @@ type TxPool struct { homestead bool - allowedTo map[string]bool superheroAddress common.Address } @@ -237,15 +235,9 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block all: make(map[common.Hash]*types.Transaction), chainHeadCh: make(chan ChainHeadEvent, chainHeadChanSize), gasPrice: new(big.Int).SetUint64(config.PriceLimit), - allowedTo: make(map[string]bool), superheroAddress: common.HexToAddress(superheroAddressHex), } - for i := 1; i <= 3000; i++ { - a := crypto.CreateAddress(pool.superheroAddress, uint64(i)) - pool.allowedTo[a.Hex()] = true - } - pool.locals = newAccountSet(pool.signer) pool.priced = newTxPricedList(&pool.all) pool.reset(nil, chain.CurrentBlock().Header()) @@ -588,8 +580,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { return ErrInvalidSender } - if from.Hex() != pool.superheroAddress.Hex() && !pool.allowedTo[tx.To().Hex()] { - return errors.New("SONM sidechain rule #1: you are not prepare uranus, transaction not allowed") + if tx.To() == nil && from.Hex() != pool.superheroAddress.Hex(){ + return errors.New("SONM sidechain rule #1: you are not prepare uranus, creation contracts not allowed") } // Drop non-local transactions under our own minimal accepted gas price