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
log.Info("Value changed by UI", "was", v0, "is", v1)
}
if d0, d1 := original.Transaction.Data, new.Transaction.Data; d0 != d1 {
d0s := ""
d1s := ""
if d0 != nil {
d0s = hexutil.Encode(*d0)
}
if d1 != nil {
d1s = hexutil.Encode(*d1)
}
if d1s != d0s {
modified = true
log.Info("Data changed by UI", "was", d0s, "is", d1s)
}
// Compare effective calldata (prefer Input over Data)
var oldData, newData []byte
if original.Transaction.Input != nil {
oldData = *original.Transaction.Input
} else if original.Transaction.Data != nil {
oldData = *original.Transaction.Data
}
if new.Transaction.Input != nil {
newData = *new.Transaction.Input
} else if new.Transaction.Data != nil {
newData = *new.Transaction.Data
}
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 {
modified = true