Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 963f494

Browse files
committed
Database chainhash fix
1 parent 9493d7b commit 963f494

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

repo/db/txns.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (t *TxnsDB) Put(raw []byte, txid, value string, height int, timestamp time.
4141
return nil
4242
}
4343

44-
func (t *TxnsDB) Get(txid chainhash.Hash) (wallet.Txn, error) {
44+
func (t *TxnsDB) Get(txid string) (wallet.Txn, error) {
4545
t.lock.Lock()
4646
defer t.lock.Unlock()
4747
var txn wallet.Txn
@@ -55,7 +55,7 @@ func (t *TxnsDB) Get(txid chainhash.Hash) (wallet.Txn, error) {
5555
var timestamp int
5656
var value string
5757
var watchOnlyInt int
58-
err = stmt.QueryRow(txid.String(), t.coinType.CurrencyCode()).Scan(&raw, &value, &height, &timestamp, &watchOnlyInt)
58+
err = stmt.QueryRow(txid, t.coinType.CurrencyCode()).Scan(&raw, &value, &height, &timestamp, &watchOnlyInt)
5959
if err != nil {
6060
return txn, err
6161
}
@@ -64,7 +64,7 @@ func (t *TxnsDB) Get(txid chainhash.Hash) (wallet.Txn, error) {
6464
watchOnly = true
6565
}
6666
txn = wallet.Txn{
67-
Txid: txid.String(),
67+
Txid: txid,
6868
Value: value,
6969
Height: int32(height),
7070
Timestamp: time.Unix(int64(timestamp), 0),
@@ -127,7 +127,7 @@ func (t *TxnsDB) Delete(txid *chainhash.Hash) error {
127127
return nil
128128
}
129129

130-
func (t *TxnsDB) UpdateHeight(txid chainhash.Hash, height int, timestamp time.Time) error {
130+
func (t *TxnsDB) UpdateHeight(txid string, height int, timestamp time.Time) error {
131131
t.lock.Lock()
132132
defer t.lock.Unlock()
133133

@@ -136,7 +136,7 @@ func (t *TxnsDB) UpdateHeight(txid chainhash.Hash, height int, timestamp time.Ti
136136
return fmt.Errorf("prepare txn sql: %s", err.Error())
137137
}
138138
defer stmt.Close()
139-
_, err = stmt.Exec(height, int(timestamp.Unix()), txid.String(), t.coinType.CurrencyCode())
139+
_, err = stmt.Exec(height, int(timestamp.Unix()), txid, t.coinType.CurrencyCode())
140140
if err != nil {
141141
return fmt.Errorf("update txns: %s", err.Error())
142142
}

0 commit comments

Comments
 (0)