8 Commits

Author SHA1 Message Date
stasatdaglabs
1a569c7bd7 [NOD-270] Implement NotifyChainUpdates api call (#368)
* [NOD-270] Added notifyChainChanges and related commands.

* [NOD-270] Added NTChainChanged to blockdag.

* [NOD-270] Implemented collection and sending of ChainChanged notifications.

* [NOD-270] Fixed an improperly named test.

* [NOD-270] Added a test: TestChainChangedNotification.

* [NOD-270] Fixed a couple copy+paste errors.

* [NOD-270] Added a couple of comments for TestChainChangedNotification.

* [NOD-270] Fixed formatting error.

* [NOD-270] Fixed a comment.

* [NOD-270] Uncoupled chain updates inside blockdag from the concept of a notification.

* [NOD-270] Removed intermediary ChainUpdates object from ChainChangedNotificationData.
2019-08-21 12:58:32 +03:00
stasatdaglabs
2481871c10 [NOD-175] When resolving orphans - don't send inv (#300)
* [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.
2019-05-16 13:05:30 +03:00
Svarog
e93e60aa74 [NOD-63] Merge BlockAccepted and BlockConnected notifications into BlockAdded + remove BlockDisconnected notifications (#221)
* [NOD-63] Merge BlockAccepted and BlockConnected notifications into BlockAdded + remove BlockDisconnected notifications

* [NOD-63] Many instances of chain->DAG and similar

* [NOD-63] Some more chian -> DAG
2019-03-20 13:48:32 +02:00
stasatdaglabs
349e62fcd5 [DEV-332] Create partial block message in wire and make sure partial nodes receive partial blocks (#170)
* [DEV-332] Added MerkleProof to MsgBlock and rejected full-node/partial-block type misbehaviors.

* [DEV-332] Fixed merge issues.

* [DEV-332] Got rid of MerkleProof. Turns out we no longer need it.

* [DEV-332] Got rid of NTBlockDisconnected, as no one was ever triggering it. (It was part of reorg)

* [DEV-332] Implemented clearing out the payloads of transactions of outgoing blocks for partial nodes.

* [DEV-332] Extracted ConvertToPartial to its own method. Added a test. Added a condition for converting to a partial block.

* [DEV-332] Fixed bad ConvertToPartial condition.
2019-01-23 14:51:05 +02:00
stasatdaglabs
c65d9aa168 [DEV-97] Combine btcd and btcutil repositories (#51)
* [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.
2018-08-23 16:54:16 +03:00
stasatdaglabs
460216be65 [DEV-89] Convert DAGView into VirtualBlock (#41)
* [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.
2018-08-09 18:21:03 +03:00
stasatdaglabs
b07805cc12 [DEV-54] Rename "chainXXX", "bestXXX", etc. inside blockdag package (#25)
* [DEV-54] Renamed chainXXX to dagXXX.

* [DEV-54] Additional chain -> dag renamings.

* [DEV-54] Renamed a couple of more "chain"s I missed.
2018-07-12 12:46:03 +03:00
Stas Boutenko
6d64421965 [DEV-26] Renamed package blockchain to blockdag. 2018-06-17 18:46:47 +03:00