Skip to content

Commit aebc9f3

Browse files
committed
fix de-list and getTxFromTxHash
1 parent 1347826 commit aebc9f3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

cylinder/client/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ func (c *Client) Subscribe(subscriber, query string, outCapacity ...int) (out <-
9797

9898
// GetTxFromTxHash retrieves the transaction response for the given transaction hash.
9999
// It waits for the transaction to be committed and returns the transaction response or an error if it exceeds timeout.
100-
func (c *Client) GetTxFromTxHash(txHash string) (*sdk.TxResponse, error) {
101-
var err error
100+
func (c *Client) GetTxFromTxHash(txHash string) (txRes *sdk.TxResponse, err error) {
102101
for start := time.Now(); time.Since(start) < c.timeout; {
103-
txRes, err := authtx.QueryTx(c.context, txHash)
102+
txRes, err = authtx.QueryTx(c.context, txHash)
104103
if err != nil {
105104
time.Sleep(c.pollInterval)
106105
continue

x/tss/keeper/grpc_query.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ func (q queryServer) DE(goCtx context.Context, req *types.QueryDERequest) (*type
123123
var des []types.DE
124124
deStore := prefix.NewStore(ctx.KVStore(q.k.storeKey), types.DEStoreKeyPerAddressPrefix(accAddress))
125125
pageRes, err := query.Paginate(deStore, req.Pagination, func(key []byte, value []byte) error {
126-
var de types.DE
127-
q.k.cdc.MustUnmarshal(value, &de)
126+
de := types.ExtractValueFromDEPaginationKey(key)
128127
des = append(des, de)
129128
return nil
130129
})

x/tss/types/keys.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ func ExtractValueFromDEStoreKey(key []byte) (sdk.AccAddress, DE) {
206206
return address, DE{PubD: pubD, PubE: pubE}
207207
}
208208

209+
// ExtractValueFromDEPaginationKey returns DE information that is retrieved from the key
210+
func ExtractValueFromDEPaginationKey(key []byte) DE {
211+
lenPubD := int(key[0])
212+
pubD := key[1 : 1+lenPubD]
213+
pubE := key[2+lenPubD:]
214+
return DE{PubD: pubD, PubE: pubE}
215+
}
216+
209217
// DEStoreKeyPerAddressPrefix returns the prefix of the key for user's DE.
210218
func DEStoreKeyPerAddressPrefix(address sdk.AccAddress) []byte {
211219
return append(append(DEStoreKeyPrefix, byte(len(address))), address...)

0 commit comments

Comments
 (0)