ipld-eth-server/core/block.go
2017-10-31 09:14:44 -05:00

28 lines
616 B
Go

package core
import (
"math/big"
"github.com/ethereum/go-ethereum/core/types"
)
//Our block representation
type Block struct {
Number *big.Int
GasLimit *big.Int
GasUsed *big.Int
Time *big.Int
NumberOfTransactions int
}
//Geth Block to Ours
func GethBlockToCoreBlock(gethBlock *types.Block) Block {
return Block{
Number: gethBlock.Number(),
GasLimit: gethBlock.GasLimit(),
GasUsed: gethBlock.GasUsed(),
Time: gethBlock.Time(),
NumberOfTransactions: len(gethBlock.Transactions()),
}
}