fix: invalidation of contract creation transaction

this fix remove rule of transaction interaction only deployed from authority address
fix constraints new contract creation only
This commit is contained in:
Antony Shchukin 2018-05-14 15:13:36 +03:00
parent 758c163191
commit 4c2ebb039d

View file

@ -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