fix(wallet) fix scan to/from hash when for multi_transactions

This commit is contained in:
Stefan 2023-07-12 22:51:43 +01:00 committed by Stefan Dunca
parent 9ee523be99
commit 8bfcb80ed6
1 changed files with 9 additions and 2 deletions

View File

@ -120,15 +120,16 @@ func rowsToMultiTransactions(rows *sql.Rows) ([]*MultiTransaction, error) {
for rows.Next() {
multiTransaction := &MultiTransaction{}
var fromAmountDB, toAmountDB sql.NullString
var fromTxHash, toTxHash sql.RawBytes
err := rows.Scan(
&multiTransaction.ID,
&multiTransaction.FromNetworkID,
&multiTransaction.FromTxHash,
&fromTxHash,
&multiTransaction.FromAddress,
&multiTransaction.FromAsset,
&fromAmountDB,
&multiTransaction.ToNetworkID,
&multiTransaction.ToTxHash,
&toTxHash,
&multiTransaction.ToAddress,
&multiTransaction.ToAsset,
&toAmountDB,
@ -136,6 +137,12 @@ func rowsToMultiTransactions(rows *sql.Rows) ([]*MultiTransaction, error) {
&multiTransaction.CrossTxID,
&multiTransaction.Timestamp,
)
if len(fromTxHash) > 0 {
multiTransaction.FromTxHash = common.BytesToHash(fromTxHash)
}
if len(toTxHash) > 0 {
multiTransaction.ToTxHash = common.BytesToHash(toTxHash)
}
if err != nil {
return nil, err
}