cmd/clef: avoid using unkeyed struct fields

This commit is contained in:
Felix Lange 2019-11-15 12:20:30 +01:00
parent eaa3523c0b
commit 558a198602

View file

@ -760,21 +760,19 @@ func testExternalUI(api *core.SignerAPI) {
api.UI.ShowInfo("Please approve the next request for signing a clique header") api.UI.ShowInfo("Please approve the next request for signing a clique header")
time.Sleep(delay) time.Sleep(delay)
cliqueHeader := types.Header{ cliqueHeader := types.Header{
common.HexToHash("0000H45H"), ParentHash: common.HexToHash("0000H45H"),
common.HexToHash("0000H45H"), UncleHash: common.HexToHash("0000H45H"),
common.HexToAddress("0000H45H"), Coinbase: common.HexToAddress("0000H45H"),
common.HexToHash("0000H00H"), Root: common.HexToHash("0000H00H"),
common.HexToHash("0000H45H"), TxHash: common.HexToHash("0000H45H"),
common.HexToHash("0000H45H"), ReceiptHash: common.HexToHash("0000H45H"),
types.Bloom{}, Difficulty: big.NewInt(1337),
big.NewInt(1337), Number: big.NewInt(1337),
big.NewInt(1337), GasLimit: 1338,
1338, GasUsed: 1338,
1338, Time: 1338,
1338, Extra: []byte("Extra data Extra data Extra data Extra data Extra data Extra data Extra data Extra data"),
[]byte("Extra data Extra data Extra data Extra data Extra data Extra data Extra data Extra data"), MixDigest: common.HexToHash("0x0000H45H"),
common.HexToHash("0x0000H45H"),
types.BlockNonce{},
} }
cliqueRlp, err := rlp.EncodeToBytes(cliqueHeader) cliqueRlp, err := rlp.EncodeToBytes(cliqueHeader)
if err != nil { if err != nil {
@ -938,7 +936,7 @@ func GenDoc(ctx *cli.Context) {
"of the work in canonicalizing and making sense of the data, and it's up to the UI to present" + "of the work in canonicalizing and making sense of the data, and it's up to the UI to present" +
"the user with the contents of the `message`" "the user with the contents of the `message`"
sighash, msg := accounts.TextAndHash([]byte("hello world")) sighash, msg := accounts.TextAndHash([]byte("hello world"))
messages := []*core.NameValueType{{"message", msg, accounts.MimetypeTextPlain}} messages := []*core.NameValueType{{Name: "message", Value: msg, Typ: accounts.MimetypeTextPlain}}
add("SignDataRequest", desc, &core.SignDataRequest{ add("SignDataRequest", desc, &core.SignDataRequest{
Address: common.NewMixedcaseAddress(a), Address: common.NewMixedcaseAddress(a),
@ -969,8 +967,8 @@ func GenDoc(ctx *cli.Context) {
add("SignTxRequest", desc, &core.SignTxRequest{ add("SignTxRequest", desc, &core.SignTxRequest{
Meta: meta, Meta: meta,
Callinfo: []core.ValidationInfo{ Callinfo: []core.ValidationInfo{
{"Warning", "Something looks odd, show this message as a warning"}, {Typ: "Warning", Message: "Something looks odd, show this message as a warning"},
{"Info", "User should see this aswell"}, {Typ: "Info", Message: "User should see this as well"},
}, },
Transaction: core.SendTxArgs{ Transaction: core.SendTxArgs{
Data: &data, Data: &data,
@ -1036,16 +1034,21 @@ func GenDoc(ctx *cli.Context) {
&core.ListRequest{ &core.ListRequest{
Meta: meta, Meta: meta,
Accounts: []accounts.Account{ Accounts: []accounts.Account{
{a, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/a"}}, {Address: a, URL: accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/a"}},
{b, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/b"}}}, {Address: b, URL: accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/b"}}},
}) })
add("ListResponse", "Response to list request. The response contains a list of all addresses to show to the caller. "+ add("ListResponse", "Response to list request. The response contains a list of all addresses to show to the caller. "+
"Note: the UI is free to respond with any address the caller, regardless of whether it exists or not", "Note: the UI is free to respond with any address the caller, regardless of whether it exists or not",
&core.ListResponse{ &core.ListResponse{
Accounts: []accounts.Account{ Accounts: []accounts.Account{
{common.HexToAddress("0xcowbeef000000cowbeef00000000000000000c0w"), accounts.URL{Path: ".. ignored .."}}, {
{common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff"), accounts.URL{}}, Address: common.HexToAddress("0xcowbeef000000cowbeef00000000000000000c0w"),
URL: accounts.URL{Path: ".. ignored .."},
},
{
Address: common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff"),
},
}}) }})
} }