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