Consolidate/wcn 887#246
Conversation
|
will rebase with #245 once that's merged |
9889a13 to
82d8f6c
Compare
| it('picks up an awaiting_bitgo accelerate job, submits cpfp params to WP, and PATCHes complete', async () => { | ||
| assert(services.bridge, 'bridge service should be defined'); | ||
| services.bridge.setPendingJobs([makeAwaitingBitgoAccelerateJob()]); | ||
| services.bridge.setPendingJobs([makeAwaitingBitgoMultisigSignJob('accelerate')]); |
There was a problem hiding this comment.
unified these small composer functions to a single func
|
To reviewer(s): what this PR does is similar to what was done in #245 |
| walletId: params.walletId, | ||
| wpSubmitKind: 'consolidateUnspents', | ||
| wpSubmitParams: params.consolidationParams, | ||
| }, |
There was a problem hiding this comment.
consolidationParams includes reqId: requestTracer (a RequestTracer object) which serializes as {} in the bridge job body. Worth stripping it before storing in wpSubmitParams.
There was a problem hiding this comment.
I see, guessing bridge has it's own tracker? Removed here and from handleAccelerate as well, and updates tests!
| function normalizeSingleConsolidateResponse<T>(response: T | T[]): T { | ||
| if (Array.isArray(response)) { | ||
| if (response.length !== 1) { | ||
| throw new BadRequestError( |
There was a problem hiding this comment.
the original sync path silently returned [] for zero consolidations; this now throws a 400. intentional behavior change for the sync path too?
There was a problem hiding this comment.
There was a problem hiding this comment.
Hmmm. In that case maybe you can tune the error message that something went wrong.
Expected single consolidation result, but received ${response.length} results this will not tell the users much. And in which case can the results be even > 1 ?.
There was a problem hiding this comment.
Sure, updated the error messaging for the case i edited (empty list), for >1, messaging stays the same
|
lgtm otherwise |
82d8f6c to
54cd7f2
Compare
This commit refactors the consolidate unspents flow to be asynchronous, similar to the existing sendMany and accelerate flows. The main changes include: - Adding a new WpSubmitKind 'consolidateUnspents' and its handler - Updating the asyncJobWorker to handle the new kind - Refactoring the handleConsolidateUnspents handler to build and send tx Ticket: WCN-887
54cd7f2 to
08cce81
Compare
What
Implements asynchronous consolidate unspent, which will be used when integrated with the Bridge Service
Testing