novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

add TransactionConfidence.Source.DIRECT #395

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm currently polishing Bluetooth offline transactions.

I think there should be a way to detect that a transaction has been directed at 
the client, rather than received by a randomly selected peer.

This is to display a warning to the receiver while the tx is still pending.

Directed transactions bear the enhanced risk of being frauded since bitcoinj 
does not validate in SPV mode.

Open for discussion: Should transaction sources override each other, for 
example if we receive a direct transaction first and a little after it arrives 
via the network (or the other way round)? I think it would make sense if 
sources switch from DIRECT to NETWORK only.

Original issue reported on code.google.com by andreas....@gmail.com on 21 Apr 2013 at 3:45

GoogleCodeExporter commented 9 years ago
Well, it'd be weird if the source of something changed like that. Then it 
wouldn't be a source anymore. If you want to show a different message on-screen 
then you could just check broadcastBy as usual and ignore source if there are 
any.

I think a DIRECT source makes sense though.

Original comment by hearn@google.com on 22 Apr 2013 at 10:41

GoogleCodeExporter commented 9 years ago
I wonder if now that we fixed the broadcastBy list, I safely use the condition

confidence.numBroadcastPeers() == 0 && source != SELF

to determine if we received the transaction directly. I'll try it.

Original comment by andreas....@gmail.com on 31 Jan 2014 at 11:52

GoogleCodeExporter commented 9 years ago
Just tried that and it works great. I still think having Source.DIRECT is a 
good idea, but the immediate pressure for having it is not there any more.

Original comment by andreas....@gmail.com on 31 Jan 2014 at 12:21