Handle headers from POA chain

- Fetching headers from Kovan requires custom type without mixHash/Nonce
This commit is contained in:
Rob Mulholand
2018-09-19 11:00:20 -05:00
parent 778517f33f
commit 042f1142c0
15 changed files with 162 additions and 63 deletions
+23
View File
@@ -1,8 +1,31 @@
package core
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
)
type Header struct {
Id int64
BlockNumber int64 `db:"block_number"`
Hash string
Raw []byte
}
type POAHeader struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase common.Address `json:"miner" gencodec:"required"`
Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
Bloom types.Bloom `json:"logsBloom" gencodec:"required"`
Difficulty *hexutil.Big `json:"difficulty" gencodec:"required"`
Number *hexutil.Big `json:"number" gencodec:"required"`
GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
Time *hexutil.Big `json:"timestamp" gencodec:"required"`
Extra hexutil.Bytes `json:"extraData" gencodec:"required"`
Hash common.Hash `json:"hash"`
}
+4
View File
@@ -13,6 +13,10 @@ const (
GANACHE
)
const (
KOVAN_NETWORK_ID = 42
)
type Node struct {
GenesisBlock string
NetworkID float64