Skip to content

Commit

Permalink
fix invalid bloom etc. (#397)
Browse files Browse the repository at this point in the history
fix bug: deploy contract with event fail(invalid bloom) and others
  • Loading branch information
syntrust authored Oct 21, 2019
1 parent 94159e2 commit bb480eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion core/minorblockchain_addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,17 @@ func (m *MinorBlockChain) addTransactionToBlock(block *types.MinorBlock, evmStat
return nil, nil, err
}
txs, err := types.NewTransactionsByPriceAndNonce(types.NewEIP155Signer(uint32(m.Config().NetworkID)), pending)

if err != nil {
return nil, nil, err
}
gp := new(GasPool).AddGas(block.Header().GetGasLimit().Uint64())
usedGas := new(uint64)

receipts := make([]*types.Receipt, 0)
txsInBlock := make([]*types.Transaction, 0)

stateT := evmState
txIndex := 0
for stateT.GetGasUsed().Cmp(stateT.GetGasLimit()) < 0 {
tx := txs.Peek()
// Pop skip all txs about this account
Expand All @@ -679,6 +682,7 @@ func (m *MinorBlockChain) addTransactionToBlock(block *types.MinorBlock, evmStat
}

}
stateT.Prepare(tx.Hash(), block.Hash(), txIndex)
_, receipt, _, err := ApplyTransaction(m.ethChainConfig, m, gp, stateT, block.IHeader().(*types.MinorBlockHeader), tx, usedGas, *m.GetVMConfig())
switch err {
case ErrGasLimitReached:
Expand All @@ -697,6 +701,7 @@ func (m *MinorBlockChain) addTransactionToBlock(block *types.MinorBlock, evmStat
}
receipts = append(receipts, receipt)
txsInBlock = append(txsInBlock, tx)
txIndex++
default:
// Strange error, discard the transaction and get the next in line (note, the
// nonce-too-high clause will prevent us from executing in vain).
Expand Down
4 changes: 2 additions & 2 deletions internal/qkcapi/input_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type CallArgs struct {
GasPrice hexutil.Big `json:"gasPrice"`
Value hexutil.Big `json:"value"`
Data hexutil.Bytes `json:"data"`
GasTokenID *hexutil.Uint64 `json:"gas_token_id"`
TransferTokenID *hexutil.Uint64 `json:"transfer_token_id"`
GasTokenID *hexutil.Uint64 `json:"gasTokenId"`
TransferTokenID *hexutil.Uint64 `json:"transferTokenId"`
}

func (c *CallArgs) setDefaults() {
Expand Down

0 comments on commit bb480eb

Please sign in to comment.