Hi Andreas.
Thanks so much for your reply and direct.
I understand that a pending transaction alone doesn't guarantee much.
Normally, we will monitor the transaction directly by the blockchain
explorer or by our wallet automatically (if the txouts point to the address
owned by our wallet). However, in my situation, I have to sync and collect
the confidence future of tranctions which doesn't have direct connections
with my wallet.
I thought that I just got the pending transaction. I can re-broadcast the
trasaction and add some listeners to finish this.So I do following things:
Transaction authTx = new Transaction(bitcoin.params(),txBytes);
bitcoin.peerGroup().broadcastTransaction(authTx);
bitcoin.wallet().commitTx(authTx);
Main.bitcoin.peerGroup().addBlocksDownloadedEventListener(new
BlocksDownloadedEventListener() {........}
authTx.getConfidence().addEventListener(new TransactionConfidence.Listener()
{...........}
However, nothing happens and works. The world is silent. I just got these
notations:
16:09:15.679 [nioEventLoopGroup-3-1] INFO org.bitcoinj.core.PeerGroup -
Transaction source unknown, setting to SELF:
da9e190f834af5b70e404767c651f6395530c4fdfd525de820e5d411ad41c61a
16:09:15.679 [nioEventLoopGroup-3-1] INFO
org.bitcoinj.core.TransactionBroadcast - Waiting for 10 peers required for
broadcast, we have 12 ...
16:09:15.679 [nioEventLoopGroup-3-1] INFO
org.bitcoinj.core.TransactionBroadcast - broadcastTransaction: We have 12
peers, adding
da9e190f834af5b70e404767c651f6395530c4fdfd525de820e5d411ad41c61a to the
memory pool
16:09:15.679 [nioEventLoopGroup-3-1] INFO
org.bitcoinj.core.TransactionBroadcast - Sending to 6 peers, will wait for
3, sending to:
[2001:4800:7818:103:be76:4eff:fe05:ebaf]:18333,[178.21.118.174]:18333,[107.182.230.232]:18333,[45.76.85.210]:18333,[159.122.96.207]:18333,[2600:3c01:0:0:f03c:91ff:fe91:6a51]:18333
16:09:15.680 [nioEventLoopGroup-3-1] INFO org.bitcoinj.wallet.Wallet -
commitTx of da9e190f834af5b70e404767c651f6395530c4fdfd525de820e5d411ad41c61a
16:09:15.681 [nioEventLoopGroup-3-1] INFO org.bitcoinj.wallet.Wallet -
->pending: da9e190f834af5b70e404767c651f6395530c4fdfd525de820e5d411ad41c61a
16:09:15.681 [nioEventLoopGroup-3-1] INFO org.bitcoinj.wallet.Wallet -
Estimated balance is now: 3.37078953 BTC
16:09:15.682 [nioEventLoopGroup-3-1] INFO org.bitcoinj.wallet.WalletFiles
- Saving wallet; last seen block is height 1123359, date
2017-05-15T08:02:52Z, hash
00000000000001b05d0f25ec3b410da3ec1cab18e715e75caa77422f6d64e257
16:09:15.696 [nioEventLoopGroup-3-1] INFO org.bitcoinj.wallet.WalletFiles
- Save completed in 13.73 ms
16:09:15.697 [JavaFX Application Thread] INFO
org.bitcoinj.core.TransactionBroadcast - broadcastTransaction: TYPE: TX
da9e190f834af5b70e404767c651f6395530c4fdfd525de820e5d411ad41c61a seen by 0
peers
After this, the world is silent. However, the tx has been received by the
blockchain in the next few minutes. But my wallet sync and monitor nothing.
Does my code lack important settings or the thought and approach is totally
wrong?
在 2017年5月15日星期一 UTC+8下午3:52:49,Andreas Schildbach写道:
>
> Confidence is basically something that you build yourself. When
> receiving a transaction directly (e.g. via Bluetooth) confidence should
> depend a lot on the existing relationship to the partner, since a
> pending transaction alone doesn't guarantee much.
>
> The default implementation builds confidence by receiving the
> transaction from other peers it has randomly connected to, and of course
> by receiving it via the blockchain.
>
>
> On 05/13/2017 10:29 PM, vivid wang wrote:
> > Suppose your partner build a valid tx and send it to you
> > by tx.bitcoinSerialize() as soon as he broadcasts it, is there any
> > method to sync the tx confidence only by your wallet and the
> > deserialized tx?
> > I have tried to add confidence listener, use wallet.commitTx(), or
> > bitcoin.peerGroup.broadcast(tx) ,but these totally doesn't work.
> > Listeners doesn't get any feedback, and it's wired to find
> > peerGroup.broadcast(tx) stuck to "the TX has witnessed by 0 peers".
> > I have searched the former posts ,and found Mike has said
> > that" Confidence won't change unless the wallet contains transactions
> > and keys *before* syncing the block chain."
> > Does that mean the wallet has no means to listen or trace any tx even
> > it's still pending and hasn't been included to any block as long as the
> > tx has no connections with the wallet?
> > Then how to deal with the circumstances that trust consensus
> > application relies?
> > It's very important to me and I'd appreciated it if someone would help
> > 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] <javascript:>
> > <mailto:[email protected] <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 [email protected].
For more options, visit https://groups.google.com/d/optout.