- Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Copied from #258 for discussion.
[Is]
processTxactually over complicating things more than it should?
Why do we need anything other than the unspents?
The Wallet should probably just contain all unspents, and as unspents usually have an accompanying confirmations field, we could just feed that in and put in a parameterized minimum confirmations for the following functions:
- getBalance
- getUnspentOutputs
- createTransaction
There is never going to be a 'catch-all' Wallet design, so maybe we should just make this one as simple as possible?
In what scenario isprocessTransactionactually useful unless we start including support for non-addressablescriptPubKeys anyway (arguably could still avoid it then)?
This is basically an exact contradiction to [some of the changes I made in #258]... but I've made the issue more transparently 2-sided with [#258].
Anything more complicated than this would be context specific anyway.My [other] gripe with
processTransactionright now is the fact that if you don't process transactions in exact chronological order, then there is the real possibility for missed spends and invalid unspent outputs to occur inside theWallet.
The only way to work around this is to ensure that all transactions are correctly chained and processed in accordance to their graph-like structure. Thankfully its acyclic at least.
[Still], it would require a lot more support code which we probably don't need to provide with bitcoinjs-lib. Therefore I vote to veto and removeprocessTransactioncompletely in2.0.0, and completely contradict my self from #258, by saying unspents should be the only way to deal with the Wallet in future.
This kind of sucks, but I think we'll see 2.0.0 sooner than we'd like, simply because this was part of the library I just didn't have time to get around to until now (in terms of my involvement).