If you set it up correctly, you don't need to reset your chain or
anything like that. Using Wallet.autosaveToFile() makes sure the wallet
saves itself in an atomical way. If on reload the wallet detects it is
behind the block store for some reason (can happen because of server
crashes) it will automatically rewind the block store.

This means if onCoinsReceived was called because of an incoming tx and
then the server crashed before it had a change to write the tx to disk,
on restart it will request the same block(s) again and call
onCoinsReceived again for the same tx.


On 08/28/2017 12:42 PM, 'Martin Bauer' via bitcoinj wrote:
> Hi Andreas,
> 
> so .. shall i use:
> 
> void onCoinsReceived(Wallet
> <https://bitcoinj.github.io/javadoc/0.14.5/org/bitcoinj/wallet/Wallet.html> 
> wallet,
>                      Transaction
> <https://bitcoinj.github.io/javadoc/0.14.5/org/bitcoinj/core/Transaction.html>
>  tx,
>                      Coin 
> <https://bitcoinj.github.io/javadoc/0.14.5/org/bitcoinj/core/Coin.html> 
> prevBalance,
>                      Coin 
> <https://bitcoinj.github.io/javadoc/0.14.5/org/bitcoinj/core/Coin.html> 
> newBalance)
> 
> which should process the 'block' which is downloaded from the chain which 
> keeps the transaction which was confirmed in the time of the server beeing 
> shut down ?
> 
> 
> 
> 
> 
> 
> Am Montag, 28. August 2017 08:45:17 UTC+2 schrieb Andreas Schildbach:
> 
>     Pending transactions get re-broadcasted to you by your peers until
>     they're confirmed. That means after a server restart you only need to
>     connect to peers again.
> 
>     If meanwhile the payment gets included into the blockchain, you should
>     still receive it once in a block. You only need to make sure that your
>     server doesn't forget transactions received in a block. Or if it does,
>     at least keep an accurate block height so next time you request the
>     last
>     (missed) blocks again.
> 
> 
>     On 08/27/2017 11:09 PM, 'Martin Bauer' via bitcoinj wrote:
>     > Hi,
>     >
>     > i have some questions belonging to problems after having made lots of
>     > transactions with this wallet.
>     >  
>     > I would like to implement a webstore - everything works fine - i
>     receive
>     > transaction by
>     >
>     
> "addTransactionConfidenceEventListener(TransactionConfidenceEventListener)".
> 
>     > In case of a server breakdown - the server can not see the incomming
>     > transaction. In my tests - after 'not' receiving some coins
>     without to
>     > be online the system did not fire
>     > events for the missed transactions after it was online again. How
>     can i
>     > 'notice' that a customer has paid the money to his wallet-address?
>     >
>     > I read the documentation - and i found:
>     >
>     >   wallet().getTransactionsByTime()
>     >   wallet().getRecentTransaction(....)
>     >   Wallet.reset()    (-> did not work !!)
>     >
>     > I tried to use them - and it solves (theoretically) my problem, BUT i
>     > have some questions/concerns/issues:
>     >
>     > 1) in case of using getRecentTransaction - what is the best/correct
>     > number of "number of transaction"?  Integer.Max ? An number
>     > calculated by (average_transactions_per_hour *
>     time_of_server_offline *
>     > failure_save_factor). ? Any hints? Ideas ?
>     > Another idea is to start with e.g. 500. And if the first 500 did not
>     > have a allready processed entry - get 1000... and so on .... util
>     a well
>     > known trnasaction has been reached.
>     >
>     > I just need the (unkown) last transactions until the last processed
>     > transaction is in the list. (I store the processed transaction in my
>     > database)
>     >
>     > 2) In case of getTransactionsByTime() - imagine having a big big
>     > webstore for a long time with really many many many many
>     transactions.
>     > How big will the list be? All transactions from beginning of the
>     life of
>     > the wallet? Might be very very many entries so will i get a
>     > "outOfMemory" Problem?
>     > Would it be a good idea to change the wallet after some time and
>     start
>     > with a 'brand new' wallet to get rid of the old processed
>     transactions?
>     >
>     >
>     > Thank you in helping to anser my problems
>     >
>     > --
>     > 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
>     > <mailto:bitcoinj+u...@googlegroups.com>.
>     > 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 bitcoinj+unsubscr...@googlegroups.com
> <mailto:bitcoinj+unsubscr...@googlegroups.com>.
> 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.

Reply via email to