2018-02-21 04:57:52 +00:00
|
|
|
package sharding
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
|
|
)
|
|
|
|
|
2018-05-03 20:37:28 +00:00
|
|
|
// TODO: this test needs to change as we will be serializing tx's into blobs
|
|
|
|
// within the collation body instead.
|
2018-02-22 03:39:51 +00:00
|
|
|
|
2018-05-03 20:37:28 +00:00
|
|
|
// func TestCollation_AddTransactions(t *testing.T) {
|
|
|
|
// tests := []struct {
|
|
|
|
// transactions []*types.Transaction
|
|
|
|
// }{
|
|
|
|
// {
|
|
|
|
// transactions: []*types.Transaction{
|
|
|
|
// makeTxWithGasLimit(0),
|
|
|
|
// makeTxWithGasLimit(1),
|
|
|
|
// makeTxWithGasLimit(2),
|
|
|
|
// makeTxWithGasLimit(3),
|
|
|
|
// },
|
|
|
|
// }, {
|
|
|
|
// transactions: []*types.Transaction{},
|
|
|
|
// },
|
|
|
|
// }
|
2018-02-21 04:57:52 +00:00
|
|
|
|
2018-05-03 20:37:28 +00:00
|
|
|
// for _, tt := range tests {
|
|
|
|
// c := &Collation{}
|
|
|
|
// for _, tx := range tt.transactions {
|
|
|
|
// c.AddTransaction(tx)
|
|
|
|
// }
|
|
|
|
// results := c.Transactions()
|
|
|
|
// if len(results) != len(tt.transactions) {
|
|
|
|
// t.Fatalf("Wrong number of transactions. want=%d. got=%d", len(tt.transactions), len(results))
|
|
|
|
// }
|
|
|
|
// for i, tx := range tt.transactions {
|
|
|
|
// if results[i] != tx {
|
|
|
|
// t.Fatalf("Mismatched transactions. wanted=%+v. got=%+v", tt.transactions, results)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2018-02-21 04:57:52 +00:00
|
|
|
|
|
|
|
func makeTxWithGasLimit(gl uint64) *types.Transaction {
|
|
|
|
return types.NewTransaction(0 /*nonce*/, common.HexToAddress("0x0") /*to*/, nil /*amount*/, gl, nil /*gasPrice*/, nil /*data*/)
|
|
|
|
}
|