Skip to content

Commit

Permalink
optimize receipt struct
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangjian002 committed Jul 25, 2019
1 parent 5f1d915 commit 4855fa4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions eth/core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,13 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
// Edit by zhongan
txBytes, _ := rlp.EncodeToBytes(tx)
receipt.TxHash = common.BytesToHash(gtypes.Tx(txBytes).Hash())
// receipt.Result = res
receipt.GasUsed = gas
// if the transaction created a contract, store the creation address in the receipt.
if msg.To() == nil {
receipt.ContractAddress = crypto.CreateAddress(vmenv.Context.Origin, tx.Nonce())
}
// Set the receipt logs and create a bloom for filtering
// Edit by zhongan
// receipt.From = msg.From()
receipt.Logs = statedb.GetLogs(receipt.TxHash)
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})

Expand Down
9 changes: 1 addition & 8 deletions eth/core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"bytes"
"fmt"
"io"
"time"
// "time"
"unsafe"

"github.com/dappledger/AnnChain/eth/common"
Expand Down Expand Up @@ -60,13 +60,6 @@ type Receipt struct {
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
ContractAddress common.Address `json:"contractAddress"`
GasUsed uint64 `json:"gasUsed" gencodec:"required"`

TxIndex uint64 `json:"transactionIndex" gencodec:"required"`
Height uint64 `json:"height"`
BlockHashHex string `json:"blockHash"`
From common.Address `json:"from"`
To common.Address `json:"to"`
Timestamp time.Time `json:"timestamp"`
}

type receiptMarshaling struct {
Expand Down

0 comments on commit 4855fa4

Please sign in to comment.