DeFiCh / DeFiCh/ain

Update `CFuturesUserKey` to have `owner` as the first

Open
#1,202 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
397
Forks
129
PR merge metrics
No merged PRs in 30d

Description

#### What would you like to be added:
currently
```
struct CFuturesUserKey {
uint32_t height;
CScript owner;
uint32_t txn;
```

update it to
```
struct CFuturesUserKey {
CScript owner;
uint32_t height;
uint32_t txn;
```

#### Why is this needed:

Improves perf for `getpendingfutureswaps` RPC.

currently `ForEachFuturesUserValues ` is used in following locations
https://github.com/DeFiCh/ain/blob/e63ae12e399b846c5f97dbf3cb1e771f75263255/src/validation.cpp#L3354
https://github.com/DeFiCh/ain/blob/e63ae12e399b846c5f97dbf3cb1e771f75263255/src/validation.cpp#L3407
https://github.com/DeFiCh/ain/blob/e63ae12e399b846c5f97dbf3cb1e771f75263255/src/validation.cpp#L3434

should not be a problem if we change the index order.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.