HomePhabricator

[ecash-agora] Add validation to _acceptTxBuilder to prevent creation of…

Description

[ecash-agora] Add validation to _acceptTxBuilder to prevent creation of unspendable offers

Summary:
It's possible for an agora partial offer to be accepted in such a way that the remaining quantity is no longer possible to accept. This could happen in 2 ways.

  1. The remaining quantity is below the contract min accepted qty.
  2. The remaining quantity costs less than dust. (Probably still possible to accept this? Though only by overpaying).

Add validation to prevent this type of accept. App devs should also include this type of validation in the front end.

The validation can be disabled by overriding a default param. This is helpful for integration tests, and also allows this lib to cover the full features of the protocol.

Test Plan: npm test, CI

Reviewers: #bitcoin_abc, emack, tobias_ruck

Reviewed By: #bitcoin_abc, emack, tobias_ruck

Subscribers: tobias_ruck, emack

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

Details

Provenance
bytesofmanAuthored on Sun, Oct 20, 00:18
bytesofmanPushed on Fri, Nov 1, 23:08
Reviewer
Restricted Project
Differential Revision
D16944: [ecash-agora] Add validation to _acceptTxBuilder to prevent creation of unspendable offers
Parents
rABC88a5faa04223: Fix lock order inversion in promoteStakeContendersToTip
Branches
Unknown
Tags
Unknown