There is currently no way to have bitcoinj filter the list of transactions, you'll have to do that yourself ATM.
We always envisioned having a second, more usecase-oriented list of "payments". This would then represent the list shown to the user. Lightning payments could be visible there too in future (although LN is a layer on top, so not sure if it's the right thing). So far, work on this hasn't started. On 07/08/2017 09:07 AM, Anton wrote: > After an LN payment channel is open there is a constant need to monitor > if it's P2WSH output has been spent, I use `addWatchedScripts` for that > and it works great. The only UX level problem with this approach is when > P2WSH output does get spent a user will see a strange spending tx which > changes nothing in wallet, this may confuse many. > > So what is needed is a way to filter out purely watched transactions > before displaying a tx list on a UI. Currently I do this as follows: > https://github.com/btcontract/bitcoinj/commit/8475c850ef7b5d07ae7b30d605362c2dbea8d0d5, > the code is based on a fact that a purely watched tx does not change > wallet's balance so it's `getValue` is 0 when watched outputs and inputs > are excluded so we can use that when deciding if a given tx should be > displayed. > > This works but I don't like an approach because it feels hacky > (`getValue` is essentially duplicated in `getExcludeWatchedValue`), > perhaps there are much better ways to do that? > > Other simple approaches I was thinking of which won't do: > > - Immediately stop watching a P2WSH output script once it is spent so a > related watched tx won't be shown anymore (won't do because a peer may > attempt to spend a P2WSH output multiple times using different commit > txs which will create a race of double spends and there's no telling > which of them will win, so we need to continue watching a script even > after the first spend is seen to react accordingly). > > - Just filter out all txs which contain a watched P2WSH output in their > inputs (won't do since that will filter out mutual closing tx which does > spend a P2WSH output but is legitimate since it sends money back to > user's wallet) > > Thanks! > > -- > You received this message because you are subscribed to the Google > Groups "bitcoinj" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "bitcoinj" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
