* [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-648] Add TestProcessDelayedBlocks
* [NOD-648] Add one second to secondsUntilDelayedBlockIsValid to make sure the delayedBlock timestamp will be valid, and add comments
* [NOD-648] Remove redundant import
* [NOD-648] Use fakeTimeSource instead of time.Sleep
* [NOD-648] Rename dag.HaveBlock->dag.IsKnownBlock, dag.BlockExists->dag.IsInDAG
* [NOD-648] Add comment
* [NOD-641] Rename HaveBlock->IsKnownBlock, BlockExists->IsInDAG
* [NOD-629] Change GHOSTDAG K to a a single byte using type
* [NOD-629] Rename variable
* [NOD-629] Rename K to KSize
* [NOD-629] Remove redundant casting
* [NOD-629] Add test for KSize
* [NOD-629] Seperate block serialization and db store
* [NOD-629] Make sure K is serialized as uint8
* [NOD-629] Rename KSize to KType
* [NOD-629] Comment for test
* [NOD-629] Change fail message
* [NOD-629] Remove newlines
* [NOD-629] Fix test
* [NOD-629] Do not use maxuint8, but !0 instead
* [NOD-629] Fix test
* [NOD-629] Merge conflict
* [NOD-629] Fix test; Update comment
* [NOD-652] Add selectedTip and getSelectedTip messages
* [NOD-652] Remove peerSyncState.isSelectedTipKnown
* [NOD-652] Do nothing on OnSelectedTip if the peer selected tip hasn't changed
* [NOD-652] Handle selected tip message with block handler
* [NOD-652] Add comments
* [NOD-652] go mod tidy
* [NOD-652] Fix TestVersion
* [NOD-652] Use dag.AdjustedTime instead of dag.timeSource.AdjustedTime
* [NOD-652] Create shouldQueryPeerSelectedTips and queueMsgGetSelectedTip functions
* [NOD-652] Change selectedTip to selectedTipHash where needed
* [NOD-652] add minDAGTimeDelay constant
* [NOD-652] add comments
* [NOD-652] Fix names and comments
* [NOD-652] Put msg.reply push in the right place
* [NOD-652] Fix comments and names
* [NOD-420] Delay blocks with valid timestamp (non-delayed) that point to a delayed block.
* [NOD-420] Mark block as requested when setting as delayed.
* [NOD-420] Merge master; Use dag.timeSource.AdjustedTime() instead of time.Now;
* [NOD-420] Return nil when not expecting an error
* [NOD-420] Initialise delyaed blocks mapping
* [NOD-420] Trigger delayed blocks processing every time we process a block.
* [NOD-420] Hold the read lock in processDelayedBlocks
* [NOD-420] Add delayed blocks heap sorted by their process time so we could process them in order.
* [NOD-420] Update debug log
* [NOD-420] Fix process blocks loop
* [NOD-420] Add comment
* [NOD-420] Log error message
* [NOD-420] Implement peek method for delayed block heap. extract delayed block processing to another function.
* [NOD-420] Trigger process delayed blocks only in process block
* [NOD-420] Move delayed block addition to process block
* [NOD-420] Use process block to make sure we fully process the delayed block and deal with orphans.
* [NOD-420] Unexport functions when not needed; Return isDelayed boolean from ProcessBlock instead of the delay duration
* [NOd-420] Remove redundant delayedBlocksLock
* [NOD-420] Resolve merge conflict; Return delay 0 instead of boolean
* [NOD-420] Do not treat delayed block as orphan
* [NOD-420] Make sure block is not processed if we have already sa delayed.
* [NOD-420] Process delayed block if parent is delayed to make sure it would not be treated as orphan.
* [NOD-420] Rename variable
* [NOD-420] Rename function. Move maxDelayOfParents to process.go
* [NOD-420] Fix typo
* [NOD-420] Handle errors from processDelayedBlocks properly
* [NOD-420] Return default values if err != nil from dag.addDelayedBlock
* [NOD-420] Return default values if err != nil from dag.addDelayedBlock in another place
Co-authored-by: Svarog <feanorr@gmail.com>
* [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-390] Add faucet Dockerfile
* [NOD-390] Allow running migration without -api-server-url and --private-key arguments
* [NOD-390] Change kasparov-server to kasparovd in its Dockerfile
* [NOD-390] Change API server and Kasparov server to kasparovd
* [NOD-502] Remove checkpoints.
* [NOD-502] Remove remaining references to checkpoints.
* [NOD-500] Split RejectFinality to RejectDifficulty.
* [NOD-500] Remove support for headers-first in p2p.
* [NOD-500] Panic in newHashFromStr in case of an error.
* [NOD-376] Made bad unorphaned blocks not reject the original block.
* [NOD-376] Fix wording in a comment.
* [NOD-376] Add a test to make sure that bad child blocks don't invalidate valid parent blocks.
* [NOD-376] Clarify comments and don't check PoW for child block (it's irrelevant for this test case).
* [NOD-292] In accept.go, made dbStoreBlock and flushToDB occur within the same transaction.
* [NOD-292] Implemented processing blocks that were not validated on BTCD start.
* [NOD-292] Fixed processing logic on init. Added a test for it.
* [NOD-292] Fixed some comments.
* [NOD-292] Made unlocks deferred in a couple of places.
* [NOD-292] Made unprocessed block reprocess via ProcessBlock rather than maybeAcceptBlock.
* [NOD-292] Fixed grammar in comment. Added an explanation to TestAcceptingInInit.
* [NOD-292] Split flushToDB into two versions.
* [NOD-292] Fixed a bad assignment.
* [NOD-292] Fixed bad spacing.
* [NOD-255] When orphan blocks arrive from netsync - don't write log unless we are in Debug
* [NOD-255] If there are more than K*2 orphans in pool - report as a potential problem anyway
* [NOD-255] Update comment to explain the K*2 figure
* [NOD-175] Added BlockAddedNotificationData and sent it instead of just a block on BlockAdded.
* [NOD-175] Added BFWasUnorphaned and raised it when an unorphaned block was to be accepted.
* [NOD-175] Fixed a typo.
* [NOD-175] Made it so that only the mempool gets updated if we're not current or the block was just now unorphaned.
* [NOD-139] Made processOrphans not turn an error if one of the parents is still missing.
* [NOD-139] Made addOrphanBlock and removeOrphanBlock process all parents instead of only the selected parent.
* [NOD-139] Made addOrphanBlock remove excess orphans by their timestamp rather than their discovery time. Fixed orphans being added more than once.
* [NOD-139] Simplified removal from slice in removeOrphanBlock.
* [NOD-139] Made check for no-orphans-left come before assignment to prevOrphans.
* [NOD-139] Added Timestamp() to util.Block.
* [NOD-139] Fixed merge errors.
* [NOD-58] Replace lastBlock with selected tip in version message (#210)
* [NOD-58] Replace lastBlock with selected tip in version message
* [NOD-58] Fix typo in comment
* [NOD-58] Add mutex to SelectedTipHash
* [NOD-58] Remove redundant comment
* [NOD-58] Remove wantStartingHeight from peerStats
* [NOD-58] Remove lock from SelectedTipHash
* Nod 53 change getheaders message to handle new block locator (#213)
* [NOD-53] Change getheaders message to handle the new block locator mechanism
* [NOD-53] Use heap in locateHeaders
* [NOD-53] Create a constructor for each heap direction
* [NOD-57] Check if a node is synced only by timestamps (#214)
* [NOD-60] implement isSyncCandidate (#218)
* [NOD-60] Implement isSyncCandidate
* [NOD-60] Fix typo
* [NOD-65] Fix netsync related tests and remove fields optionality from… (#220)
* [NOD-65] Fix netsync related tests and remove fields optionality from msgversion
* [NOD-65] gofmt rpcserver.go
* [NOD-65] add missing test for verRelayTxFalse
* [NOD-62] Change getblocks message to handle the new block locator mechanism (#219)
* [NOD-62] Change getblocks message to handle the new block locator mechanism
* [NOD-62] Add locateBlockNodes function
* [NOD-68] Adjust orphan parents requesting for a DAG (#222)
* [NOD-68] Adjust orphan parents requesting for a DAG
* [NOD-68] add sendInvsFromRequestedQueue and trigger it when requested blocks slice is empty, or immediatly if we're not in sync mode
* [NOD-68] Prevent duplicates from entering to state.requestQueue and add wrapping locks to addBlocksToRequestQueue
* [NOD-68] Fix Lock -> Unlock in sendInvsFromRequestedQueue
* [NOD-74] Starts syncing again when the current sync peer is done (#225)
* [NOD-74] Starts syncing again when the current sync peer is done
* [NOD-74] Unlock mtx before netsync is restarted
* [NOD-74] Fix name isSyncPeerFree -> isWaitingForBlocks
* [NOD-75] fixing netsync bugs (#227)
* [NOD-74] Starts syncing again when the current sync peer is done
* [NOD-74] Unlock mtx before netsync is restarted
* [NOD-75] Fixing netsync bugs
* [NOD-80] Request block data from block propagation just after you are… (#231)
* [NOD-80] Request block data from block propagation just after you are current
* [NOD-80] Fix adding to both queues in addInvToRequestQueue
* [NOD-81] Start to mine on top of genesis iff all peers selected tip is genesis (#232)
* [NOD-81] Start to mine on top of genesis only if all of your peers' selected tip is genesis
* [NOD-81] Explain forAllPeers/forAllOutboundPeers shouldContinue behaviour in comments
* [NOD-81] Add forAllInboundPeers and add return values for forAllPeers/forAllOutboundPeers/forAllInboundPeers functions
* [NOD-16] Add pushSet to the BlockHeap type
* [NOD-16] Fixed syntax error
* [NOD-56] Created devnet
* [NOD-56] Fixed tests
* [NOD-56] Fixed go vet errors
* [NOD-56] Added TestSolveGenesisBlock function
* [NOD-56] Created command line tool for solving genesis blocks
* [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-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-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-97] Moved github.com/daglabs/btcutil into github.com/daglabs/btcd/btcutil.
* [DEV-97] Updated Gopkg.toml to no longer refer to btcutil.
* [DEV-97] Renamed btcutil to util.
* [DEV-74] Implemented and written tests for utxoIterator.
* [DEV-74] Improved utxoIterator tests.
* [DEV-74] Implemented utxoCollection tests.
* [DEV-74] Implemented utxoDiff and its tests.
* [DEV-74] Implemented utxoSet.
* [DEV -74] Added tests for fullUTXOSet.
* [DEV-74] Added some tests for diffUTXOSet.
* [DEV-74] Wrote tests for diffUTXOSet iterator.
* [DEV-74] Added a negative test for diffUTXOSet.withDiff.
* [DEV-74] Wrote tests for addTx.
* [DEV-74] Wrote a toRemove test for addTx.
* [DEV-74] Changed blockNode.utxoDiff to be of type utxoDiff.
* [DEV-74] Removed superfluous whitespace.
* [DEV-74] Renamed confusing "previousHash" to "hash".
* [DEV-74] Fixed bad test and corrected failing test.
* [DEV-74] Moved confusing "negatives" test to be part of the general utxoCollection test.
* [DEV-74] Removed utxoDiff.inverted.
* [DEV-74] Renamed blockNode.utxoDiff to blockNode.diff.
* [DEV-74] Renamed diff to diffFrom for clarity's sake.
* [DEV-74] Converted the type of utxoCollection from map[daghash.Hash]map[uint32]*wire.TxOut to map[wire.OutPoint]*UtxoEntry.
* [DEV-74] Corrected test names in utxoCollection_test.
* [DEV-74] Removed superfluous utxoCollection iterator and moved utxoIterator into utxoset.go.
* [DEV-74] Renamed variables in utxoset.go.
* [DEV-74] Renamed verifyTx to areInputsInUTXO and removed a superfulous test.
* [DEV-74] Fixed bad test logic in TestDiffUTXOSet_addTx.
* [DEV-74] Added a few comments. Added reference-equals checks to clone functions.
* [DEV-74] Moved utxoCollection and utxoDiff into utxoset.go.
* [DEV-74] Wrote explanations for utxoCollection and utxoDiff tests.
* [DEV-74] Wrote explanations for all utxoSet tests besides addTx.
* [DEV-74] Wrote explanations for TestDiffUTXOSet_addTx.
* [DEV-74] Moved the documentation for utxoDiff into utxoset.go.
* [DEV-74] Wrote an explanation on utxoSet.
* [DEV-75] Found a typo.
* [DEV-75] Renamed dag -> virtual, dagView -> virtualBlock.
* [DEV-75] Renamed newDAGView to newVirtualBlock.
* [DEV-75] Moved queries for the genesis block from virtualBlock to BlockDAG.
* [DEV-75] Got rid of chainView height and findFork.
* [DEV-75] Renamed receivers from c to v.
* [DEV-75] Updated initBlockNode to allow for virtual (headerless) nodes, updated dbDAGState to contain multiple tip hashes, implemented virtualBlock.setTips.
* [DEV-75] Got rid of virtualBlock.equals, which was not used anywhere.
* [DEV-75] Got rid of virtualBlock.tip().
* [DEV-75] Got rid of SetTip everywhere except for tests.
* [DEV-75] Got rid of Next().
* [DEV-75] Got rid of Contains().
* [DEV-75] Got rid of HeightRange(), as no one was using it.
* [DEV-75] Made verifyDAG in rpcserver.go not use block height for iteration.
* [DEV-75] Got rid of the part of Manager.Init() that handled "catching up" for side chains, which allowed me to get rid of BlockDAG.BlockByHeight().
* [DEV-75] Dropped support for the RPC command getblockhash since it was getting blocks by their height.
* [DEV-75] Dropped getnetworkhashps since it was reliant on height, fixed another couple of RPC commands to return nextHashes instead of a nextHash, and got rid of nodeByHeight in virtualBlock.
* [DEV-75] Got rid of setTip().
* [DEV-75] Moved blockLocator() out of virtualBlock and into BlockDAG. Also removed TestLocateInventory().
* [DEV-75] Implemented addTip().
* [DEV-75] Cleaned up virtualblock.go a bit.
* [DEV-75] Erased irrelevant tests in virtualblock_test.go. Moved dag-related tests into dag_test.go.
* [DEV-75] Removed unnecessary nil check.
* [DEV-75] Wrote tests for virtualBlock.
* [DEV-75] Fixed bad test, added explanations to tests.
* [DEV-89] Fixed a comment.
* [DEV-89] Fixed another comment.
* [DEV-89] Removed the section in Manager::Init that handled rolling back indexes to the main chain if their tip is an orphaned fork. This could only happen during reorg, which no longer exists. Also removed BlockDAG::MainChainHasBlock, which was no longer used by anyone.
* [DEV-89] Removed the nil check inside initBlockNode() and amended the one place that called it with nil.
* [DEV-89] Renamed the receiver param for BlockDAG from b to dag.
* [DEV-89] Moved fastLog2Floor from dag.go to btcutil/btcmath.go.
* [DEV-89] Renamed tstTip to testTip.
* [DEV-89] Renamed phanom_test.go to phantom_test.go.
* [DEV-89] Fixed comments, renamed mainChainHeight to dagHeight.
* [DEV-89] Rewrote virtualBlock.addTip().
* [DEV-89] Fixed a comment. (chain -> DAG)
* [DEV-89] Fixed another chain -> DAG comment.