github.com/pfcoder/quorum@v2.0.3-0.20180501191142-d4a1b0958135+incompatible/tests/util.go (about) 1 // Copyright 2015 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package tests 18 19 import ( 20 "os" 21 22 "github.com/ethereum/go-ethereum/common" 23 "github.com/ethereum/go-ethereum/log" 24 ) 25 26 func init() { 27 log.Root().SetHandler(log.LvlFilterHandler(log.LvlCrit, log.StreamHandler(os.Stderr, log.TerminalFormat(false)))) 28 } 29 30 type Account struct { 31 Balance string 32 Code string 33 Nonce string 34 Storage map[string]string 35 } 36 37 type Log struct { 38 AddressF string `json:"address"` 39 DataF string `json:"data"` 40 TopicsF []string `json:"topics"` 41 BloomF string `json:"bloom"` 42 } 43 44 func (self Log) Address() []byte { return common.Hex2Bytes(self.AddressF) } 45 func (self Log) Data() []byte { return common.Hex2Bytes(self.DataF) } 46 func (self Log) RlpData() interface{} { return nil } 47 func (self Log) Topics() [][]byte { 48 t := make([][]byte, len(self.TopicsF)) 49 for i, topic := range self.TopicsF { 50 t[i] = common.Hex2Bytes(topic) 51 } 52 return t 53 }