|
|
@ -214,8 +214,8 @@ func NewBlockWithFullTx(b *types.Block, blockArgs *rpc_common.BlockArgs, leader |
|
|
|
Transactions: []*Transaction{}, |
|
|
|
Transactions: []*Transaction{}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for _, tx := range b.Transactions() { |
|
|
|
for idx, _ := range b.Transactions() { |
|
|
|
fmtTx, err := NewTransactionFromBlockHash(b, tx.Hash()) |
|
|
|
fmtTx, err := NewTransactionFromBlockIndex(b, uint64(idx)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
@ -229,16 +229,6 @@ func NewBlockWithFullTx(b *types.Block, blockArgs *rpc_common.BlockArgs, leader |
|
|
|
return blkWithTxs, nil |
|
|
|
return blkWithTxs, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NewTransactionFromBlockHash returns a transaction that will serialize to the RPC representation.
|
|
|
|
|
|
|
|
func NewTransactionFromBlockHash(b *types.Block, hash common.Hash) (*Transaction, error) { |
|
|
|
|
|
|
|
for idx, tx := range b.Transactions() { |
|
|
|
|
|
|
|
if tx.Hash() == hash { |
|
|
|
|
|
|
|
return NewTransactionFromBlockIndex(b, uint64(idx)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil, fmt.Errorf("tx %v not found in block %v", hash, b.Hash().String()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NewTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
|
|
|
|
// NewTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
|
|
|
|
func NewTransactionFromBlockIndex(b *types.Block, index uint64) (*Transaction, error) { |
|
|
|
func NewTransactionFromBlockIndex(b *types.Block, index uint64) (*Transaction, error) { |
|
|
|
txs := b.Transactions() |
|
|
|
txs := b.Transactions() |
|
|
|