Thanks for the suggestion, tx.addOutput(Coin.ZERO, new ScriptBuilder().op(OP_RETURN).data(pubKeyHash).build());
does the job. Of course, I'm interested to know whether a less hacky solution exists. вторник, 10 апреля 2018 г., 18:42:10 UTC+3 пользователь Andreas Schildbach написал: > > [+cc Jonas Schnelli, as I discussed this topic with him last year.] > > Hmmm, indeed that sounds bad. I totally overlooked this case. Seems like > BIP37 needs to be amended to include the witness in filter matching. > However, on nodes that prune the witnesses this won't work either. > > P2WPKH-P2SH doesn't seem to have this problem, as it contains the > 20-byte key hash in its scriptSig. > > Of course as a workaround you could make sure there is always a change > back to you. Maybe to not waste coins/UTXOs create an OP_RETURN > containing one of the pubkeys? > > I wonder if the new client-side filtering (BIP157) has the same problem? > > > On 04/09/2018 05:51 PM, Anton wrote: > > I'm currently experimenting with making a native segwit wallet here: > > https://github.com/btcontract/bitcoinj by merging current master with > > segwit address support and a > > https://github.com/bitcoinj/bitcoinj/tree/segwit branch. > > I've got to a point where wallet can receive and send transactions but > > have stumbled into an issue which may become relevant once bitcoinj > > master starts supporting native segwit wallets. > > > > The issue is that once a transaction without change (the one which > > empties a wallet) is sent out it won't be seen by wallet again after > > blockchain rescan or restoring from seed. > > > > As far as I understand the issue is two-fold: > > 1. tx scriptSig is empty and does not contain a relevant `pubKey` (it's > > located in a witness). > > 2. none of tx outputs contain `pubKeyHash`es relevant to a wallet. > > > > Any thoughts if my understanding is correct and what can be done about > it? > > > > -- > > 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 bitcoinj+u...@googlegroups.com <javascript:> > > <mailto:bitcoinj+u...@googlegroups.com <javascript:>>. > > 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 bitcoinj+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.