コード例 #1
0
ファイル: historydb_test.go プロジェクト: skycoin/skycoin
func newBlock(prev coin.Block, currentTime uint64, unspent coin.UnspentPool,
	txns coin.Transactions, calc coin.FeeCalculator) coin.Block {
	if len(txns) == 0 {
		log.Panic("Refusing to create block with no transactions")
	}
	fee, err := txns.Fees(calc)
	if err != nil {
		// This should have been caught earlier
		log.Panicf("Invalid transaction fees: %v", err)
	}
	body := coin.BlockBody{txns}
	return coin.Block{
		Head: newBlockHeader(prev.Head, unspent, currentTime, fee, body),
		Body: body,
	}
}