3143 Commits

Author SHA1 Message Date
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
9438bd0d2e [DEV-93] Backported 'peer: ensure the version negotiation goroutine will always exit'. (#50)
Original PR: https://github.com/btcsuite/btcd/pull/1228/files
2018-08-23 15:25:58 +03:00
Ori Newman
ce35aabb70 [DEV-88] Empty out btcd/blockdag/upgrade.go 2018-08-20 15:38:35 +03:00
Ori Newman
4b78fd007d [DEV-84] validate block parents order
* [DEV-84] validate block parents order

* [DEV-84] change AreEqual to look for order equality as well
2018-08-14 16:15:12 +03:00
Ori Newman
6475e03b93 [DEV-68] Backport 'blockchain: Backport optimize exported header access' 2018-08-14 15:53:48 +03:00
Ori Newman
176aad5dcd [DEV-94] Always reply with get headers 2018-08-14 15:48:29 +03:00
Ori Newman
d9abfa0fd3 [DEV-68] Revert block version to 1 everywhere
* revert block version to 1

* [DEV-68] remove dersig flag

* [DEV-68] get rid of vbLegacyBlockVersion

* [DEV-68] remove isBIP0030Node
2018-08-13 12:35:20 +03:00
Ori Newman
56fb7f09c1 [DEV-82] Take RPC Server out of btcd package
* [DEV-82] break down main to packages

* [DEV-82] separate rpcserver and server

* [DEV-82] Fixed Windows-related code that failed to compile.

* [DEV-82] remove params.go and use only dagconfig.Params

* [DEV-82] fix log.go license
2018-08-12 16:24:43 +03:00
Ori Newman
713b01c69d [DEV-86] Update BlockDAG.initDAGState to load the whole dag
* [DEV-86] remove selectedPrevBlock from initDAGState

* [DEV-86] re-implement dagview to be dag compatible

* [DEV-86] change comments
2018-08-12 12:07:28 +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
f6eb9edecf [DEV-74] Added infrastructure for Diff-based UTXOs (#39)
* [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-74] Moved diffChild next to diff, improved their comments, moved the explanations for diffFrom and withDiff to the appropriate methods, got rid of utxoIterator, and renamed areInputsInUTXO to containsInputs.

* [DEV-74] Replaced boring old-fashioned reference equality with special, fancy reference equality for maps, slices, and channels.

* [DEV-74] Wrote additional explanations for test cases.
2018-08-08 11:06:09 +03:00
Ori Newman
ed5df3bf7d [DEV-66] Make only transaction version 1 a standard transaction (#40)
* [DEV-66] Make only transaction version 1 a standard transaction

* [DEV-66] change checkTransactionStandard to get policy as argument
2018-08-06 16:59:33 +03:00
Ori Newman
904f2cf2e3 [DEV-72] Write Blues()
* [DEV-62] add phantom constructs to blocknode

* [DEV-62] add phantom constructs to blocknode

* [DEV-72] write blues()

* [DEV-72] write blues()

* [DEV-72] write blues()

* [DEV-62] add comments to new phantom constructs in blocknode

* Fixed dbIndexConnectBlock. (#33)

* Fixed dbIndexConnectBlock.

* Removed redundant check in storeFilter.

* Created a new method to BlockHeader: IsGenesis.

* [DEV-71] Implement BlockHeap (#35)

* [DEV-71] Implemented BlockHeap.

* [DEV-71] Removed irrelevant comment.

* [DEV-71] Renamed variables in Pop() and split Less() to multiple lines.

* [DEV-72] write blues()

* [DEV-72] write blues()

* [DEV-72] write blues()

* [DEV-72] write blues tests

* [DEV-72] write blues tests

* [DEV-72] remove relevant past

* [DEV-72] write blues tests

* [DEV-72] write blues tests

* [DEV-72] write blues tests

* [DEV-72] write functions to order blockSet by hash and write blue tests

* [DEV-72] add secret mining and censorship attack tests

* [DEV-72] remove prints

* [DEV-72] remove K from dagconfig.Params

* [DEV-72] remove K from dagconfig.Params

* [DEV-72] change blueScore to uint64

* [DEV-72] block V was missing, so renamed w -> v, x -> w etc

* [DEV-72] use node.String instead of %v

* [DEV-72] block V was missing, so renamed w -> v, x -> w etc

* [DEV-72] add K to dagconfig.Params, and add expected reds to all phantom tests

* [DEV-72] set K=10 and add comments to phantom and phantom tests

* [DEV-72] fix formatting and add comments to TestPhantom

* [DEV-72] fix grammar
2018-08-02 16:34:40 +03:00
Svarog
2068ac299a [DEV-77] Wire converage
* [DEV-77] Added tests for ScriptFreeList

* [DEV-77] Fixed formatting in BlockHeader .SelectedPrevBlock and IsGenesis

* [DEV-77] Restructured returnScriptBuffers to be more idiomatic and testable

* [DEV-77] Added tests for binaryFreeList

* [DEV-77] Added test-cases to TestVarIntWireErrors to check for errors when writing the varint length

* [DEV-77] Added MsgSendHeaders and MsgFeeFilter test-cases for TestMessage

* [DEV-77] Added test for BlockHeader.IsGenesis()

* [DEV-77] using binaryFreeListMaxItems instead of freeListMaxItems in TestBinaryFreeList

* [DEV-77] Fixed error message copy-paste typo
2018-07-29 14:32:28 +03:00
Svarog
19a043602b Dev 80 dagconfig coverage (#37)
* [DEV-80] Added tests for Strings(hashes)

* [DEV-80] Added tests for Bech32Prefix.To/FromString + DNSSeed.String()

* [DEV-80] Fixed namings of test variables
2018-07-29 10:46:17 +03:00
stasatdaglabs
226abbc37b
Merge pull request #32 from daglabs/dev-31-convert-time-int64
Dev 31 convert time to int64
2018-07-25 12:20:08 +03:00
Ori Newman
0c09c859b5 [DEV-31] fix nonce, bits, and timestamp comments 2018-07-25 12:16:57 +03:00
stasatdaglabs
ba0b4f61f3
Merge pull request #34 from daglabs/dev-62-add-phantom-constructs-to-blocknode
Dev 62 add phantom constructs to blocknode
2018-07-24 13:55:02 +03:00
Ori Newman
6a11450164 [DEV-62] fix phantom constructs comments 2018-07-24 13:53:22 +03:00
stasatdaglabs
5f800890ec [DEV-71] Implement BlockHeap (#35)
* [DEV-71] Implemented BlockHeap.

* [DEV-71] Removed irrelevant comment.

* [DEV-71] Renamed variables in Pop() and split Less() to multiple lines.
2018-07-22 17:26:18 +03:00
Ori Newman
c8db39e7d9 [DEV-62] add comments to new phantom constructs in blocknode 2018-07-22 16:13:12 +03:00
Ori Newman
9f315658df [DEV-31] remove irrelevant white spaces 2018-07-22 16:02:41 +03:00
Ori Newman
1e98d0dbfe [DEV-31] remove json transaction tests 2018-07-22 15:53:06 +03:00
stasatdaglabs
b4a9805157 Fixed dbIndexConnectBlock. (#33)
* Fixed dbIndexConnectBlock.

* Removed redundant check in storeFilter.

* Created a new method to BlockHeader: IsGenesis.
2018-07-22 15:06:13 +03:00
Ori Newman
9be0474913 [DEV-62] add phantom constructs to blocknode 2018-07-22 13:42:05 +03:00
Ori Newman
ce7fe1f26e [DEV-62] add phantom constructs to blocknode 2018-07-22 13:27:19 +03:00
Ori Newman
f1e24fcd43 Merge branch 'dev-31-20-tmp-branch' into dev-31-convert-time-int64 2018-07-22 13:02:24 +03:00
Ori Newman
16b9a36bcc [DEV-31] Fix conflicts with master 2018-07-22 13:02:22 +03:00
Mike Zak
290161b390 [DEV-20] Fix compilation errors in integration/rpctest due to BlockDAG 2018-07-22 12:45:08 +03:00
Mike Zak
3b95ec953e Merge remote-tracking branch 'origin/master' into dev-20-primitive-blockdag 2018-07-22 12:43:04 +03:00
Ori Newman
bed2d1b052 [DEV-31] Regenrate transactions for mining policy tests 2018-07-22 12:30:22 +03:00
Ori Newman
2c29cb2f20 Merge remote-tracking branch 'origin/dev-20-primitive-blockdag' into dev-31-20-tmp-branch 2018-07-22 12:02:33 +03:00
stasatdaglabs
f24673c396 [DEV-42] Update btcd package for DAG (#31)
* [DEV-42] Fixed rpcserverhelp.go.

* [DEV-42] Fixed GetBlockHeaderVerboseResult, GetBlockVerboseResult, and GetBlockTemplateResult.

* [DEV-42] Fixed rpcserver.go.

* [DEV-42] Got rid of the rescan command. Apparently it was deprecated and succeeded by the rescanBlocks command.

* [DEV-42] Modified handleRescanBlocks to satisfy compilation.

* [DEV-42] Fixed failing tests in rpcserver.go and rpcserverhelp.go.

* [DEV-42] Removed tests for rescan.

* [DEV-42] Removed rescan from notify.go.

* [DEV-42] Fixed a couple of comments I've missed.
2018-07-22 12:01:42 +03:00
Ori Newman
3989cc5dde Merge branch 'dev-31-convert-time-int64' into dev-31-20-tmp-branch 2018-07-22 11:59:16 +03:00
Ori Newman
9327fc01bb [DEV-31] Regenrate block databases and genesis blocks in order to be compatiable with the new structure (uint64 timestamps) 2018-07-22 11:58:21 +03:00
Ori Newman
75113a8d31 [DEV-31] Regenrate block databases and genesis blocks in order to be compatiable with the new structure (uint64 timestamps) 2018-07-20 20:09:30 +03:00
Ori Newman
552ffae636 Merge branch 'dev-31-convert-time-int64' into dev-31-20-tmp-branch 2018-07-20 10:25:49 +03:00
Ori Newman
e88d192f29 Merge remote-tracking branch 'origin/dev-20-primitive-blockdag' into dev-31-20-tmp-branch 2018-07-20 10:25:36 +03:00
Ori Newman
8e7d475bf9 [DEV-31] Regenrate block databases and genesis blocks in order to be compatiable with the new structure (uint64 timestamps) 2018-07-20 10:24:41 +03:00
Ori Newman
adb6c1fea9 [DEV-31] Regenrate block databases and genesis blocks in order to be compatiable with the new structure (uint64 timestamps) 2018-07-20 01:09:19 +03:00
Ori Newman
29f1b2baff [DEV-31] Regenrate block databases and genesis blocks in order to be compatiable with the new structure (uint64 timestamps) 2018-07-19 19:04:00 +03:00
stasatdaglabs
8b1897854a [DEV-41] Update netsync package for DAG (#30) 2018-07-18 17:18:45 +03:00
stasatdaglabs
67f19eb9d2 [DEV-36] Update cmd sub-packages for primitive BlockDAG (#29)
* [DEV-36] Fixed import.go.

* [DEV-65] Renamed BestState to State and GetSnapshot to GetCurrentState.

* [DEV-65] Implemented State and SelectedTip, updated dagState (the serializable version of State), and updated State creations.

* [DEV-65] Fixed references to GetCurrentState and fixed tests.

* [DEV-40] Created a new method AreEquals for comparing hash slices. Updated mining package to work with primitive DAG.

* [DEV-65] Renamed State to DAGState, corrected comments, created a new thread-safe method setDAGState, fixed broken references I missed.

* [DEV-65] Converted dagState (the object) to dbDAGState, and made it serialize/deserialize into/out of JSON.

* [DEV-65] Renamed Txns to Txs and fixed a couple of comments.

* [DEV-65] Renamed some more "Txns" and removed some dead code.

* [DEV-36] Fixed findcheckpoint.go.

* [DEV-36] Fixed indentation.

* [DEV-36] Fixed weird phrasing.

* [DEV-36] Fixed some more weird phrasing.

* [DEV-36] Removed haveBlocks variable from the function HaveBlocks.
2018-07-18 16:39:04 +03:00
stasatdaglabs
784839e8e7 [DEV-40] Update package mining and cpuminer for DAG (#28)
* [DEV-65] Renamed BestState to State and GetSnapshot to GetCurrentState.

* [DEV-65] Implemented State and SelectedTip, updated dagState (the serializable version of State), and updated State creations.

* [DEV-65] Fixed references to GetCurrentState and fixed tests.

* [DEV-40] Created a new method AreEquals for comparing hash slices. Updated mining package to work with primitive DAG.

* [DEV-65] Renamed State to DAGState, corrected comments, created a new thread-safe method setDAGState, fixed broken references I missed.

* [DEV-65] Converted dagState (the object) to dbDAGState, and made it serialize/deserialize into/out of JSON.

* [DEV-65] Renamed Txns to Txs and fixed a couple of comments.

* [DEV-65] Renamed some more "Txns" and removed some dead code.

* [DEV-40] Fixed formatting errors...

* [DEV-40] Reworded confusing test failure messages.

* [DEV-40] Fixed merge error.

* [DEV-40] Fixed style for AreEqual and TestAreEqual.
2018-07-18 11:54:17 +03:00
Ori Newman
417114edb4 [DEV-31] Convert all timestamp to uint64 2018-07-17 16:01:05 +03:00
Ori Newman
0878f98d1e [DEV-31] Convert all timestamp to uint64 2018-07-17 13:04:29 +03:00
stasatdaglabs
ead8a06219 [DEV-65] Convert BestState and GetSnapshot to State and GetCurrentState (#27)
* [DEV-65] Renamed BestState to State and GetSnapshot to GetCurrentState.

* [DEV-65] Implemented State and SelectedTip, updated dagState (the serializable version of State), and updated State creations.

* [DEV-65] Fixed references to GetCurrentState and fixed tests.

* [DEV-65] Renamed State to DAGState, corrected comments, created a new thread-safe method setDAGState, fixed broken references I missed.

* [DEV-65] Converted dagState (the object) to dbDAGState, and made it serialize/deserialize into/out of JSON.

* [DEV-65] Renamed Txns to Txs and fixed a couple of comments.

* [DEV-65] Renamed some more "Txns" and removed some dead code.
2018-07-17 10:44:44 +03:00
Ori Newman
90b71f1bb7 [DEV-31] Convert all timestamp to int64 2018-07-16 11:12:34 +03:00
Ori Newman
d488aebe0d [DEV-31] Convert all timestamp to int64 2018-07-15 18:00:21 +03:00
Ori Newman
d472600155 [DEV-18] Remove CSV and CLTV soft fork logic - convert to base protocol (#26)
* [DEV-18] changed CSV/CLTV to be regular op codes, and returned nop2 and nop3 to be regular nops

* [DEV-18] remove csv/cltv flags - part 1

* [DEV-18] remove csv/cltv flags - part 2

* [DEV-18] remove csv/cltv activation rules

* [DEV-18] remove csv/cltv activation rules

* [DEV-18] csv_fork_test fixes

* [DEV-18] readd chain params

* [DEV-18] readd chain params and remove csv activation rules

* [DEV-18] returned build flags to integration test

* [DEV-18] make csv/cltv to pop the the first element of the stack instead of peeking it

* [DEV-18] fix comments related to CSV/CLTV to remove any reference to soft fork

* [DEV-18] fix comments related to CSV/CLTV to remove any reference to soft fork

* [DEV-18] rename csv_fork_test.go to csv_fork.go

* [DEV-18] change mTx location

* [DEV-18] remove BIP0065Height

* [DEV-18] add function isUpgradableNop for readability
2018-07-15 13:56:34 +03:00