Skip to content

Commit

Permalink
internal/t8ntool: handle rlp txs via stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Jul 28, 2021
1 parent 396a768 commit 071174c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cmd/evm/internal/t8ntool/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type input struct {
Alloc core.GenesisAlloc `json:"alloc,omitempty"`
Env *stEnv `json:"env,omitempty"`
Txs []*txWithKey `json:"txs,omitempty"`
TxRlp string `json:"txsRlp,omitempty"`
}

func Main(ctx *cli.Context) error {
Expand Down Expand Up @@ -221,7 +222,23 @@ func Main(ctx *cli.Context) error {
}
}
} else {
txsWithKeys = inputData.Txs
if len(inputData.TxRlp) > 0 {
// Decode the body of already signed transactions
body := common.FromHex(inputData.TxRlp)
var txs types.Transactions
if err := rlp.DecodeBytes(body, &txs); err != nil {
return err
}
for _, tx := range txs {
txsWithKeys = append(txsWithKeys, &txWithKey{
key: nil,
tx: tx,
})
}
} else {
// JSON encoded transactions
txsWithKeys = inputData.Txs
}
}
// We may have to sign the transactions.
signer := types.MakeSigner(chainConfig, big.NewInt(int64(prestate.Env.Number)))
Expand Down

0 comments on commit 071174c

Please sign in to comment.