ipld-eth-server/core/block.go

30 lines
654 B
Go
Raw Normal View History

package core
import (
"math/big"
"github.com/ethereum/go-ethereum/core/types"
)
type Block struct {
2017-10-31 13:58:04 +00:00
Number *big.Int
GasLimit *big.Int
GasUsed *big.Int
Time *big.Int
Transactions []Transaction
}
func GethBlockToCoreBlock(gethBlock *types.Block) Block {
2017-10-31 13:58:04 +00:00
transactions := []Transaction{}
for _, gethTransaction := range gethBlock.Transactions() {
transactions = append(transactions, gethTransToCoreTrans(gethTransaction))
}
return Block{
2017-10-31 13:58:04 +00:00
Number: gethBlock.Number(),
GasLimit: gethBlock.GasLimit(),
GasUsed: gethBlock.GasUsed(),
Time: gethBlock.Time(),
Transactions: transactions,
}
}