ipld-eth-server/core/block.go

28 lines
617 B
Go
Raw Normal View History

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(),
2017-10-27 20:47:13 +00:00
NumberOfTransactions: gethBlock.Transactions().Len(),
}
}