From 26cafb46eaff17062c033e1bb4e9e1ba710cf526 Mon Sep 17 00:00:00 2001 From: AnilChinchawale Date: Sat, 19 Jan 2019 04:40:21 +0530 Subject: [PATCH] Updated changes in genesis --- core/genesis_alloc.go | 0 core/state/statedb.go | 8 -------- core/tx_pool.go | 18 ++---------------- core/types/transaction.go | 22 +--------------------- 4 files changed, 3 insertions(+), 45 deletions(-) mode change 100644 => 100755 core/genesis_alloc.go diff --git a/core/genesis_alloc.go b/core/genesis_alloc.go old mode 100644 new mode 100755 diff --git a/core/state/statedb.go b/core/state/statedb.go index 2ae700cd67..bd67e789d5 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -357,14 +357,6 @@ func (self *StateDB) deleteStateObject(stateObject *stateObject) { self.setError(self.trie.TryDelete(addr[:])) } -// DeleteAddress removes the address from the state trie. -func (self *StateDB) DeleteAddress(addr common.Address) { - stateObject := self.getStateObject(addr) - if stateObject != nil && !stateObject.deleted { - self.deleteStateObject(stateObject) - } -} - // Retrieve a state object given my the address. Returns nil if not found. func (self *StateDB) getStateObject(addr common.Address) (stateObject *stateObject) { // Prefer 'live' objects. diff --git a/core/tx_pool.go b/core/tx_pool.go index 496f881787..63dbf3ac9e 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -81,11 +81,7 @@ var ( ErrZeroGasPrice = errors.New("zero gas price") - ErrUnderMinGasPrice = errors.New("under min gas price") - ErrDuplicateSpecialTransaction = errors.New("duplicate a special transaction") - - ErrMinDeploySMC = errors.New("smart contract creation cost is under allowance") ) var ( @@ -591,7 +587,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { } // Drop non-local transactions under our own minimal accepted gas price local = local || pool.locals.contains(from) // account may be local even if the transaction arrived from the network - if !local && pool.gasPrice.Cmp(tx.GasPrice()) > 0 { + if !local && tx.To() != nil && pool.gasPrice.Cmp(tx.GasPrice()) > 0 { if !tx.IsSpecialTransaction() || (pool.IsMasterNode != nil && !pool.IsMasterNode(from)) { return ErrUnderpriced } @@ -623,16 +619,6 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if tx.GasPrice().Cmp(new(big.Int).SetInt64(0)) == 0 { return ErrZeroGasPrice } - - // under min gas price - if tx.GasPrice().Cmp(new(big.Int).SetInt64(common.MinGasPrice)) < 0 { - return ErrUnderMinGasPrice - } - } - - minGasDeploySMC := new(big.Int).Mul(new(big.Int).SetUint64(10), new(big.Int).SetUint64(params.Ether)) - if tx.To() == nil && (tx.Cost().Cmp(minGasDeploySMC) < 0 || tx.GasPrice().Cmp(new(big.Int).SetUint64(10000*params.Shannon)) < 0) { - return ErrMinDeploySMC } return nil @@ -1243,4 +1229,4 @@ func (as *accountSet) containsTx(tx *types.Transaction) bool { // add inserts a new address into the set to track. func (as *accountSet) add(addr common.Address) { as.accounts[addr] = struct{}{} -} \ No newline at end of file +} diff --git a/core/types/transaction.go b/core/types/transaction.go index 36865ce5de..653498a851 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -195,19 +195,6 @@ func (tx *Transaction) To() *common.Address { return &to } -func (tx *Transaction) From() *common.Address { - if tx.data.V != nil { - signer := deriveSigner(tx.data.V) - if f, err := Sender(signer, tx); err != nil { - return nil - } else { - return &f - } - } else { - return nil - } -} - // Hash hashes the RLP encoding of tx. // It uniquely identifies the transaction. func (tx *Transaction) Hash() common.Hash { @@ -287,13 +274,6 @@ func (tx *Transaction) IsSpecialTransaction() bool { return tx.To().String() == common.RandomizeSMC || tx.To().String() == common.BlockSigners } -func (tx *Transaction) IsSigningTransaction() bool { - if tx.To() == nil { - return false - } - return tx.To().String() == common.BlockSigners -} - func (tx *Transaction) String() string { var from, to string if tx.data.V != nil { @@ -525,4 +505,4 @@ func (m Message) Value() *big.Int { return m.amount } func (m Message) Gas() uint64 { return m.gasLimit } func (m Message) Nonce() uint64 { return m.nonce } func (m Message) Data() []byte { return m.data } -func (m Message) CheckNonce() bool { return m.checkNonce } \ No newline at end of file +func (m Message) CheckNonce() bool { return m.checkNonce }