HomePhabricator

[ecash-agora] Get true minimum buy amounts for agora offers

Description

[ecash-agora] Get true minimum buy amounts for agora offers

Summary:
Depends on D16919

Discovered some unhandled cases in implementing agora partials in Cashtab.

  1. Using the library as is, it is possible to create an AgoraPartial offer where the price of the minimum accepted offer is less than dust. In this case, that's not really the price...the price dust / min qty.

I made sure such an offer could not be created with Cashtab validation. But it's the kind of thing better handled at the lib level.

  1. minAcceptedTokens() is not necessarily the true minimum accepted tokens for an offer. Since only discrete quantities may be accepted, you must prepareAcceptedTokens(minAcceptedTokens) to get the true min. However, prepareAcceptedTokens may return a value lower than minAcceptedTokens...which will cause an agora offer for such an amount to fail script sig verify.

Update the minAcceptedTokens() to return the true min, i.e. the lowest possible discrete interval above minAcceptedTokens().

Test Plan: npm test

Reviewers: #bitcoin_abc, tobias_ruck

Reviewed By: #bitcoin_abc, tobias_ruck

Subscribers: tobias_ruck

Differential Revision: https://reviews.bitcoinabc.org/D16920

Details

Provenance
bytesofmanAuthored on Thu, Oct 17, 22:26
bytesofmanPushed on Sat, Oct 19, 23:57
Reviewer
Restricted Project
Differential Revision
D16920: [ecash-agora] Get true minimum buy amounts for agora offers
Parents
rABC60bc19cc89cc: [ecash-herald] Improve logs and bump number of blocks to check for 24 hr window
Branches
Unknown
Tags
Unknown