@@ -11,6 +11,7 @@ import (
11
11
"math"
12
12
13
13
errors2 "github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
14
+ "github.com/hyperledger-labs/fabric-smart-client/platform/common/core"
14
15
"github.com/hyperledger-labs/fabric-smart-client/platform/common/core/generic/vault"
15
16
"github.com/hyperledger-labs/fabric-smart-client/platform/common/utils"
16
17
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/db/driver"
@@ -65,7 +66,7 @@ func NewSimpleTXIDStore[V vault.ValidationCode](persistence driver.Persistence,
65
66
}, nil
66
67
}
67
68
68
- func (s * SimpleTXIDStore [V ]) get (txID string ) (* ByTxid , error ) {
69
+ func (s * SimpleTXIDStore [V ]) get (txID core. TxID ) (* ByTxid , error ) {
69
70
bytes , err := s .persistence .GetState (txidNamespace , keyByTxID (txID ))
70
71
if err != nil {
71
72
return nil , errors .Errorf ("error retrieving txid %s [%s]" , txID , err .Error ())
@@ -84,7 +85,7 @@ func (s *SimpleTXIDStore[V]) get(txID string) (*ByTxid, error) {
84
85
return bt , nil
85
86
}
86
87
87
- func (s * SimpleTXIDStore [V ]) Get (txID string ) (V , string , error ) {
88
+ func (s * SimpleTXIDStore [V ]) Get (txID core. TxID ) (V , string , error ) {
88
89
bt , err := s .get (txID )
89
90
if err != nil {
90
91
return s .vcProvider .Unknown (), "" , err
@@ -97,7 +98,7 @@ func (s *SimpleTXIDStore[V]) Get(txID string) (V, string, error) {
97
98
return s .vcProvider .FromInt32 (bt .Code ), bt .Message , nil
98
99
}
99
100
100
- func (s * SimpleTXIDStore [V ]) Set (txID string , code V , message string ) error {
101
+ func (s * SimpleTXIDStore [V ]) Set (txID core. TxID , code V , message string ) error {
101
102
// NOTE: we assume that the commit is in progress so no need to update/commit
102
103
// err := s.persistence.BeginUpdate()
103
104
// if err != nil {
@@ -161,7 +162,7 @@ func (s *SimpleTXIDStore[V]) Set(txID string, code V, message string) error {
161
162
return nil
162
163
}
163
164
164
- func (s * SimpleTXIDStore [V ]) GetLastTxID () (string , error ) {
165
+ func (s * SimpleTXIDStore [V ]) GetLastTxID () (core. TxID , error ) {
165
166
v , err := s .persistence .GetState (txidNamespace , lastTX )
166
167
if err != nil {
167
168
return "" , errors .Wrapf (err , "failed to get last TxID" )
@@ -248,12 +249,6 @@ func (i *SimpleTxIDIterator) Next() (*ByNum, error) {
248
249
return nil , err
249
250
}
250
251
return bn , err
251
-
252
- //return &vault.ByNum[V]{
253
- // TxID: bn.Txid,
254
- // Code: fdriver.ValidationCode(bn.Code),
255
- // Message: bn.Message,
256
- //}, nil
257
252
}
258
253
259
254
func (i * SimpleTxIDIterator ) Close () {
@@ -267,7 +262,7 @@ func keyByCtr(ctr uint64) string {
267
262
return byCtrPrefix + string (ctrBytes [:])
268
263
}
269
264
270
- func keyByTxID (txID string ) string {
265
+ func keyByTxID (txID core. TxID ) string {
271
266
return byTxidPrefix + txID
272
267
}
273
268
0 commit comments