Skip to content

Commit

Permalink
Merge pull request expanse-org#18 from happyuc-project/huc/v0.0.1
Browse files Browse the repository at this point in the history
fix contract tx bug
  • Loading branch information
ldcc authored May 14, 2018
2 parents 800d919 + b67ee5d commit c0c18e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func DefaultGenesisBlock() *Genesis {
Nonce: 66,
ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"),
GasLimit: 3141592,
Difficulty: big.NewInt(1048576),
Difficulty: big.NewInt(524288),
Alloc: decodePrealloc(mainnetAllocData),
}
}
Expand Down
5 changes: 2 additions & 3 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition
msg: msg,
gasPrice: msg.GasPrice(),
value: msg.Value(),
actValue: msg.Value(),
data: msg.Data(),
state: evm.StateDB,
}
Expand Down Expand Up @@ -186,9 +187,7 @@ func (st *StateTransition) buyGas() error {

if hucTx {
state.SubBalance(from, mgval)
if st.msg.To() == nil {
st.actValue = st.value
} else {
if st.msg.To() != nil {
st.actValue = new(big.Int).Sub(st.value, mgval)
}
}
Expand Down
13 changes: 10 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,16 @@ func (self *worker) push(work *Work) {

func (self *worker) commitNewWork() {
defer func() {
if hasTx := recover(); hasTx != nil && !hasTx.(bool) {
time.Sleep(txsRefreshSec * time.Second)
self.commitNewWork()
if cover := recover(); cover != nil {
switch cover.(type) {
case bool:
if !cover.(bool) {
time.Sleep(txsRefreshSec * time.Second)
self.commitNewWork()
}
case error:
log.Error("Failed to commit new work", "err", cover)
}
}
}()

Expand Down

0 comments on commit c0c18e1

Please sign in to comment.