mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-16 13:06:40 +00:00
Update cliui.go
This commit is contained in:
parent
18a902799e
commit
e7f46d0ec6
1 changed files with 27 additions and 4 deletions
|
|
@ -18,6 +18,7 @@ package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -142,10 +143,32 @@ func (ui *CommandlineUI) ApproveTx(request *SignTxRequest) (SignTxResponse, erro
|
||||||
fmt.Printf(" %v\n", bh)
|
fmt.Printf(" %v\n", bh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if request.Transaction.Data != nil {
|
{
|
||||||
d := *request.Transaction.Data
|
var (
|
||||||
if len(d) > 0 {
|
data []byte
|
||||||
fmt.Printf("data: %v\n", hexutil.Encode(d))
|
inputSet bool
|
||||||
|
dataSet bool
|
||||||
|
)
|
||||||
|
if request.Transaction.Input != nil {
|
||||||
|
data = *request.Transaction.Input
|
||||||
|
inputSet = true
|
||||||
|
}
|
||||||
|
if request.Transaction.Data != nil {
|
||||||
|
dataSet = true
|
||||||
|
if !inputSet {
|
||||||
|
data = *request.Transaction.Data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if inputSet && dataSet && !bytes.Equal(*request.Transaction.Input, *request.Transaction.Data) {
|
||||||
|
fmt.Printf("input: %v\n", hexutil.Encode(*request.Transaction.Input))
|
||||||
|
fmt.Printf("data: %v\n", hexutil.Encode(*request.Transaction.Data))
|
||||||
|
fmt.Printf("WARNING: both input and data provided and differ; input will be used\n")
|
||||||
|
} else if len(data) > 0 {
|
||||||
|
label := "data"
|
||||||
|
if inputSet {
|
||||||
|
label = "input"
|
||||||
|
}
|
||||||
|
fmt.Printf("%s: %v\n", label, hexutil.Encode(data))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if request.Callinfo != nil {
|
if request.Callinfo != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue