Currently, there is no API to remove transactions. In your case, I'd try to create and complete transactions but not commit them to your wallet. Then broadcast and hear what comes back. The first echo of your transaction will commit it to the wallet.
That said, I still think an API to remove would be worthwhile. On 05/10/2016 12:58 PM, Thomas Taylor wrote: > I'm not using whitelisting. Nodes that I am connected to do not relay > the invalid transactions but do not DoS ban me thanks to some extra > logic I have written for bitcoind. All I need to do know is work out how > to remove a pending transaction if it has been rejected from my BitcoinJ > wallet... > > On Wednesday, April 13, 2016 at 1:51:43 PM UTC+1, Jameson Lopp wrote: > > Interesting. In that case, if you're just using your node as a > transaction validator then it might be OK. The big question is > whether or not a node relays invalid transactions from whitelisted > peers - if it does, that could be bad because your node could end up > getting disconnected from its peers because they think it's trying > to attack them. The documentation says that "whitelisted peers > cannot be DoS banned and their transactions are always relayed, even > if they are already in the mempool" thus it could be dangerous. > > - Jameson > > On Wed, Apr 13, 2016 at 6:05 AM, Thomas Taylor <[email protected]> > wrote: > > Thanks for the info Jameson. > > Sending these 'invalid' transactions is part of my application > logic however. I am implementing a lottery in which a node tries > to 'claim' its winnings by trying to spend all of the > transactions it can see with a certain guess. If this guess is > wrong however, the script is not valid and I get this error. > > I will whitelist for now, but I guess I need to change these > misbehaviour rules? > > Tom > > On Tuesday, March 8, 2016 at 2:30:52 PM UTC, Jameson Lopp wrote: > > Thomas, > > Your transaction was invalid in such a way that one of > Bitcoin Core's "peer misbehavior" rules was triggered and > caused bitcoind to forcible close the connection. > > Here is the relevant line of code in Core: > > https://github.com/bitcoin/bitcoin/blob/8b70a64d62c6e64288762d062414cc979f880c54/src/main.cpp#L1803 > > <https://github.com/bitcoin/bitcoin/blob/8b70a64d62c6e64288762d062414cc979f880c54/src/main.cpp#L1803> > > Basically, you need to fix whatever bug in your transaction > creation is causing this, otherwise your bitcoind will kill > the connection every time it receives an invalid > transaction. It may be possible for you to work around the > problem by whitelisting BitcoinJ's IP address inside the > node but I think that would be a band-aid for fixing the > underlying issue. > > - Jameson > > On Mon, Mar 7, 2016 at 5:53 PM, Thomas Taylor > <[email protected]> wrote: > > Using Bitcoinj in regtest, I send a transaction that > gets rejected by a peer I am connected to (in another > Docker container at 172.17.0.1). For my application > purposes, this is expected. > > After rejecting, bitcoinj reports this peer as dead, and > procedes to connect to the local bitcoind instance. > Hence it only sends transactions to itself (at 172.17.0.2)! > > How can I stop this? Note that if the first transaction > is not rejected, it broadcasts fine. Here are some of > the logs: > > [NioClientManager] ERROR org.bitcoinj.core.Peer - > [127.0.0.1]:18444 /Satoshi:0.12.99/: Received Reject: tx > > e8d3b8741c9a37cba5a2c3cf28911eac14be466f2288a721f22056b711c9078a > for reason 'mandatory-script-verify-flag-failed (Script > failed an OP_EQUALVERIFY operation)' (16) > > [NioClientManager] INFO org.bitcoinj.core.PeerGroup - > [127.0.0.1]:18444: Peer died (0 connected, 0 > pending, 1 max) > > [NioClientManager] INFO org.bitcoinj.core.PeerGroup - > Download peer died. Picking a new one. > > [NioClientManager] INFO org.bitcoinj.core.PeerGroup - > Unsetting download peer: [127.0.0.1]:18444 > > [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - > Waiting 1000 msec before next connect attempt to > [172.17.0.2]:18444 > > [Timer-0] ERROR org.bitcoinj.core.Context - Performing > thread fixup: you are accessing bitcoinj via a thread > that has not had any context set on it. > > [Timer-0] ERROR org.bitcoinj.core.Context - This error > has been corrected for, but doing this makes your app > less robust. > > [Timer-0] ERROR org.bitcoinj.core.Context - You should > use Context.propagate() or a > ContextPropagatingThreadFactory. > > [Timer-0] ERROR org.bitcoinj.core.Context - Please refer > to the user guide for more information about this. > > [Timer-0] ERROR org.bitcoinj.core.Context - Thread name > is Timer-0. > > > 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]. > For more options, visit > https://groups.google.com/d/optout > <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 > <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] > <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.
