You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently baron stores the last known blockhash in couchdb. It uses this blockhash on startup with listSinceBlock in order to process incoming payments that may have happened during downtime.
The way we are currently doing this non-ideal because it bloats couchdb with all the deletion and addition of a frequently changing record. Upon every new block it deletes the previous blockhash and adds the new record.
It turns out we do not need to store the last known block hash if we can obtain it from a different part of the database. For example, the most recent transaction blockhash fine to query with listSinceBlock.
Suggested Implementation
At startup query CouchDB to find the most recent transaction blockhash. Use that for listSinceBlock and remember it in memory.
If no transaction has a blockhash, find the created time of the most recent payment request and approximate a blockhash index from any point prior to that time.
If there are no payment requests then just use the current blockhash. There are no incoming payments.
The text was updated successfully, but these errors were encountered:
* No longer store lastBlockHash in CouchDB, close issue #45.
* lastBlockJob's listSinceBlock is missing double-spent transactions so it was failing to update.
Meanwhile its reorg handling was redundant to watchpaymentjob and walletnotify.
Removing reorg handling from lastBlockJob broke reorg_history entirely.
It turns out reorg handling in other codepaths was broken by a few other errors.
* validateTransactionBlock() isReorg was always false, logic bug.
* updatePaymentWithTransaction()'s reorg handling could not work because blockIsValid is
irrelevant to whether or not you should handle reorg/double-spend.
* processReorged* functions were encouraging different windy entry points into reorg handling,
in addition to being inflexible and difficult to trace.
It was simpler to rewrite updatePaymentWithTransaction() to unify all entry points of updatePayment* and
to always handle reorg/double-spent in the same code-path.
It seems to work. All tests pass.
TODO: There is a new noisy "Document update conflict" that we need to detect and hide.
Currently baron stores the last known blockhash in couchdb. It uses this blockhash on startup with listSinceBlock in order to process incoming payments that may have happened during downtime.
The way we are currently doing this non-ideal because it bloats couchdb with all the deletion and addition of a frequently changing record. Upon every new block it deletes the previous blockhash and adds the new record.
It turns out we do not need to store the last known block hash if we can obtain it from a different part of the database. For example, the most recent transaction blockhash fine to query with listSinceBlock.
Suggested Implementation
The text was updated successfully, but these errors were encountered: