* [NOD-828] Reimplement FFLDB (#663)
* [NOD-828] Create the database2 package that will some day replace the database package.
* [NOD-828] Implement a "bucket" key mechanism.
* [NOD-828] Move bucket.go into the ffldb2 package.
* [NOD-828] Delete the un-interfaced ffldb package from database2, since we aren't going to be using it anyway.
* [NOD-828] Copy over + fixup flat file structs from the old ffldb.
* [NOD-828] Implement flatFilePath.
* [NOD-828] Implement flatFileStore.write().
* [NOD-828] Implement flatFileStore.read().
* [NOD-828] Implement flatFileStore.rollback().
* [NOD-828] Sync the file to disk at the end of write().
* [NOD-828] Extract crc32ByteOrder to a separate variable.
* [NOD-828] Add a sanity test.
* [NOD-828] Remove context-unrelated methods from the Database interface.
* [NOD-828] Create an ffldb object. Simply work against a context.
* [NOD-828] Open the new database on start.
* [NOD-828] Create the leveldb package.
* [NOD-828] Implement opening/closing leveldb.
* [NOD-828] Implement get/put out of/into leveldb.
* [NOD-828] Implement transactions and make them implement a generic database interface.
* [NOD-828] Write sanity tests for leveldb with and without transactions.
* [NOD-828] Add another case to the transaction sanity test.
* [NOD-828] Implement AppendBlock/RetrieveBlock.
* [NOD-828] Refactor so that concepts such as "block" and "metadata" don't leak into the database package.
* [NOD-828] Add RollbackFlatData to the database interface.
* [NOD-828] Remove anything from dbaccess that I'm not planning to implement as part of this ticket.
* [NOD-828] Implement StoreBlock.
* [NOD-828] Implement FetchBlock.
* [NOD-828] Implement HasBlock.
* [NOD-828] Write a sanity test for block insertion.
* [NOD-828] Implement CurrentFlatDataLocation.
* [NOD-828] Implement storing the current block location.
* [NOD-828] Implement initializing/syncing the flat file block store and the "metadata".
* [NOD-828] Add InitBlockStore to TestBlockStoreSanity.
* [NOD-828] Fix rename errors.
* [NOD-828] Fix lint errors in the root database package.
* [NOD-828] Fix lint errors in the ffldb.go.
* [NOD-828] Fix lint errors in the flatfile/db.go.
* [NOD-828] Rename packages in such a way to make the linter happy.
* [NOD-828] Finish satisfying the linter.
* [NOD-828] Fix doc.go.
* [NOD-828] Fix comments in block.go.
* [NOD-828] Move dbaccess out of the database package.
* [NOD-828] Move opening/closing the database to dbaccess.
* [NOD-828] Move the Database interface to the root database package, since it's meant to be generic.
* [NOD-828] Make ffldb generic to later support additional databases.
* [NOD-828] Make ffldb.Open return DatabaseHandle, since ffldb is no longer exported.
* [NOD-828] Fix comments.
* [NOD-828] Rename AppendFlatData to AppendToStore and RetrieveFlatData to RetrieveFromStore.
* [NOD-828] Make buckets nicer to use.
* [NOD-828] Implement cursors that iterate over some bucket.
* [NOD-828] Generalize flat-file repairing and move block database repairing into ffldb.
* [NOD-828] Write a test making sure that flat file repair works.
* [NOD-828] Properly close the database in TestRepairFlatFiles.
* [NOD-828] Add a comment warning against putting and getting the same data within the same transaction.
* [NOD-828] Fix the flatFilesBucket description.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Fix the ffldb description.
* [NOD-828] Rename Database to DataAccessor and rename Handle to Database.
* [NOD-828] Make Get return nil if the value doesn't exist.
* [NOD-828] Attempt to close leveldb even if closing ffdb failed.
* [NOD-828] Fix a bug where the wrong location would be written to the current store location bucket.
* [NOD-828] Fix not updating the store location in ffldb transactions.
* [NOD-828] Make scanFlatFiles return an error if os.Stat fails for any reason other than file-not-found.
* [NOD-828] Update the README and doc.go.
* [NOD-828] Simplify Bucket.Path().
* [NOD-828] Since LevelDBCursor satisfied the database2.Cursor interface, use it directly.
* [NOD-828] Combine two lines into one.
* [NOD-828] Combine another two lines into one.
* [NOD-828] Move a misplaced comment.
* [NOD-828] Use Wrapf instead of Errorf where appropriate.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Fix Wrapf calls.
* [NOD-828] Fix comments.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Add a comment explaining the use of batches and snapshots.
* [NOD-828] Implement RollbackUnlessClosed().
* [NOD-828] Return both errors in StoreBlock rollback.
* [NOD-828] Move rollback-on-error logic into ffldb. Remove CurrentStoreLocation and RollbackStore from DataAccessor.
* [NOD-828] Make bucket a type alias instead of a struct.
* [NOD-828] Fix a typo.
* [NOD-828] Use copy instead of append in Bucket.
* [NOD-828] Extract flatFileLocationSerializedSize to a const.
* [NOD-828] Debugf -> Warnf in rollback.go.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Remove data length from flat file data format.
* [NOD-828] Rearrange TestLevelDBTransactionSanity a bit.
* [NOD-828] Add stack traces to all errors that come out of library functions.
* [NOD-828] Return errors from rollback().
* [NOD-828] Remove an irrelevant comment.
* [NOD-828] Remove redundant whitespace.
* [NOD-828] Handle nil in FetchBlock.
* [NOD-828] Move the explanation about batches and snapshots to the LevelDBTransaction struct.
* Revert "[NOD-828] Make bucket a type alias instead of a struct."
This reverts commit 1fd39652
* [NOD-828] Fix revert errors.
* Revert "[NOD-828] Remove data length from flat file data format."
This reverts commit ef408e32
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-828] Add Delete to DataAccessor.
* [NOD-828] Fix a couple of places that erroneously referenced blocks.
* [NOD-828] Add a comment on top of flatFileLocationSerializedSize.
* [NOD-828] Add Seek to Cursor.
* [NOD-828] Add First to Cursor.
* [NOD-828] Rename db to accessor in Context.
* [NOD-828] Make Get/Fetch calls return a boolean to indicate whether the requested item was found.
* [NOD-828] Name the output parameters of all Get functions.
* [NOD-828] Make RetrieveFromStore return whether the data was found.
* [NOD-887] Add a couple of QoL features to Cursor (#674)
* [NOD-887] Changed First to not return an error.
* [NOD-887] Fix merge error.
* [NOD-887] Make Cursor.Key not return the entire key path.
* [NOD-888] Add RollbackUnlessClosed to Context (#676)
* [NOD-888] Add RollbackUnlessClosed to Context.
* [NOD-888] Fix copy+paste error.
* [NOD-889] Instead of returning a boolean for not-found, return an error (#677)
* [NOD-889] Instead of returning a boolean for not-found, return an error.
* [NOD-889] Wrapped ErrNotFound for Get calls with nicer error messages.
* [NOD-889] Fix format.
* [NOD-889] Fix double space in a comment.
* [NOD-889] Add IsNotFoundError to dbaccess.
* [NOD-862] Replace calls to Tx.StoreBlock, Tx.HasBlock, Tx.FetchBlock with appropriate calls in dbaccess (#672)
* [NOD-828] Create the database2 package that will some day replace the database package.
* [NOD-828] Implement a "bucket" key mechanism.
* [NOD-828] Move bucket.go into the ffldb2 package.
* [NOD-828] Delete the un-interfaced ffldb package from database2, since we aren't going to be using it anyway.
* [NOD-828] Copy over + fixup flat file structs from the old ffldb.
* [NOD-828] Implement flatFilePath.
* [NOD-828] Implement flatFileStore.write().
* [NOD-828] Implement flatFileStore.read().
* [NOD-828] Implement flatFileStore.rollback().
* [NOD-828] Sync the file to disk at the end of write().
* [NOD-828] Extract crc32ByteOrder to a separate variable.
* [NOD-828] Add a sanity test.
* [NOD-828] Remove context-unrelated methods from the Database interface.
* [NOD-828] Create an ffldb object. Simply work against a context.
* [NOD-828] Open the new database on start.
* [NOD-828] Create the leveldb package.
* [NOD-828] Implement opening/closing leveldb.
* [NOD-828] Implement get/put out of/into leveldb.
* [NOD-828] Implement transactions and make them implement a generic database interface.
* [NOD-828] Write sanity tests for leveldb with and without transactions.
* [NOD-828] Add another case to the transaction sanity test.
* [NOD-828] Implement AppendBlock/RetrieveBlock.
* [NOD-828] Refactor so that concepts such as "block" and "metadata" don't leak into the database package.
* [NOD-828] Add RollbackFlatData to the database interface.
* [NOD-828] Remove anything from dbaccess that I'm not planning to implement as part of this ticket.
* [NOD-828] Implement StoreBlock.
* [NOD-828] Implement FetchBlock.
* [NOD-828] Implement HasBlock.
* [NOD-828] Write a sanity test for block insertion.
* [NOD-828] Implement CurrentFlatDataLocation.
* [NOD-828] Implement storing the current block location.
* [NOD-828] Implement initializing/syncing the flat file block store and the "metadata".
* [NOD-828] Add InitBlockStore to TestBlockStoreSanity.
* [NOD-828] Fix rename errors.
* [NOD-828] Fix lint errors in the root database package.
* [NOD-828] Fix lint errors in the ffldb.go.
* [NOD-828] Fix lint errors in the flatfile/db.go.
* [NOD-828] Rename packages in such a way to make the linter happy.
* [NOD-828] Finish satisfying the linter.
* [NOD-828] Fix doc.go.
* [NOD-828] Fix comments in block.go.
* [NOD-828] Move dbaccess out of the database package.
* [NOD-828] Move opening/closing the database to dbaccess.
* [NOD-828] Move the Database interface to the root database package, since it's meant to be generic.
* [NOD-828] Make ffldb generic to later support additional databases.
* [NOD-828] Make ffldb.Open return DatabaseHandle, since ffldb is no longer exported.
* [NOD-828] Fix comments.
* [NOD-828] Rename AppendFlatData to AppendToStore and RetrieveFlatData to RetrieveFromStore.
* [NOD-828] Make buckets nicer to use.
* [NOD-828] Implement cursors that iterate over some bucket.
* [NOD-828] Generalize flat-file repairing and move block database repairing into ffldb.
* [NOD-828] Write a test making sure that flat file repair works.
* [NOD-828] Properly close the database in TestRepairFlatFiles.
* [NOD-828] Add a comment warning against putting and getting the same data within the same transaction.
* [NOD-862] Use dbaccess.HasBlock instead of Tx.HasBlock in initDAGState.
* [NOD-862] Use dbaccess.StoreBlock instead of dbStoreBlock.
* [NOD-862] Use dbaccess.FetchBlock instead of various block fetching mechanisms.
* [NOD-828] Fix the flatFilesBucket description.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Fix the ffldb description.
* [NOD-828] Rename Database to DataAccessor and rename Handle to Database.
* [NOD-828] Make Get return nil if the value doesn't exist.
* [NOD-828] Attempt to close leveldb even if closing ffdb failed.
* [NOD-828] Fix a bug where the wrong location would be written to the current store location bucket.
* [NOD-828] Fix not updating the store location in ffldb transactions.
* [NOD-828] Make scanFlatFiles return an error if os.Stat fails for any reason other than file-not-found.
* [NOD-828] Update the README and doc.go.
* [NOD-828] Simplify Bucket.Path().
* [NOD-828] Since LevelDBCursor satisfied the database2.Cursor interface, use it directly.
* [NOD-828] Combine two lines into one.
* [NOD-828] Combine another two lines into one.
* [NOD-828] Move a misplaced comment.
* [NOD-828] Use Wrapf instead of Errorf where appropriate.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Fix Wrapf calls.
* [NOD-828] Fix comments.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Add a comment explaining the use of batches and snapshots.
* [NOD-828] Implement RollbackUnlessClosed().
* [NOD-828] Return both errors in StoreBlock rollback.
* [NOD-828] Move rollback-on-error logic into ffldb. Remove CurrentStoreLocation and RollbackStore from DataAccessor.
* [NOD-828] Make bucket a type alias instead of a struct.
* [NOD-828] Fix a typo.
* [NOD-828] Use copy instead of append in Bucket.
* [NOD-828] Extract flatFileLocationSerializedSize to a const.
* [NOD-828] Debugf -> Warnf in rollback.go.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Remove data length from flat file data format.
* [NOD-828] Rearrange TestLevelDBTransactionSanity a bit.
* [NOD-828] Add stack traces to all errors that come out of library functions.
* [NOD-828] Return errors from rollback().
* [NOD-828] Remove an irrelevant comment.
* [NOD-828] Remove redundant whitespace.
* [NOD-828] Handle nil in FetchBlock.
* [NOD-828] Implement a dbaccess.BlockNode struct.
* [NOD-828] Move the explanation about batches and snapshots to the LevelDBTransaction struct.
* [NOD-828] Implement toDBBlockNode and fromDBBlockNode.
* Revert "[NOD-828] Make bucket a type alias instead of a struct."
This reverts commit 1fd39652
* [NOD-828] Fix revert errors.
* Revert "[NOD-828] Remove data length from flat file data format."
This reverts commit ef408e32
* [NOD-862] Implement storing index blocks.
* [NOD-862] Use database transactions where appropriate.
* [NOD-862] Fix tests failing on DAGSetup.
* [NOD-862] Fix bad make call.
* [NOD-862] Fix remaining database opening problems in tests.
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-862] Iterate over the new block index in dagio.
* [NOD-862] Fix block index key.
* [NOD-828] Add Delete to DataAccessor.
* [NOD-862] Pass byte slices to dbaccess instead of objects.
* [NOD-862] Fix errors.
* [NOD-862] Fix maybeAcceptBlock not checking block existence.
* [NOD-862] Fix TestAcceptanceIndexRecover.
* [NOD-862] Add comments to StoreBlockIndex and BlockIndexCursor.
* [NOD-828] Fix a couple of places that erroneously referenced blocks.
* [NOD-828] Add a comment on top of flatFileLocationSerializedSize.
* [NOD-828] Add Seek to Cursor.
* [NOD-828] Add First to Cursor.
* [NOD-828] Rename db to accessor in Context.
* [NOD-828] Make Get/Fetch calls return a boolean to indicate whether the requested item was found.
* [NOD-828] Name the output parameters of all Get functions.
* [NOD-828] Make RetrieveFromStore return whether the data was found.
* [NOD-862] Fix merge errors.
* [NOD-862] Fix DAGSetup using bad temp directories.
* [NOD-862] Fix TestProcessDelayedBlocks not closing the database properly.
* [NOD-862] Fix merge errors.
* [NOD-862] Merge flushToDBWithContext and flushToDB.
* [NOD-862] Remove TODO.
* [NOD-862] Add prefix to the temp dir in DAGSetup.
* [NOD-862] Bring back dbFetchBlockByHash.
* [NOD-862] Use BlockDAG.BlockByHash in p2p and rpc.
* [NOD-862] Use daghash.Hash in dbaccess.
* [NOD-862] Add defer to RollbackUnlessClosed after NewTx().
* [NOD-862] Extract dbStoreBlock to a separate function.
* [NOD-862] Fix grammar in comment.
* [NOD-862] Fix merge errors.
* [NOD-867] Migrate database logic in blockdag/dagio.go to dbaccess (#675)
* [NOD-828] Create the database2 package that will some day replace the database package.
* [NOD-828] Implement a "bucket" key mechanism.
* [NOD-828] Move bucket.go into the ffldb2 package.
* [NOD-828] Delete the un-interfaced ffldb package from database2, since we aren't going to be using it anyway.
* [NOD-828] Copy over + fixup flat file structs from the old ffldb.
* [NOD-828] Implement flatFilePath.
* [NOD-828] Implement flatFileStore.write().
* [NOD-828] Implement flatFileStore.read().
* [NOD-828] Implement flatFileStore.rollback().
* [NOD-828] Sync the file to disk at the end of write().
* [NOD-828] Extract crc32ByteOrder to a separate variable.
* [NOD-828] Add a sanity test.
* [NOD-828] Remove context-unrelated methods from the Database interface.
* [NOD-828] Create an ffldb object. Simply work against a context.
* [NOD-828] Open the new database on start.
* [NOD-828] Create the leveldb package.
* [NOD-828] Implement opening/closing leveldb.
* [NOD-828] Implement get/put out of/into leveldb.
* [NOD-828] Implement transactions and make them implement a generic database interface.
* [NOD-828] Write sanity tests for leveldb with and without transactions.
* [NOD-828] Add another case to the transaction sanity test.
* [NOD-828] Implement AppendBlock/RetrieveBlock.
* [NOD-828] Refactor so that concepts such as "block" and "metadata" don't leak into the database package.
* [NOD-828] Add RollbackFlatData to the database interface.
* [NOD-828] Remove anything from dbaccess that I'm not planning to implement as part of this ticket.
* [NOD-828] Implement StoreBlock.
* [NOD-828] Implement FetchBlock.
* [NOD-828] Implement HasBlock.
* [NOD-828] Write a sanity test for block insertion.
* [NOD-828] Implement CurrentFlatDataLocation.
* [NOD-828] Implement storing the current block location.
* [NOD-828] Implement initializing/syncing the flat file block store and the "metadata".
* [NOD-828] Add InitBlockStore to TestBlockStoreSanity.
* [NOD-828] Fix rename errors.
* [NOD-828] Fix lint errors in the root database package.
* [NOD-828] Fix lint errors in the ffldb.go.
* [NOD-828] Fix lint errors in the flatfile/db.go.
* [NOD-828] Rename packages in such a way to make the linter happy.
* [NOD-828] Finish satisfying the linter.
* [NOD-828] Fix doc.go.
* [NOD-828] Fix comments in block.go.
* [NOD-828] Move dbaccess out of the database package.
* [NOD-828] Move opening/closing the database to dbaccess.
* [NOD-828] Move the Database interface to the root database package, since it's meant to be generic.
* [NOD-828] Make ffldb generic to later support additional databases.
* [NOD-828] Make ffldb.Open return DatabaseHandle, since ffldb is no longer exported.
* [NOD-828] Fix comments.
* [NOD-828] Rename AppendFlatData to AppendToStore and RetrieveFlatData to RetrieveFromStore.
* [NOD-828] Make buckets nicer to use.
* [NOD-828] Implement cursors that iterate over some bucket.
* [NOD-828] Generalize flat-file repairing and move block database repairing into ffldb.
* [NOD-828] Write a test making sure that flat file repair works.
* [NOD-828] Properly close the database in TestRepairFlatFiles.
* [NOD-828] Add a comment warning against putting and getting the same data within the same transaction.
* [NOD-862] Use dbaccess.HasBlock instead of Tx.HasBlock in initDAGState.
* [NOD-862] Use dbaccess.StoreBlock instead of dbStoreBlock.
* [NOD-862] Use dbaccess.FetchBlock instead of various block fetching mechanisms.
* [NOD-828] Fix the flatFilesBucket description.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Fix the ffldb description.
* [NOD-828] Rename Database to DataAccessor and rename Handle to Database.
* [NOD-828] Make Get return nil if the value doesn't exist.
* [NOD-828] Attempt to close leveldb even if closing ffdb failed.
* [NOD-828] Fix a bug where the wrong location would be written to the current store location bucket.
* [NOD-828] Fix not updating the store location in ffldb transactions.
* [NOD-828] Make scanFlatFiles return an error if os.Stat fails for any reason other than file-not-found.
* [NOD-828] Update the README and doc.go.
* [NOD-828] Simplify Bucket.Path().
* [NOD-828] Since LevelDBCursor satisfied the database2.Cursor interface, use it directly.
* [NOD-828] Combine two lines into one.
* [NOD-828] Combine another two lines into one.
* [NOD-828] Move a misplaced comment.
* [NOD-828] Use Wrapf instead of Errorf where appropriate.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Fix Wrapf calls.
* [NOD-828] Fix comments.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Add a comment explaining the use of batches and snapshots.
* [NOD-828] Implement RollbackUnlessClosed().
* [NOD-828] Return both errors in StoreBlock rollback.
* [NOD-828] Move rollback-on-error logic into ffldb. Remove CurrentStoreLocation and RollbackStore from DataAccessor.
* [NOD-828] Make bucket a type alias instead of a struct.
* [NOD-828] Fix a typo.
* [NOD-828] Use copy instead of append in Bucket.
* [NOD-828] Extract flatFileLocationSerializedSize to a const.
* [NOD-828] Debugf -> Warnf in rollback.go.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Remove data length from flat file data format.
* [NOD-828] Rearrange TestLevelDBTransactionSanity a bit.
* [NOD-828] Add stack traces to all errors that come out of library functions.
* [NOD-828] Return errors from rollback().
* [NOD-828] Remove an irrelevant comment.
* [NOD-828] Remove redundant whitespace.
* [NOD-828] Handle nil in FetchBlock.
* [NOD-828] Implement a dbaccess.BlockNode struct.
* [NOD-828] Move the explanation about batches and snapshots to the LevelDBTransaction struct.
* [NOD-828] Implement toDBBlockNode and fromDBBlockNode.
* Revert "[NOD-828] Make bucket a type alias instead of a struct."
This reverts commit 1fd39652
* [NOD-828] Fix revert errors.
* Revert "[NOD-828] Remove data length from flat file data format."
This reverts commit ef408e32
* [NOD-862] Implement storing index blocks.
* [NOD-862] Use database transactions where appropriate.
* [NOD-862] Fix tests failing on DAGSetup.
* [NOD-862] Fix bad make call.
* [NOD-862] Fix remaining database opening problems in tests.
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-862] Iterate over the new block index in dagio.
* [NOD-862] Fix block index key.
* [NOD-828] Add Delete to DataAccessor.
* [NOD-862] Pass byte slices to dbaccess instead of objects.
* [NOD-862] Fix errors.
* [NOD-862] Fix maybeAcceptBlock not checking block existence.
* [NOD-862] Fix TestAcceptanceIndexRecover.
* [NOD-862] Add comments to StoreBlockIndex and BlockIndexCursor.
* [NOD-828] Fix a couple of places that erroneously referenced blocks.
* [NOD-828] Add a comment on top of flatFileLocationSerializedSize.
* [NOD-828] Add Seek to Cursor.
* [NOD-828] Add First to Cursor.
* [NOD-828] Rename db to accessor in Context.
* [NOD-828] Make Get/Fetch calls return a boolean to indicate whether the requested item was found.
* [NOD-828] Name the output parameters of all Get functions.
* [NOD-828] Make RetrieveFromStore return whether the data was found.
* [NOD-862] Fix merge errors.
* [NOD-862] Fix DAGSetup using bad temp directories.
* [NOD-862] Fix TestProcessDelayedBlocks not closing the database properly.
* [NOD-867] Remove blockIndexBucket from dagio.
* [NOD-867] Fix wrong key in StoreIndexBucket.
* [NOD-867] Migrate DAG state to dbaccess.
* [NOD-867] Remove utxoSetVersionKeyName.
* [NOD-862] Fix merge errors.
* [NOD-867] Move localSubnetworkID into dagState.
* [NOD-867] Fix a comment.
* [NOD-867] Remove an unused function.
* [NOD-867] Migrate the database's UTXO set to dbaccess.
* [NOD-867] Add missing error check.
* [NOD-867] Changed First to not return an error.
* [NOD-867] Make Cursor.Key not return the entire key path.
* [NOD-887] Fix the comment above BlockIndexCursorFrom.
* [NOD-862] Merge flushToDBWithContext and flushToDB.
* [NOD-862] Remove TODO.
* [NOD-862] Add prefix to the temp dir in DAGSetup.
* [NOD-862] Bring back dbFetchBlockByHash.
* [NOD-862] Use BlockDAG.BlockByHash in p2p and rpc.
* [NOD-862] Use daghash.Hash in dbaccess.
* [NOD-862] Add defer to RollbackUnlessClosed after NewTx().
* [NOD-862] Extract dbStoreBlock to a separate function.
* [NOD-867] Remove TODOs.
* [NOD-867] Fix merge errors.
* [NOD-867] Fix comments and errors.
* [NOD-867] Unexport blockIndexKey.
* [NOD-867] Fix merge errors.
* [NOD-867] Move a misplaced comment.
* [NOD-867] Fix an error message.
* [NOD-867] Remove preallocation in initDAGState.
* [NOD-866] Migrate database logic in blockdag/indexers package to dbaccess (#682)
* [NOD-865] Delete blockidhash.go.
* [NOD-865] Remove a lot of no-longer relevant logic from indexers.
* [NOD-865] Pass TxContext to ConnectBlock.
* [NOD-865] Migrate the acceptance index to dbaccess.
* [NOD-865] Fix a block not being sent to ConnectBlock.
* [NOD-865] Pass the block's hash instead of the whole block.
* [NOD-865] Add forgotten Commit call.
* [NOD-865] Add comments.
* [NOD-866] Fix a comment.
* [NOD-866] Fix a comment.
* [NOD-866] Remove pointless indirection in acceptanceindex.
* [NOD-866] Fix comment over ForEachHash.
* [NOD-866] Rename ClearAcceptanceIndex to DropAcceptanceIndex.
* [NOD-866] Explain collecting keys before deleting them.
* [NOD-865] Move misc db logic to db access (#681)
* [NOD-828] Create the database2 package that will some day replace the database package.
* [NOD-828] Implement a "bucket" key mechanism.
* [NOD-828] Move bucket.go into the ffldb2 package.
* [NOD-828] Delete the un-interfaced ffldb package from database2, since we aren't going to be using it anyway.
* [NOD-828] Copy over + fixup flat file structs from the old ffldb.
* [NOD-828] Implement flatFilePath.
* [NOD-828] Implement flatFileStore.write().
* [NOD-828] Implement flatFileStore.read().
* [NOD-828] Implement flatFileStore.rollback().
* [NOD-828] Sync the file to disk at the end of write().
* [NOD-828] Extract crc32ByteOrder to a separate variable.
* [NOD-828] Add a sanity test.
* [NOD-828] Remove context-unrelated methods from the Database interface.
* [NOD-828] Create an ffldb object. Simply work against a context.
* [NOD-828] Open the new database on start.
* [NOD-828] Create the leveldb package.
* [NOD-828] Implement opening/closing leveldb.
* [NOD-828] Implement get/put out of/into leveldb.
* [NOD-828] Implement transactions and make them implement a generic database interface.
* [NOD-828] Write sanity tests for leveldb with and without transactions.
* [NOD-828] Add another case to the transaction sanity test.
* [NOD-828] Implement AppendBlock/RetrieveBlock.
* [NOD-828] Refactor so that concepts such as "block" and "metadata" don't leak into the database package.
* [NOD-828] Add RollbackFlatData to the database interface.
* [NOD-828] Remove anything from dbaccess that I'm not planning to implement as part of this ticket.
* [NOD-828] Implement StoreBlock.
* [NOD-828] Implement FetchBlock.
* [NOD-828] Implement HasBlock.
* [NOD-828] Write a sanity test for block insertion.
* [NOD-828] Implement CurrentFlatDataLocation.
* [NOD-828] Implement storing the current block location.
* [NOD-828] Implement initializing/syncing the flat file block store and the "metadata".
* [NOD-828] Add InitBlockStore to TestBlockStoreSanity.
* [NOD-828] Fix rename errors.
* [NOD-828] Fix lint errors in the root database package.
* [NOD-828] Fix lint errors in the ffldb.go.
* [NOD-828] Fix lint errors in the flatfile/db.go.
* [NOD-828] Rename packages in such a way to make the linter happy.
* [NOD-828] Finish satisfying the linter.
* [NOD-828] Fix doc.go.
* [NOD-828] Fix comments in block.go.
* [NOD-828] Move dbaccess out of the database package.
* [NOD-828] Move opening/closing the database to dbaccess.
* [NOD-828] Move the Database interface to the root database package, since it's meant to be generic.
* [NOD-828] Make ffldb generic to later support additional databases.
* [NOD-828] Make ffldb.Open return DatabaseHandle, since ffldb is no longer exported.
* [NOD-828] Fix comments.
* [NOD-828] Rename AppendFlatData to AppendToStore and RetrieveFlatData to RetrieveFromStore.
* [NOD-828] Make buckets nicer to use.
* [NOD-828] Implement cursors that iterate over some bucket.
* [NOD-828] Generalize flat-file repairing and move block database repairing into ffldb.
* [NOD-828] Write a test making sure that flat file repair works.
* [NOD-828] Properly close the database in TestRepairFlatFiles.
* [NOD-828] Add a comment warning against putting and getting the same data within the same transaction.
* [NOD-828] Fix the flatFilesBucket description.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Fix the ffldb description.
* [NOD-828] Rename Database to DataAccessor and rename Handle to Database.
* [NOD-828] Make Get return nil if the value doesn't exist.
* [NOD-828] Attempt to close leveldb even if closing ffdb failed.
* [NOD-828] Fix a bug where the wrong location would be written to the current store location bucket.
* [NOD-828] Fix not updating the store location in ffldb transactions.
* [NOD-828] Make scanFlatFiles return an error if os.Stat fails for any reason other than file-not-found.
* [NOD-828] Update the README and doc.go.
* [NOD-828] Simplify Bucket.Path().
* [NOD-828] Since LevelDBCursor satisfied the database2.Cursor interface, use it directly.
* [NOD-828] Combine two lines into one.
* [NOD-828] Combine another two lines into one.
* [NOD-828] Move a misplaced comment.
* [NOD-828] Use Wrapf instead of Errorf where appropriate.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Fix Wrapf calls.
* [NOD-828] Fix comments.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Add a comment explaining the use of batches and snapshots.
* [NOD-828] Implement RollbackUnlessClosed().
* [NOD-828] Return both errors in StoreBlock rollback.
* [NOD-828] Move rollback-on-error logic into ffldb. Remove CurrentStoreLocation and RollbackStore from DataAccessor.
* [NOD-828] Make bucket a type alias instead of a struct.
* [NOD-828] Fix a typo.
* [NOD-828] Use copy instead of append in Bucket.
* [NOD-828] Extract flatFileLocationSerializedSize to a const.
* [NOD-828] Debugf -> Warnf in rollback.go.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Remove data length from flat file data format.
* [NOD-828] Rearrange TestLevelDBTransactionSanity a bit.
* [NOD-828] Add stack traces to all errors that come out of library functions.
* [NOD-828] Return errors from rollback().
* [NOD-828] Remove an irrelevant comment.
* [NOD-828] Remove redundant whitespace.
* [NOD-828] Handle nil in FetchBlock.
* [NOD-828] Move the explanation about batches and snapshots to the LevelDBTransaction struct.
* Revert "[NOD-828] Make bucket a type alias instead of a struct."
This reverts commit 1fd39652
* [NOD-828] Fix revert errors.
* Revert "[NOD-828] Remove data length from flat file data format."
This reverts commit ef408e32
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-828] Add Delete to DataAccessor.
* [NOD-865] Move fee data db operations to dbaccess
* [NOD-865] Move reachability data db operations to dbaccess
* [NOD-865] Move UTXO diff data db operations to dbaccess
* [NOD-865] Move subnetwork data db operations to dbaccess
* [NOD-865] Fix createDAGState
* [NOD-865] Remove old Get signature with "exists"
* [NOD-865] Move multiset db operations to dbaccess
* [NOD-865] Use dbaccess transactions where possible
* [NOD-865] Remove old Get signature with "exists"
* [NOD-881] Recover TestGHOSTDAGErrors
* [NOD-865] Create function for db keys
* [NOD-865] Change Exists to Has, and use accessor.Has where possible
* [NOD-865] Make ClearReachabilityData transactive
* [NOD-865] Don't iterate cursors while changing db data
* [NOD-865] Rename RegisterSubnetwork -> StoreSubnetwork
* [NOD-865] Change bucket from utxodiffs to utxo-diffs
* [NOD-865] Rename SubnetworkExists->HasSubnetwork
* [NOD-865] Change a comment
* [NOD-865] Fix tests
* [NOD-865] Fix comment
* [NOD-865] Remove the prefix "db" from some functions
* [NOD-865] Remove redundant comments
* [NOD-865] Make clearBucket function
* [NOD-865] Make clear functions get a dbTx as an arg
* [NOD-865] Remove erroneous tx commit
Co-authored-by: stasatdaglabs <stas@daglabs.com>
* [NOD-868] Delete the old database package (#683)
* [NOD-828] Create the database2 package that will some day replace the database package.
* [NOD-828] Implement a "bucket" key mechanism.
* [NOD-828] Move bucket.go into the ffldb2 package.
* [NOD-828] Delete the un-interfaced ffldb package from database2, since we aren't going to be using it anyway.
* [NOD-828] Copy over + fixup flat file structs from the old ffldb.
* [NOD-828] Implement flatFilePath.
* [NOD-828] Implement flatFileStore.write().
* [NOD-828] Implement flatFileStore.read().
* [NOD-828] Implement flatFileStore.rollback().
* [NOD-828] Sync the file to disk at the end of write().
* [NOD-828] Extract crc32ByteOrder to a separate variable.
* [NOD-828] Add a sanity test.
* [NOD-828] Remove context-unrelated methods from the Database interface.
* [NOD-828] Create an ffldb object. Simply work against a context.
* [NOD-828] Open the new database on start.
* [NOD-828] Create the leveldb package.
* [NOD-828] Implement opening/closing leveldb.
* [NOD-828] Implement get/put out of/into leveldb.
* [NOD-828] Implement transactions and make them implement a generic database interface.
* [NOD-828] Write sanity tests for leveldb with and without transactions.
* [NOD-828] Add another case to the transaction sanity test.
* [NOD-828] Implement AppendBlock/RetrieveBlock.
* [NOD-828] Refactor so that concepts such as "block" and "metadata" don't leak into the database package.
* [NOD-828] Add RollbackFlatData to the database interface.
* [NOD-828] Remove anything from dbaccess that I'm not planning to implement as part of this ticket.
* [NOD-828] Implement StoreBlock.
* [NOD-828] Implement FetchBlock.
* [NOD-828] Implement HasBlock.
* [NOD-828] Write a sanity test for block insertion.
* [NOD-828] Implement CurrentFlatDataLocation.
* [NOD-828] Implement storing the current block location.
* [NOD-828] Implement initializing/syncing the flat file block store and the "metadata".
* [NOD-828] Add InitBlockStore to TestBlockStoreSanity.
* [NOD-828] Fix rename errors.
* [NOD-828] Fix lint errors in the root database package.
* [NOD-828] Fix lint errors in the ffldb.go.
* [NOD-828] Fix lint errors in the flatfile/db.go.
* [NOD-828] Rename packages in such a way to make the linter happy.
* [NOD-828] Finish satisfying the linter.
* [NOD-828] Fix doc.go.
* [NOD-828] Fix comments in block.go.
* [NOD-828] Move dbaccess out of the database package.
* [NOD-828] Move opening/closing the database to dbaccess.
* [NOD-828] Move the Database interface to the root database package, since it's meant to be generic.
* [NOD-828] Make ffldb generic to later support additional databases.
* [NOD-828] Make ffldb.Open return DatabaseHandle, since ffldb is no longer exported.
* [NOD-828] Fix comments.
* [NOD-828] Rename AppendFlatData to AppendToStore and RetrieveFlatData to RetrieveFromStore.
* [NOD-828] Make buckets nicer to use.
* [NOD-828] Implement cursors that iterate over some bucket.
* [NOD-828] Generalize flat-file repairing and move block database repairing into ffldb.
* [NOD-828] Write a test making sure that flat file repair works.
* [NOD-828] Properly close the database in TestRepairFlatFiles.
* [NOD-828] Add a comment warning against putting and getting the same data within the same transaction.
* [NOD-828] Fix the flatFilesBucket description.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Fix the ffldb description.
* [NOD-828] Rename Database to DataAccessor and rename Handle to Database.
* [NOD-828] Make Get return nil if the value doesn't exist.
* [NOD-828] Attempt to close leveldb even if closing ffdb failed.
* [NOD-828] Fix a bug where the wrong location would be written to the current store location bucket.
* [NOD-828] Fix not updating the store location in ffldb transactions.
* [NOD-828] Make scanFlatFiles return an error if os.Stat fails for any reason other than file-not-found.
* [NOD-828] Update the README and doc.go.
* [NOD-828] Simplify Bucket.Path().
* [NOD-828] Since LevelDBCursor satisfied the database2.Cursor interface, use it directly.
* [NOD-828] Combine two lines into one.
* [NOD-828] Combine another two lines into one.
* [NOD-828] Move a misplaced comment.
* [NOD-828] Use Wrapf instead of Errorf where appropriate.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Fix Wrapf calls.
* [NOD-828] Fix comments.
* [NOD-828] Remove superfluous whitespace.
* [NOD-828] Add a comment explaining the use of batches and snapshots.
* [NOD-828] Implement RollbackUnlessClosed().
* [NOD-828] Return both errors in StoreBlock rollback.
* [NOD-828] Move rollback-on-error logic into ffldb. Remove CurrentStoreLocation and RollbackStore from DataAccessor.
* [NOD-828] Make bucket a type alias instead of a struct.
* [NOD-828] Fix a typo.
* [NOD-828] Use copy instead of append in Bucket.
* [NOD-828] Extract flatFileLocationSerializedSize to a const.
* [NOD-828] Debugf -> Warnf in rollback.go.
* [NOD-828] Fix a comment.
* [NOD-828] Fix a comment.
* [NOD-828] Remove data length from flat file data format.
* [NOD-828] Rearrange TestLevelDBTransactionSanity a bit.
* [NOD-828] Add stack traces to all errors that come out of library functions.
* [NOD-828] Return errors from rollback().
* [NOD-828] Remove an irrelevant comment.
* [NOD-828] Remove redundant whitespace.
* [NOD-828] Handle nil in FetchBlock.
* [NOD-828] Move the explanation about batches and snapshots to the LevelDBTransaction struct.
* Revert "[NOD-828] Make bucket a type alias instead of a struct."
This reverts commit 1fd39652
* [NOD-828] Fix revert errors.
* Revert "[NOD-828] Remove data length from flat file data format."
This reverts commit ef408e32
* [NOD-862] Move Cursor() into the DataAccessor interface.
* [NOD-828] Add Delete to DataAccessor.
* [NOD-865] Move fee data db operations to dbaccess
* [NOD-865] Move reachability data db operations to dbaccess
* [NOD-865] Move UTXO diff data db operations to dbaccess
* [NOD-865] Move subnetwork data db operations to dbaccess
* [NOD-865] Fix createDAGState
* [NOD-865] Remove old Get signature with "exists"
* [NOD-865] Move multiset db operations to dbaccess
* [NOD-865] Use dbaccess transactions where possible
* [NOD-865] Remove old Get signature with "exists"
* [NOD-881] Recover TestGHOSTDAGErrors
* [NOD-865] Create function for db keys
* [NOD-865] Change Exists to Has, and use accessor.Has where possible
* [NOD-865] Make ClearReachabilityData transactive
* [NOD-865] Don't iterate cursors while changing db data
* [NOD-865] Rename RegisterSubnetwork -> StoreSubnetwork
* [NOD-865] Change bucket from utxodiffs to utxo-diffs
* [NOD-865] Rename SubnetworkExists->HasSubnetwork
* [NOD-865] Change a comment
* [NOD-868] Remove all tests from old database.
* [NOD-868] Remove all unused methods from the old database's interfaces.
* [NOD-865] Fix tests
* [NOD-868] Remove references to DB.
* [NOD-865] Fix comment
* [NOD-868] Remove the old ffldb besides the interface and errors.go.
* [NOD-868] Remove errors.go.
* [NOD-868] Remove the old database package.
* [NOD-868] Add openDB to DAGSetup to emulate the old dbpath in dag.config.
* [NOD-868] Rename database2 to database.
* [NOD-868] Use NewTx instead of NoTx where required.
* [NOD-868] Fix merge errors.
* [NOD-868] Rename dbXXX functions to just xxx.
* [NOD-868] Rename putDAGState to saveDAGState.
* [NOD-868] Replace comments in initDAGState with logs.
* [NOD-868] Explain the openDB parameter in DAGSetup.
* [NOD-868] Fixup doc.go and README.md.
* [NOD-868] Remove pointless transactions.
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* [NOD-805] Fix merge errors.
* [NOD-805] Fix a comment.
* [NOD-805] Don't return virtualTxsAcceptanceData from applyDAGChanges.
* [NOD-805] Add missing error handling in TestAcceptanceDataIndexRecover.
* [NOD-805] Rename blockDAG to dag in indexers/manager.go.
* [NOD-805] Defer cursor.Close() everywhere.
* [NOD-805] Rename scanFlatFiles to findCurrentLocation.
* [NOD-805] Extract crc32ChecksumLength and dataLengthLength to constants.
* [NOD-805] Handle open files properly in rollback.go.
* [NOD-805] Remove unnecessary func wrapper.
* [NOD-805] Remove unnecessary trimming in initialize.
* [NOD-805] Made StoreBlock accept only TxContext.
* [NOD-805] Changed the log level of an error message to Error.
* [NOD-805] Add a note about holding mutexes over deleteFile.
* [NOD-805] Remove a false comment.
* [NOD-805] Fix a comment.
* [NOD-805] Rename blk to block.
* [NOD-805] Extract utxoKey to a separate function.
* [NOD-805] Move dbaccess.xxxKey functions to the tops of their respective files.
* [NOD-805] Fix grammar in dbaccess/db.go.
* [NOD-805] Wrap a failed database corruption recovery error.
* [NOD-805] Split lines with WithStack in them.
* [NOD-805] Fix the comment over initialize.
* [NOD-805] Rename ffdb to flatFileDB and ldb to levelDB.
* [NOD-805] Fix a comment.
* [NOD-805] Fix a comment.
* [NOD-805] Use s.writeCursor instead of cursor.
* [NOD-805] Embed file in lockableFile.
* [NOD-805] the the -> the
* [NOD-805] openDB -> db
* [NOD-805] Use TxContext in all flushToDB functions.
* [NOD-805] Rename context -> dbContext.
* [NOD-805] Reword the comment at the beginning on initDAGState.
* [NOD-805] Explain cursor key trimming.
* [NOD-805] Remove Error from Cursor.
* [NOD-805] Return ErrNotFound from done Cursor Key and Value.
* [NOD-805] Add missing error handling.
* [NOD-805] Fix a comment.
* [NOD-805] Fix a variable name.
* [NOD-805] Remove pointless underscore.
* [NOD-805] Fix a comment.
* [NOD-805] Fix a variable name.
Co-authored-by: Mike Zak <feanorr@gmail.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* [NOD-855] Save ECMH for each block UTXO
* [NOD-855] Remove UpdateExtraNonce method
* [NOD-855] Remove multiset data from UTXO diffs
* [NOD-855] Fix to fetch multiset of selected parent
* [NOD-855] Don't remove coinbase inputs from multiset
* [NOD-855] Create multisetBucketName on startup
* [NOD-855] Remove multiset from UTXO diff tests
* [NOD-855] clear new entries from multisetstore on saveChangesFromBlock
* [NOD-855] Fix tests
* [NOD-855] Use UnacceptedBlueScore when adding current block transactions to multiset
* [NOD-855] Hash utxo before adding it to multiset
* [NOD-855] Pass isCoinbase to NewUTXOEntry
* [NOD-855] Do not use hash when adding entries to multiset
* [NOD-855] When calculating multiset, replace the unaccepted blue score of selected parent transaction with the block blue score
* [NOD-855] Manually add a chained transaction to a block in TestChainedTransactions
* [NOD-855] Change name and comments
* [NOD-855] Use FindAcceptanceData to find a specific block acceptance data
* [NOD-855] Remove redundant copy of txIn.PreviousOutpoint
* [NOD-855] Use fmt.Sprintf when creating internalRPCError
* [NOD-641] Upgrade to github.com/pkg/errors v0.9.1 and use errors.As where needed
* [NOD-641] Fix find and replace error
* [NOD-641] Use errors.As for error type checking
* [NOD-641] Fix errors.As for pointer types
* [NOD-641] Use errors.As where needed
* [NOD-641] Rename rErr->ruleErr
* [NOD-641] Rename derr->dbErr
* [NOD-641] e->flagsErr where necessary
* [NOD-641] change jerr to more appropriate name
* [NOD-641] Rename cerr->bdRuleErr
* [NOD-641] Rename serr->scriptErr
* [NOD-641] Use errors.Is instead of testutil.AreErrorsEqual in TestNewHashFromStr
* [NOD-641] Rename bdRuleErr->dagRuleErr
* [NOD-641] Rename mErr->msgErr
* [NOD-641] Rename dErr->deserializeErr
* [NOD-616] Remove unused methods from BlockDAG.
* [NOD-616] Remove Height from GetRawMempoolVerboseResult and TxDesc.
* [NOD-616] Replaced BlockDAG.ChainHeight with SelectedTipBlueScore.
* [NOD-616] Remove the unused BlockChainHeightByHash.
* [NOD-616] Remove the unused blockChainHeight from checkBlockHeaderContext.
* [NOD-616] Remove chainHeight from util.Block.
* [NOD-616] Remove TestChainHeight.
* [NOD-616] Update unknown rule activation warning to use blueScore.
* [NOD-616] Update thresholdState to use blueScore instead of chainHeight.
* [NOD-616] Update blockLocator to use blueScore instead of chainHeight.
* [NOD-616] Remove blockNode.chainHeight.
* [NOD-616] Fix comments and variable names.
* [NOD-616] Replace a weird for loop with a while loop.
* [NOD-616] Fix a comment.
* [NOD-616] Remove pre-allocation in blockLocator.
* [NOD-616] Coalesce checks that startHash and stopHash are not the same into the same condition.
* [NOD-616] Fix a comment.
* [NOD-616] Remove weird blueScore logic around childHashStrings.
* [NOD-616] Fix hash pointer comparison.
* [NOD-616] Fix a comment.
* [NOD-616] Add ban score to peers misusing GetBlockLocator.
* [NOD-616] Replace adding ban score with disconnecting.
* [NOD-616] Add blueScore to FilteredBlockAddedNtfn.
* [NOD-532] Change chain to DAG in the root package.
* [NOD-532] Change chain to DAG in checkpoints.go.
* [NOD-532] Change chain to DAG in blockdag.
* [NOD-532] Change chain to DAG in cmd.
* [NOD-532] Change chain to DAG in dagconfig.
* [NOD-532] Change chain to DAG in database.
* [NOD-532] Change chain to DAG in mempool.
* [NOD-532] Change chain to DAG in mempool.
* [NOD-532] Change chain to DAG in netsync.
* [NOD-532] Change chain to DAG in rpcclient.
* [NOD-532] Change chain to DAG in server.
* [NOD-532] Change chain to DAG in txscript.
* [NOD-532] Change chain to DAG in util.
* [NOD-532] Change chain to DAG in wire.
* [NOD-532] Remove block heights in dagio.go examples.
* [NOD-532] Rename fakeChain to fakeDAG.
* [NOD-532] Fix comments, remove unused EnableBCInfoHacks flag.
* [NOD-532] Fix comments and variable names.
* [NOD-532] Fix comments.
* [NOD-532] Fix merge errors.
* [NOD-532] Formatted project.
* [NOD-264] Implemented calcTxSelectionValue.
* [NOD-264] Fixed bad subnetworkID in calcTxSelectionValue.
* [NOD-264] Implemented sorting the txDescs by value.
* [NOD-264] Got rid of txPrioItem.
* [NOD-264] Moved transaction selection to a separate file.
* [NOD-264] Renamed the result object to txsForBlockTemplate.
* [NOD-264] Implemented tx selection.
* [NOD-264] Fixed trying to get the gas limit for built-in subnetworks.
* [NOD-264] Wrote comments where appropriate.
* [NOD-264] Moved calcTxSelectionValue to the mining package. (Non-mining nodes shouldn't be forced to calc selection value for every transaction)
* [NOD-264] Wrote a test for selectTxs.
* [NOD-264] Fixed a comment.
* [NOD-264] Fixed misunderstood test.
* [NOD-264] Added zero fee check. Added a couple more tests.
* [NOD-264] Added probabilistic tests. Fixed a couple of bugs in tx selection.
* [NOD-264] Fixed tests with missing fees.
* [NOD-264] Added a test over a range of txs with different gas/mass.
* [NOD-264] Added expected probability to the rest of the test cases.
* [NOD-264] Tightened bounds in probability test.
* [NOD-264] Fixed values in probabily test.
* [NOD-264] Added a comments for alpha and rebalanceThreshold.
* [NOD-264] Fixed a couple of comments, renamed result to txsForBlockTemplate.
* [NOD-264] Removed an irrelevant comment. Changed Tracef to Warnf in some logs.
* [NOD-264] Renamed selectionValue -> txValue.
* [NOD-264] Moved rebalancing to the start of the tx selection loop.
* [NOD-264] Added overflow check for gasUsage.
* [NOD-264] Renamed blockSigOps and blockMass to totalSigOps and totalMass.
* [NOD-264] Removed the need to pass usedCount to reblanaceCandidates. Also relaxed bounds in a test.
* [NOD-264] Split selectTxs into smaller functions. Also relaxed bounds in a test some more.
* [NOD-264] Added a comment for findTx.
* [NOD-264] Ordered candidateTxs by subnetwork instead of txValue.
* [NOD-264] Disallowed zero tx fees in mempool and config. Renamed iterateCandidateTxs to populateTemplateFromCandidates.
* [NOD-264] Changed isFinalizedTransaction log level from Warn to Debug.
* [NOD-264] Removed references to SigOps in txSelection.
* [NOD-264] Removed SigOps validation. Validating mass should suffice.
* [NOD-264] Renamed wasUsed to isMarkedForDeletion.
* [NOD-264] Renamed markCandidateTxUsed to markCandidateTxForDeletion.
* [NOD-264] Made some probabilistic tests less likely to fail when they shouldn't.
* [NOD-264] Added a message warning people about probabilistic tests.
* [NOD-264] Rephrased a comment about rebalanceThreshold.
* [NOD-264] Removed IsCoinBase, CheckTransactionInputsAndCalulateFee, and ValidateTransactionScripts from txSelection.
* [NOD-264] Removed a condition that is no longer relevant.
* [NOD-264] "which's" -> "whose"
* [NOD-264] Removed wasteful preallocations.
* [NOD-264] Fixed a comment referring to "used" transactions.
* [NOD-237] Implemented transaction mass.
* [NOD-237] Added transaction mass validation to the mempool.
* [NOD-237] Made blockMaxMassMax not rely on MaxBlockPayload.
* [NOD-237] Added comments describing the new constants in validate.go.
* [NOD-237] Changed the default blockmaxmass to 10,000,000.
* [NOD-237] Fixed a comment that erroneously didn't refer to mass.
* [NOD-237] Added comments to ValidateTxMass and CalcTxMass.
* [NOD-237] Renamed "size" to "byte". Made validateBlockMass exit early if validation fails. Fixed unit names in comments. In CalcTxMass, moved summing of mass to the bottom of the function.
* [NOD-237] Instead of ErrMassTooHigh, renamed ErrBlockTooBig and ErrTxTooBig. Replaced wire.MaxBlockPayload with MaxMassPerBlock.
* [NOD-237] Fixed sanity checks related to block size in commands.
* [NOD-237] To use up less memory during testing, made the mass in the "too big" test come from pkScripts rather than input bytes.
* [NOD-237] Added an overflow check to validateBlockMass.
* [NOD-222] Added constant: UnacceptedBlueScore.
* [NOD-222] Made it so that block transactions always have UnacceptedBlueScore.
* [NOD-222] Implemented updating unaccepted UTXO entries with accepted ones in the virtual.
* [NOD-222] Fixed an unclear comment.
* [NOD-222] Fixed diffFromAcceptanceData not receiving the right blue score.
* [NOD-222] Fixed various issues with the implementation. It appears to work now.
* [NOD-222] Removed debug logs.
* [NOD-222] Fixed tests that relied on utxoCollection.String().
* [NOD-222] Fixed TestChainedTransactions.
* [NOD-222] Fixed tests that relied on GetVirtualFromParentsForTest.
* [NOD-222] Fixed having identical entries in toAdd and toRemove.
* [NOD-222] Fixed logic in diffFrom that I previously broke.
* [NOD-222] Fixed a wrong check.
* [NOD-222] Figured out the magical invocation to make everything work.
* [NOD-222] Fixed blockDB tests.
* [NOD-222] Removed debug method.
* [NOD-222] Fixed comments related to setting coinbase maturity to 0.
* [NOD-222] Fixed a typo in a comment.
* [NOD-222] Added a comment that explains the new addition in GetVirtualFromParentsForTest.
* [NOD-222] Added a comment to DiffUTXOSet.Get().
* [NOD-222] Fixed a nuance in DiffUTXOSet.containsInputs.
* [NOD-222] Replaced nonsense in GetVirtualFromParentsForTest with diffFromAcceptanceData.
* [NOD-222] Renamed newVirtualUTXO -> newVirtualPastUTXO.
* [NOD-222] Fixed a comment.
* [NOD-222] Extracted checking utxoCollection with blueScore to a method.
* [NOD-222] Added tests where the same entry is in both toAdd and toRemove.
* [NOD-222] Used Add/RemoveEntry inside diffFromAcceptedTx.
* [NOD-222] Removed superfluous test for UnacceptedBlueScore.
* [NOD-222] Added/Updated comments.
* [NOD-222] Added tests to TestUTXODiffRules.
* [NOD-222] Added appropriate protection against impossible "from"s in diffFrom.
* [NOD-222] Added a comment explaining why we diffFrom acceptanceData in verifyAndBuildUTXO.
* [NOD-222] Fixed comments and equal() in utxoset.
* [NOD-208] Added blockBlueScore to UTXOEntry.
* [NOD-208] Added blueBlockScore to NewUTXOEntry.
* [NOD-208] Fixed compilation errors in policy, utxoset, and dag tests.
* [NOD-208] Changed validateBlockRewardMaturity and CheckTransactionInputsAndCalulateFee to use blueScore.
* [NOD-208] Changed CalcBlockSubsidy to use blueScore.
* [NOD-208] Changed SequenceLockActive to use blueScore.
* [NOD-208] Removed ExtractCoinbaseHeight.
* [NOD-208] Removed reference to block height in ensureNoDuplicateTx.
* [NOD-208] Changed IsFinalizedTransaction to use blueScore.
* [NOD-208] Fixed merge errors.
* [NOD-208] Made UTXOEntry serialization use blueScore.
* [NOD-208] Changed CalcPriority and calcInputValueAge to use blueScore.
* [NOD-208] Changed calcSequenceLock to use blueScore.
* [NOD-208] Removed blockChainHeight from UTXOEntry.
* [NOD-208] Fixed compilation errors in feeEstimator. Fixed a bug in the test pool hardness.
* [NOD-208] Fixed oldestChainBlockWithBlueScoreGreaterThan not handling an extreme case.
* [NOD-208] Fixed TestDiffFromTx.
* [NOD-208] Got rid of priority and support of free transactions.
* [NOD-208] Fixed TestProcessTransaction.
* [NOD-208] Fixed TestTxFeePrioHeap.
* [NOD-208] Fixed TestAddrIndex and TestFeeEstimatorCfg.
* [NOD-208] Removed unused rateLimit parameter from ProcessTransaction.
* [NOD-208] Fixed tests that rely on CreateTxChain.
* [NOD-208] Fixed tests that rely on CreateSignedTxForSubnetwork.
* [NOD-208] Fixed TestFetchTransaction.
* [NOD-208] Fixed TestHandleNewBlock. Fixed HandleNewBlock erroneously processing fee transactions.
* [NOD-208] Fixed TestTxIndexConnectBlock.
* [NOD-208] Removed the use of Height() from the fee estimator.
* [NOD-208] Removed unused methods from rpcwebsocket.go.
* [NOD-208] Removed Height from util.Block.
* [NOD-208] Removed ErrForkTooOld. It doesn't make sense in a DAG.
* [NOD-208] Made blockHeap use blueScore instead of height.
* [NOD-208] Removed fee estimator.
* [NOD-208] Removed DAG.Height.
* [NOD-208] Made TestAncestorErrors test chainHeight instead of height.
* [NOD-208] Fixed a couple of comments that were still speaking about block height.
* [NOD-208] Replaced all uses of HighestTipHash with SelectedTipHash.
* [NOD-208] Remove blockNode highest and some remaining erroneous uses of height.
* [NOD-208] Fixed a couple of comments. Fixed outPoint -> outpoint merge error.
* [NOD-208] Fixed a couple more comments.
* [NOD-208] Used calcMinRequiredTxRelayFee instead of DefaultMinRelayTxFee for mempool tests.
* [NOD-208] Renamed mempool Config BestHeight to DAGChainHeight.
* [NOD-208] Fixed a bug in oldestChainBlockWithBlueScoreGreaterThan. Made calcSequenceLock use the node's selected parent chain rather than the virtual block's.
* [NOD-208] Removed chainHeight from blockNode String().
Renamed checkpointsByHeight to checkpointsByChainHeight and prevCheckpointHeight to prevCheckpointChainHeight.
Removed reference to chainHeight in blockIndexKey.
Fixed comments in dagio.go.
* [NOD-208] Removed indexers/blocklogger.go, as no one was using it.
* [NOD-208] Made blocklogger.go log blueScore instead of height.
* [NOD-208] Fixed typo.
* [NOD-208] Fixed comments, did minor renaming.
* [NOD-208] Made a "common sense" wrapper around sort.Search.
* [NOD-208] Fixed comment in SearchSlice.
* [NOD-195] Made fee tx implicit
* [NOD-195] Removed redundant checks for fee transactions
* [NOD-195] Add fee tx data into acceptence data and fee data
* [NOD-195] Fix some tests
* [NOD-195] Update Block100000 with new data
* [NOD-195] Fixed remaining tests
* [NOD-195] Save and load feeTx to/from database
* [NOD-195] Remove DisconnectBlock methods from indexers, since they are not used anywhere
* [NOD-195] Add fee tx to addrindex
* [NOD-195] Don't populate inputs for fee transactions
* [NOD-195] Delete feeTxBucket in removeDAGState
* [NOD-195] Got rid of util.FeeTRansactionIndex
* [NOD-201] Implemented the AddSubnetwork CLI tool.
* [NOD-201] Fixed various bugs in AddSubnetwork.
* [NOD-201] Fixed mempool maybeAcceptTransaction verifying gasLimit for a subnetwork registry transaction.
* [NOD-201] Fixed serialization/deserialization bugs in addrIndex.
* [NOD-201] Fixed BlockConfirmationsByHash not handling the zeroHash.
* [NOD-201] Used btclog instead of go log.
* [NOD-201] Made gasLimit a command-line flag. Made waitForSubnetworkToBecomeAccepted only return an error.
* [NOD-201] Filtered out mempool transactions.
* [NOD-201] Fixed embarrassing typos.
* [NOD-201] Added subnetwork registry tx fee + appropriate cli flag.
* [NOD-201] Skipped TXOs that can't pay for registration.
* [NOD-189] Made UTXODiff WithDiff and DiffFrom allocate collections with appropriate sizes.
In mempool HandleNewBlock, Replaced removeTransaction loop with removeTransactions.
* [NOD-189] Removed code duplication between removeTransaction and removeTransactions.
* [NOD-189] Fixed a merge error.
* [NOD-189] Fixed another merge error.
* [NOD-189] Renamed removeRedeemers to removeDependants.
* [NOD-189] Removed superfluous check inside removeTransactionWithDiff.
* [NOD-189] Added a comment to removeTransactions detailing what it optimizes.
* [NOD-189] Added documentation to removeTransactionWithDiff and split it into smaller methods.
* [NOD-172] Port EMCH from bchd
* [NOD-172] Fix hdkeychain.TestErrors and add btcec.TestRecoverCompact
* [NOD-172] Make ECMH immutable
* [NOD-172] Fix gofmt errors
* [NOD-172] Add TestMultiset_NewMultisetFromDataSlice and fix Point to be immutable
* [NOD-172] Fix gofmt errors
* [NOD-172] Add test for checking that the Union of a multiset and its inverse is zero
* [NOD-179] Add ECMH Point to all UTXO-structs
* [NOD-179] Fix utxo set tests
* [NOD-179] Fix mempool tests
* [NOD-179] Remove RemoveTxOuts
* [NOD-179] Move serializeBlockUTXODiffData to the top of the file
* [NOD-179] Fix serializeBlockUTXODiffData comment format
* [NOD-179] Fix AddTx comment and name return values
* [NOD-144] Use chainHeight in SelectedAncestor, and update all logic that uses it
* [NOD-144] Moved UnminedHeight to blockdag, and updated all references
* [NOD-142] Updated util.FastLog2Floor to work on uint64
* [NOD-142] Convert height and chainHeight to uint64
* [NOD-142] A couple fixes in comments of TestFastLog2Floor
* [NOD-142] Make spendableOutOffset uint64 too
* [NOD-66] Created TX generator
* [NOD-66] Created transaction generator
* [NOD-66] Improved TX generator against double spend. Created genaddr utility. Refactored
* [NOD-66] Save chenges before branch switch
* [NOD-66] Use log package instead of fmt
* [NOD-66] Fixed/restored docker files
* [NOD-66] Changed according to new WithLock/NoLock convention
* [NOD-78] Use transfer some read-only functions from dagLock.Lock to dagLock.RLock
* [NOD-78] Make mining.NewBlockTemplate lock the dag up until the point it calls CheckConnectBlockTemplate
* [NOD-78] Removed locking from functions that are concurrency-safe, and added WithLock version to those that are not
* [NOD-78] Remove unused isLockHeld from CalcNextBlockVersion
* [NOD-78] Renamed UTXORLock/UTXORUnlock to RLock/RUnlock
* [NOD-78] Revesed dagUnlocket to isDagLocked
* [NOD-42] Split checkFinalityRules and newFinalityPoint
* [NOD-42] Rename connectToDAG -> addBlock + move anything that is not actually connecting block to DAG out of connectBlock
* [NOD-42] Extract methods from PastUTXO
* [NOD-42] Give names to outputs in verifyAndBuildUTXO and propagate name
changes up the call tree
* [NOD-42] Split loop that creates UTXODiff and updates acceptance data into 2 separate methods
* [NOD-42] Removed from applyUTXOChanges any validation logic, moved in any logic related to updating the DAG and renamed to applyDAGChanges
* [NOD-42] Rename: CheckTransactionInputs -> CheckTransactionInputsAndCalculateFee
* [NOD-42] Revise some comments
* [NOD-42] Removed finalityErr constant - it's not needed
* Multiple chain -> dag corrections in comments
* [NOD-42] Removed redundant declaration of feeData
* [NOD-42] Reworded some comments
* [NOD-42] Rename MultiblockTxsAcceptanceData -> MultiBlockTxsAcceptanceData
* [DEV-378] Added feeAccumulator structures
* [DEV-378] Added logic to create and store fee data when validating a block
* [DEV-378] Renamed feeAccumulator to compactFeeData, and all related entities accordingly
* [DEV-378] Converted MsgTx.TxHash() to pointer to hash and not hash
* [DEV-378] Restructured parameters to buildFeeTransaction and related entities
* [DEV-378] Finished the code that calculates fees for blocks
* [DEV-378] Fix TxIndex after changing the structure of AcceptedTxsData
* [DEV-378] For genesis block: Return empty AcceptedTxsData instead of nil
* [DEV-378] Off-by-one error
* [DEV-378] Length of compactFeeData should be determined by specific method, not
* [DEV-378] Multiple bugfixes in tx fee calculation
* [DEV-378] Calculate fee even if fastAdd, to save feeData
* [DEV-378] use IsEqual instead of == when comparing TxHash
* [DEV-378] txindex: if including block is the new block - don't fetch id from DB
* [DEV-378] Fixed a few typos and made some vars consts
* [DEV-378] Re-organized fee functions, removed redundant functions and constants, and revised a few comments
* [DEV-378] Recovered fmt string changes lost in merge
* [DEV-378] Renamed acceptedTxsData and related types and vars to txsAcceptanceData
* [DEV-378] Some comment fixes
* [DEV-378] Remove redundant .ToString()
* [DEV-376] Changed any instance of %v in format strings with a more specific format token
* [DEV-376] Fixed some more wrong formatting strings + removed redundant
cast
* [DEV-376] Added fmt.Sprintf where it was missing
* [DEV-376] use %s for util.Amount, to invoke .String()
* [DEV-376] Some more fixes in format strings
* [DEV-376] fixed mruinvmap_test to expect the correct behaviour
* [DEV-364] Add fee transactions validation
* [DEV-364] make NextBlockFeeTransactions for creating block templates
* [DEV-364] apply coinbase rules to fee transaction is some cases
* [DEV-364] Add comments
* [DEV-364] put getTXO as separate function
* [DEV-364] Make getParentsFeeData a separate function
* [DEV-364] fix calculateFees
* [DEV-364] force maximum sequence for fee transactions
* [DEV-364] add TestValidateFeeTransactions
* [DEV-364] change fee transaction to be one tx per block rather than one tx for each blue
* [DEV-364] fix tests
* [DEV-364] Use constants instead of inline numbers
* [DEV-361] Create type TxID as alias to daghash.Hash. Use it for transaction IDs
* [DEV-361] Fixed missed renames
* [DEV-361] Removed usage of zeroHash
* [DEV-361] Fixed more missed renames
* [DEV-311] Moved subnetwork storage from directly in DAG to subnetworkStore
* Added gas validation in CheckBlockSanity
* [DEV-311] Add SubnetworkStore to last remaining call for CheckBlockSanity
* [DEV-311] Added subnetworkID to config in TestcheckBlockSanity
* [DEV-311] Moved CheckBlockSanity to be method of BlockDAG, and removed subnetworkStore argument
* [DEV-311] Removed SubnetworkID as parameter to CheckBlockSanity
* [DEV-311] Update gas usage before
* [DEV-311] some chain=>DAG updates in comments
* [DEV-311] Removed remaining dag-specific parameters from checkBlockSanity
* [DEV-339] Handling of dependent transactions in mempool
* [DEV-339] Small fixes after code review
* [DEV-339] Fixed compilation
* [DEV-339] Removed extra loop in addTransaction function
* [DEV-339] Changed addTransaction do not loop on inputs second time
* [DEV-348] Removed a couple of unused methods.
* [DEV-348] Implemented validating incoming transactions for bad partial transactions.
* [DEV-348] Added a (incomplete) filter for propogation of transactions.
* [DEV-348] Implemented filtering inventory by subnetwork.
* [DEV-348] Fixed broken tests.
* [DEV-348] Added test for non-zero payload partial transactions.
* [DEV-348] Added a comment for Config.SubnetworkID.
* [DEV-348] Fixed formatting.
* [DEV-348] Renamed isRemoteTransactionFull to shouldTxBeFull.
* [DEV-348] Added a check for invalid transaction in maybeAcceptTransaction. Added handling for native networks.
* [DEV-348] Fixed formatting.
* [DEV-348] Fixed a bug in transaction validation.
* [DEV-348] Rephrased a comment.
* [DEV-348] Extracted subnetwork compatibility to a method. Wrote a test for it.
* [DEV-348] Removed an unnecessary check over the native subnetwork.
* [DEV-343] Made sub-network registry use subNetworkIDs.
* [DEV-343] Removed an unnecessary clone.
* [DEV-343] Renamed buildSubNetworkID to txToSubNetworkID. Broke out of a loop when it was known that no further processing is required. Handled error cases from dbGetNetwork separately from the "not-found" case/
* [DEV-343] Added an error case in GasLimit() for where the sub-network is nil.
* [DEV-343] Fixed return nil instead of err. Used a better way to check whether we should continue checking accepted transactions.
* [DEV-312] Take in account subnetwork's GAS limit, when adding
transactions to block. Try to do that optimally.
* [DEV-312] Fixed GAS overusage calculation
* [DEV-337] Make sure that a transaction that uses more gas than the total allowed for sub-network
* [DEV-337] Moved transaction GAS check to mempool
* [DEV-337] Added Unit test for gas usage in transaction
* [DEV-337] Fixed build
* [DEV-337] Fixed tests stuff
* [DEV-337] Removed TODO comment
* [DEV-222] Changed type of TxOut.Value and util.Amount to uin64
* [DEV-222] Replaced math.MaxUint64 with 0
* [DEV-222] Fixed comment to reflect uint64 instead of int64
* [DEV-222] Fixed overflow comment