aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/receipt.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-05 21:03:50 +0800
committerFelix Lange <fjl@twurst.com>2017-01-06 21:15:22 +0800
commit7731061903bb992f7630ab389863951efb360258 (patch)
treeea706da87ce002a631cba30b171cb44dbdd7c2c6 /core/types/receipt.go
parentb9683d3748dcb73ab5a5474334eaf157267d9c4a (diff)
downloadgo-tangerine-7731061903bb992f7630ab389863951efb360258.tar
go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.gz
go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.bz2
go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.lz
go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.xz
go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.zst
go-tangerine-7731061903bb992f7630ab389863951efb360258.zip
core/vm: move Log to core/types
This significantly reduces the dependency closure of ethclient, which no longer depends on core/vm as of this change. All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too, the constructor simply returned a literal.
Diffstat (limited to 'core/types/receipt.go')
-rw-r--r--core/types/receipt.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/types/receipt.go b/core/types/receipt.go
index 70c10d422..0a6a35e33 100644
--- a/core/types/receipt.go
+++ b/core/types/receipt.go
@@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -40,7 +39,7 @@ type Receipt struct {
PostState []byte
CumulativeGasUsed *big.Int
Bloom Bloom
- Logs vm.Logs
+ Logs []*Log
// Implementation fields (don't reorder!)
TxHash common.Hash
@@ -52,7 +51,7 @@ type jsonReceipt struct {
PostState *common.Hash `json:"root"`
CumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"`
Bloom *Bloom `json:"logsBloom"`
- Logs *vm.Logs `json:"logs"`
+ Logs []*Log `json:"logs"`
TxHash *common.Hash `json:"transactionHash"`
ContractAddress *common.Address `json:"contractAddress"`
GasUsed *hexutil.Big `json:"gasUsed"`
@@ -76,7 +75,7 @@ func (r *Receipt) DecodeRLP(s *rlp.Stream) error {
PostState []byte
CumulativeGasUsed *big.Int
Bloom Bloom
- Logs vm.Logs
+ Logs []*Log
}
if err := s.Decode(&receipt); err != nil {
return err
@@ -93,7 +92,7 @@ func (r *Receipt) MarshalJSON() ([]byte, error) {
PostState: &root,
CumulativeGasUsed: (*hexutil.Big)(r.CumulativeGasUsed),
Bloom: &r.Bloom,
- Logs: &r.Logs,
+ Logs: r.Logs,
TxHash: &r.TxHash,
ContractAddress: &r.ContractAddress,
GasUsed: (*hexutil.Big)(r.GasUsed),
@@ -120,7 +119,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
PostState: (*dec.PostState)[:],
CumulativeGasUsed: (*big.Int)(dec.CumulativeGasUsed),
Bloom: *dec.Bloom,
- Logs: *dec.Logs,
+ Logs: dec.Logs,
TxHash: *dec.TxHash,
GasUsed: (*big.Int)(dec.GasUsed),
}
@@ -142,9 +141,9 @@ type ReceiptForStorage Receipt
// EncodeRLP implements rlp.Encoder, and flattens all content fields of a receipt
// into an RLP stream.
func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error {
- logs := make([]*vm.LogForStorage, len(r.Logs))
+ logs := make([]*LogForStorage, len(r.Logs))
for i, log := range r.Logs {
- logs[i] = (*vm.LogForStorage)(log)
+ logs[i] = (*LogForStorage)(log)
}
return rlp.Encode(w, []interface{}{r.PostState, r.CumulativeGasUsed, r.Bloom, r.TxHash, r.ContractAddress, logs, r.GasUsed})
}
@@ -158,7 +157,7 @@ func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error {
Bloom Bloom
TxHash common.Hash
ContractAddress common.Address
- Logs []*vm.LogForStorage
+ Logs []*LogForStorage
GasUsed *big.Int
}
if err := s.Decode(&receipt); err != nil {
@@ -166,9 +165,9 @@ func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error {
}
// Assign the consensus fields
r.PostState, r.CumulativeGasUsed, r.Bloom = receipt.PostState, receipt.CumulativeGasUsed, receipt.Bloom
- r.Logs = make(vm.Logs, len(receipt.Logs))
+ r.Logs = make([]*Log, len(receipt.Logs))
for i, log := range receipt.Logs {
- r.Logs[i] = (*vm.Log)(log)
+ r.Logs[i] = (*Log)(log)
}
// Assign the implementation fields
r.TxHash, r.ContractAddress, r.GasUsed = receipt.TxHash, receipt.ContractAddress, receipt.GasUsed