Update api.go

This commit is contained in:
Snezhkko 2025-11-02 16:04:13 +02:00 committed by GitHub
parent e7f46d0ec6
commit c0b4b2bf79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -497,19 +497,21 @@ func logDiff(original *SignTxRequest, new *SignTxResponse) bool {
modified = true modified = true
log.Info("Value changed by UI", "was", v0, "is", v1) log.Info("Value changed by UI", "was", v0, "is", v1)
} }
if d0, d1 := original.Transaction.Data, new.Transaction.Data; d0 != d1 { // Compare effective calldata (prefer Input over Data)
d0s := "" var oldData, newData []byte
d1s := "" if original.Transaction.Input != nil {
if d0 != nil { oldData = *original.Transaction.Input
d0s = hexutil.Encode(*d0) } else if original.Transaction.Data != nil {
} oldData = *original.Transaction.Data
if d1 != nil { }
d1s = hexutil.Encode(*d1) if new.Transaction.Input != nil {
} newData = *new.Transaction.Input
if d1s != d0s { } else if new.Transaction.Data != nil {
modified = true newData = *new.Transaction.Data
log.Info("Data changed by UI", "was", d0s, "is", d1s) }
} if !bytes.Equal(oldData, newData) {
modified = true
log.Info("Data changed by UI", "was", hexutil.Encode(oldData), "is", hexutil.Encode(newData))
} }
if n0, n1 := original.Transaction.Nonce, new.Transaction.Nonce; n0 != n1 { if n0, n1 := original.Transaction.Nonce, new.Transaction.Nonce; n0 != n1 {
modified = true modified = true