aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain')
-rw-r--r--ethchain/asm.go2
-rw-r--r--ethchain/block_chain.go2
-rw-r--r--ethchain/state_transition.go16
-rw-r--r--ethchain/types.go2
4 files changed, 14 insertions, 8 deletions
diff --git a/ethchain/asm.go b/ethchain/asm.go
index 277326ff9..c267f9b55 100644
--- a/ethchain/asm.go
+++ b/ethchain/asm.go
@@ -28,7 +28,7 @@ func Disassemble(script []byte) (asm []string) {
if len(data) == 0 {
data = []byte{0}
}
- asm = append(asm, fmt.Sprintf("0x%x", data))
+ asm = append(asm, fmt.Sprintf("%#x", data))
pc.Add(pc, big.NewInt(a-1))
}
diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go
index 8cede2403..19b5248d7 100644
--- a/ethchain/block_chain.go
+++ b/ethchain/block_chain.go
@@ -55,6 +55,8 @@ func (bc *BlockChain) NewBlock(coinbase []byte) *Block {
nil,
"")
+ block.MinGasPrice = big.NewInt(10000000000000)
+
if bc.CurrentBlock != nil {
var mul *big.Int
if block.Time < lastBlockTime+42 {
diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go
index a080c5602..5ded0cddd 100644
--- a/ethchain/state_transition.go
+++ b/ethchain/state_transition.go
@@ -131,14 +131,21 @@ func (self *StateTransition) TransitionState() (err error) {
return NonceError(tx.Nonce, sender.Nonce)
}
- // Increment the nonce for the next transaction
- sender.Nonce += 1
-
// Pre-pay gas / Buy gas of the coinbase account
if err = self.BuyGas(); err != nil {
return err
}
+ // XXX Transactions after this point are considered valid.
+
+ defer func() {
+ self.state.UpdateStateObject(sender)
+ self.state.UpdateStateObject(receiver)
+ }()
+
+ // Increment the nonce for the next transaction
+ sender.Nonce += 1
+
// Get the receiver (TODO fix this, if coinbase is the receiver we need to save/retrieve)
receiver = self.Receiver()
@@ -187,9 +194,6 @@ func (self *StateTransition) TransitionState() (err error) {
remaining := new(big.Int).Mul(self.gas, tx.GasPrice)
sender.AddAmount(remaining)
- self.state.UpdateStateObject(sender)
- self.state.UpdateStateObject(receiver)
-
return nil
}
diff --git a/ethchain/types.go b/ethchain/types.go
index ee70a8d28..d89fad147 100644
--- a/ethchain/types.go
+++ b/ethchain/types.go
@@ -226,7 +226,7 @@ var opCodeToString = map[OpCode]string{
func (o OpCode) String() string {
str := opCodeToString[o]
if len(str) == 0 {
- return fmt.Sprintf("Missing opcode 0x%x", int(o))
+ return fmt.Sprintf("Missing opcode %#x", int(o))
}
return str