Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: lock in fee after checking #28

Merged
merged 4 commits into from
Jun 29, 2018
Merged

Fix: lock in fee after checking #28

merged 4 commits into from
Jun 29, 2018

Conversation

sharafian
Copy link

After checking whether a claim is profitable, the fee with which the calculation was made is used as the max fee. This prevents a scenario where the fee is deemed OK, but then rises when the transaction is submitted.

I think this is the root cause of codius/codiusd#77

index.js Outdated
@@ -293,33 +293,45 @@ class Plugin extends BtpPlugin {
await this._writeQueue
}

await this._claimFunds()
// runs autoclaim in order to ensure that this claim is profitable
await this._autoClaim()

clearInterval(this._claimIntervalId)
debug('done')
}

async _isClaimProfitable () {
Copy link
Contributor

Choose a reason for hiding this comment

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

_isClaimProfitable made sense as a function name when it returned a boolean. Now that it returns profitable as well, maybe _getFeeInfo or similar?

index.js Outdated
publicKey: this._paychan.publicKey
publicKey: this._paychan.publicKey,
}, {
maxFeeXrp
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#transaction-instructions I think that field is deprecated. I'll upgrade ripple-lib to make sure that it supports the new name

Copy link
Contributor

@sentientwaffle sentientwaffle left a comment

Choose a reason for hiding this comment

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

Lint fails from /home/ubuntu/ilp-plugin-xrp-asym-client/index.js:347:41: Unexpected trailing comma.. Other than that LGTM

@codecov-io
Copy link

Codecov Report

Merging #28 into master will increase coverage by 0.94%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   43.96%   44.91%   +0.94%     
==========================================
  Files           1        1              
  Lines         232      236       +4     
==========================================
+ Hits          102      106       +4     
  Misses        130      130
Impacted Files Coverage Δ
index.js 44.91% <88.88%> (+0.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aadc6ac...bd87baf. Read the comment docs.

@sharafian sharafian merged commit fc543a1 into master Jun 29, 2018
@sharafian sharafian deleted the bs-max-fee-xrp branch June 29, 2018 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants