From cd9febd964afc61683dbc60ebed035ef7a5f51aa Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 16 Jan 2018 11:21:28 -0600 Subject: [PATCH] new sharding tx creation Former-commit-id: 49c7d3ec20aef302a78d0b5cca429e82e6db723a [formerly 3226861cee91b190a384b920c97d40532ca35d25] Former-commit-id: c4edba1470e8bc5d6e7cd67c1d9f9269ae6b589e --- sharding/transactions.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sharding/transactions.go b/sharding/transactions.go index 2159ac837..77a1c0191 100644 --- a/sharding/transactions.go +++ b/sharding/transactions.go @@ -32,9 +32,9 @@ type txdata struct { Payload []byte `json:"input" gencodec:"required"` // Sharding specific fields + // TODO: Figure out exact format of accesslist. array of arrays of addr + prefixes? 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. 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} } + +// 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) +}