Updated changes in genesis

This commit is contained in:
AnilChinchawale 2019-01-19 04:40:21 +05:30
parent 26affd91ab
commit 26cafb46ea
4 changed files with 3 additions and 45 deletions

0
core/genesis_alloc.go Normal file → Executable file
View file

View file

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

View file

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

View file

@ -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 }
func (m Message) CheckNonce() bool { return m.checkNonce }