No longer store script directly in the state tree
This commit is contained in:
@@ -45,7 +45,7 @@ func (lib *PEthereum) GetKey() *PKey {
|
||||
}
|
||||
|
||||
func (lib *PEthereum) GetStateObject(address string) *PStateObject {
|
||||
stateObject := lib.stateManager.CurrentState().GetContract(ethutil.FromHex(address))
|
||||
stateObject := lib.stateManager.CurrentState().GetStateObject(ethutil.FromHex(address))
|
||||
if stateObject != nil {
|
||||
return NewPStateObject(stateObject)
|
||||
}
|
||||
@@ -160,7 +160,6 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, in
|
||||
}
|
||||
|
||||
acc := lib.stateManager.TransState().GetStateObject(keyPair.Address())
|
||||
//acc := lib.stateManager.GetAddrState(keyPair.Address())
|
||||
tx.Nonce = acc.Nonce
|
||||
acc.Nonce += 1
|
||||
lib.stateManager.TransState().SetStateObject(acc)
|
||||
|
||||
@@ -2,6 +2,7 @@ package ethpub
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/ethereum/eth-go/ethchain"
|
||||
"github.com/ethereum/eth-go/ethutil"
|
||||
)
|
||||
@@ -112,6 +113,14 @@ func (c *PStateObject) IsContract() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *PStateObject) Script() string {
|
||||
if c.object != nil {
|
||||
return ethutil.Hex(c.object.Script())
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
type PStorageState struct {
|
||||
StateAddress string
|
||||
Address string
|
||||
|
||||
Reference in New Issue
Block a user