Skip to content
This repository was archived by the owner on Jul 20, 2021. It is now read-only.

Conversation

tsvisabo
Copy link
Contributor

@tsvisabo tsvisabo commented Aug 5, 2018

Description

Add new function+call in sweep service to compose a bundle from the minimum number of inputs possible so we don't get a huge bundle

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How Has This Been Tested?

  • A test that check for several cases was added

Checklist:

Please delete items that are not relevant.

  • My code follows the style guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@tsvisabo tsvisabo requested a review from th0br0 as a code owner August 5, 2018 13:49
std::vector<db::TransferInput> minimalVecOfInputs;
getVecOfMinSizeWithSumNotLessThan(missing, hubInputs,
minimalVecOfInputs);
hubInputs.swap(minimalVecOfInputs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to amend hubInputTotal as this could vary (required for remainder calculation)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing the change here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hubInputTotal needs to be adjusted with the sum of minimalVecOfInputs.balance.

This is relevant for the remainder on l310

@tsvisabo tsvisabo force-pushed the sweep_service_opt_bundle branch from 3ff0d1e to 60cd46a Compare August 5, 2018 14:21
/// @param[in] olderThan - the cutoff point in time
/// @return std::vector - a list of TransferInput
virtual std::vector<TransferInput> getHubInputsForSweep(
uint64_t requiredAmount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also rename the method to availableHubInputs or similar?

std::vector<db::TransferInput> minimalVecOfInputs;
getVecOfMinSizeWithSumNotLessThan(missing, hubInputs,
minimalVecOfInputs);
hubInputs.swap(minimalVecOfInputs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing the change here

@tsvisabo tsvisabo force-pushed the sweep_service_opt_bundle branch from fdd5106 to 3453aeb Compare August 5, 2018 19:42
…t address as a change address\nso it will be more likely to be picked the next time, (avoid fragmentation)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants