new sharding tx creation

Former-commit-id: 49c7d3ec20aef302a78d0b5cca429e82e6db723a [formerly 3226861cee91b190a384b920c97d40532ca35d25]
Former-commit-id: c4edba1470e8bc5d6e7cd67c1d9f9269ae6b589e
This commit is contained in:
Raul Jordan 2018-01-16 11:21:28 -06:00
parent ccd6c446de
commit cd9febd964

View File

@ -32,9 +32,9 @@ type txdata struct {
Payload []byte `json:"input" gencodec:"required"` Payload []byte `json:"input" gencodec:"required"`
// Sharding specific fields // Sharding specific fields
// TODO: Figure out exact format of accesslist. array of arrays of addr + prefixes?
AccessList []*common.Address `json:"accessList" gencodec:"required"` AccessList []*common.Address `json:"accessList" gencodec:"required"`
ChainID uint64 `json:"chainId" gencodec:"required"`
ShardID uint64 `json:"shardId" gencodec:"required"`
// This is only used when marshaling to JSON. // This is only used when marshaling to JSON.
Hash *common.Hash `json:"hash" rlp:"-"` Hash *common.Hash `json:"hash" rlp:"-"`
} }
@ -79,3 +79,14 @@ func newShardingTransaction(nonce uint64, to *common.Address, amount *big.Int, g
return &ShardingTransaction{data: d} return &ShardingTransaction{data: d}
} }
// ChainID determines the chain the tx will go into (this is 1 on the mainnet)
func (tx *ShardingTransaction) ChainID() *big.Int {
return big.NewInt(1)
}
// ShardID determines the shard a transaction belongs to
func (tx *ShardingTransaction) ShardID() *big.Int {
// TODO: figure out how to determine ShardID. 1 for now
return big.NewInt(1)
}