Commit Graph

2758 Commits

Author SHA1 Message Date
David Hill
cdd4cf130d glide: sync with latest dcrrpcclient (#549) 2017-01-24 11:27:28 -05:00
David Hill
7b56d51fb1 dcrjson: Remove balance type from getbalance API (#548) 2017-01-24 10:30:05 -05:00
David Hill
f5c0b7eff2 dcrjson: Add GetAccountBalanceResult and GetBalanceResult (#547) 2017-01-19 11:48:54 -05:00
Haakon Nilsen
8e2042e765 fix singular case for stake transactions (#545) 2017-01-16 12:35:02 -06:00
Alex Yocom-Piatt
be59de84e6 Update 3rd party deps at the start of 0.8.0 dev (#536) 2017-01-09 12:42:03 -05:00
David Hill
0e91858c85 stake: Add SSGenVoteBitsExtendedMaxSize const (#541) 2017-01-04 18:09:23 -05:00
pedro martelletto
f3e94e109f Add one more consensus test (#520)
Ensure the rejection of blocks resulting in large serializations.
2017-01-02 17:15:48 +00:00
DanielTheSilly
a12efa6c88 Change maxShift from var to const (#502) 2017-01-02 10:59:49 -06:00
DanielTheSilly
b6819b09f7 Typo correction (#501) 2017-01-02 10:51:36 -06:00
John C. Vernaleo
a4de235531 Bump for v0.7.0 2016-12-23 17:05:03 -05:00
Marco Peereboom
c0b39b7809 Validate softforking mechanism with the fullblock tester. (#526)
All corner cases are thoroughly documented in the Generate function in
file blockchain/stakeversiontests/generate.go.

Fixes #525
2016-12-23 16:03:56 -06:00
Marco Peereboom
e3eb40b4e8 Implement soft-forking mechanism. (#524)
* Bump block header version to 3.
* Enforce new rules once block version gets to 3.
* Use Voter Versions to control bumping of Stake Version.
* Calculate appropriate stake version based on history and prior
  intervals in the mining code.
* Add bunch of UT to validate code.

This is the minimally correct working implementation.  This code
desperately needs to memoize the questions that are asked repeatedly.

Fixes #523
2016-12-23 15:42:52 -06:00
David Hill
dcbb281d76 rpc: Add missing StakeVersion to getblock verbose (#529) 2016-12-22 11:39:53 -06:00
Marco Peereboom
3e4ed1b49d Implement stake voter version interrogation command. (#522)
Fixes #521
2016-12-21 22:14:13 -06:00
Dave Collins
574620e459 fullblocktests: Generate subsidy for voted block. (#519)
This tweaks the full block test infrastructure to generate the pos
subsidy based upon the block being voted on as opposed to the current
one so it matches the consensus rules.
2016-12-20 10:38:43 -06:00
Dave Collins
7056dec96b fullblocktests: Limit tickets to target pool size. (#518)
This modifies the full block consensus tests to only purchase tickets
until the target pool size is reached during the initial creation of the
blocks needed to reach stake validation height.

This helps make the code a little more flexible since it will allow many
more blocks to be created without spiking the ticket price as would
happen prior to this change.

For a little intuition, once stake validation height is reached the
tests intentionally purchase the same number of tickets as are voting on
each block in order to achieve a steady state, so if the number of
tickets in the pool are already higher than the target pool size prior
to reaching that steady state, the ticket price would keep rising until
the outputs used to purchase the tickets no longer had enough funds
available to purchase them.
2016-12-20 10:38:23 -06:00
Dave Collins
face803542 blockchain: Make params used in tests match. (#517)
This updates the various definitions of the simnet params used
exclusively in the tests to match their definitions used by the actual
simnet parameters defined in chaincfg.

While it would certainly be easier to simply use the params defined in
chaincfg, that also would not allow the tests to detect them being
inadvertently changed.
2016-12-20 10:37:22 -06:00
John C. Vernaleo
4d739898c6 Fix output formatting in a unit test.
Closes #512
2016-12-14 14:37:55 -05:00
John C. Vernaleo
57e16f516c Test another failing condition in validate.go
Closes #510
2016-12-14 12:41:52 -05:00
jolan
7c6491023d add more checkpoints for upcoming release (#509) 2016-12-14 11:04:51 -06:00
Josh Rickmar
da8a0334fa Pull in latest dcrutil. (#508)
Switch to using P-521 for certs created by dcrd and gencerts.
2016-12-07 14:59:21 -05:00
John C. Vernaleo
b89abb72e4 Remove -v from go test.
This caused unhelpful clutter in travis output.

Closes #506
2016-12-07 09:55:33 -05:00
Josh Rickmar
2c648249d5 Fix typo. (#505)
Discovered by @davecgh.
2016-12-06 21:41:05 -05:00
John C. Vernaleo
0684df18f5 Add unit tests.
Unit tests for context free block sanity checks.

Unit test for block context for gen block.

Closes #503
2016-12-06 08:44:44 -05:00
Josh Rickmar
b415e9630d dcrjson: Add rescanwallet JSON-RPC request. (#500)
Closes #499.
2016-12-05 09:18:34 -06:00
Dave Collins
e9acb1d35b
mempool: Refactor mempool code to its own package.
Upstream commit 7fac099bee.

Also, the merge commit contains the necessary decred-specific
alterations, adds a new policy parameter for AllowOldVotes to keep with
the spirit of the merged commit, modifies the RawMempoolVerbose to
accept an optional filter type to retain that functionality, and various
other cleanup intended to bring the code bases more in line with one
another.
2016-11-29 15:32:22 -06:00
Dave Collins
1fe31798de rpcserver: Return RPC errors from block template. (#494)
This modifies the RPC server blockTemplateResult function to return RPC
errors as expected instead of using mempool and chain errors.

In addition to being more correct, it also helps pave the way for
mempool separation since its internal error funcs will no longer be
available to abuse as this code was doing.
2016-11-29 11:47:53 -06:00
David Hill
b26ffbdb1b Bump to v0.6.1 (#492) 2016-11-25 21:34:20 -06:00
Dave Collins
698fee123b multi: Restore correct upstream majority version code. (#490)
This reverts to the correct upstream majority version code which
properly detects when certain thresholds of the network have been
updated in order to determine when to start rejecting old version
blocks and enforcing the rules in the new version block.
2016-11-25 20:59:46 -06:00
Dave Collins
a227189444 stake: Convert TxType constants to enum syntax. 2016-11-23 19:32:36 -06:00
Dave Collins
3ff0cf8afe
mempool: Decouple mining-specific logic.
This splits the mining-specific code that deals with sorting blocks
according to the number of votes available for it in the mempool into
mining.go.

This is being done for a couple of reasons:

1) Mining-specific code does not belong directly in the mempool
2) It is required to be able to split the mempool into a separate
   package which an upcoming upstream sync does

In order to accomplish this, a new function named VotesForBlocks has been
exposed on the mempool and the SortParentsByVotes code has been moved to
mining.go and modified to no longer return errors.  The reasoning for
this is the same as the recent change to VoteHashesForBlock.  That is to
say it is not the responsibility of a sorting function to dictate
caller-specific block eligibility logic.
2016-11-23 10:18:27 -06:00
Dave Collins
bfb9ca95b7
mempool: Rename GetVoteHashesForBlock & remove err.
This renames the GetVoteHashesForBlock on the mempool type to
VoteHashesForBlock so it is named according to Effective Go guidelines
as required by the project's code contribution guidelines and removes
the error return and paths from the function.

The error has been removed since the function should not be assuming how
the caller wishes to use the data.  Consequently, now when there are no
votes for a given block hash, the function simply returns a nil slice to
reflect that.  The caller can then decide if the lack of vote hashes for
a block is an error or not.

Also, the error path regarding an unset vote hash in the metadata is an
impossible condition because the mempool has full control over the vote
insertion and thus will never insert vote metadata without it.
2016-11-22 13:12:58 -06:00
Dave Collins
448d0bbd4e mempool: Remove exported InsertVote function. (#483)
Vote insertion is an internal mempool operation and thus should not be
exposed to callers outside of the package.  It also had an undocumented
assumption that the provided tx had already passed stake.IsSSGen checks
which is yet another reason the function shouldn't be exposed.
2016-11-22 12:04:42 -06:00
Dave Collins
3526f520e4
server: Optimize get mining state code.
This slightly optimizes the code which is invoked to provide the current
mining state to remote peers.

First, rather than creating copies of all of the hashes into a new slice
while limiting them in the OnGetMiningState function, just subslice
the hashes to the max length when there are too many.

Second, make the slices []chainhash.Hash which has better cache
locality and only requires a single allocation as opposed to one per
hash.

Finally, convert the pushMiningState function to accept []chainhash.Hash
slices for the block hashes and vote hashes and use the hashes directly
in the slices to build the final wire message.
2016-11-21 23:20:45 -06:00
Dave Collins
67b9004bab
stake/dcrjson: Simplify code with gofmt -s. 2016-11-21 11:03:17 -06:00
Dave Collins
d0b3a35e8b
mempool: Optimize the votes map slices.
This optimizes the vote map by making better use of Go's slice properties.
In particular, instead of creating a slice with empty entries and
iterating to find the next empty entry, just create the slice with a cap
and append entries as needed.  This allows the code simply take the len
of the slice and range over it without needing additional code to deal
with nil entries.

While here, it also makes a few comments and returns more consistent
with the rest of the code base.
2016-11-18 19:20:03 -06:00
Dave Collins
8bd9101d7b
server: Remove superfluous check in OnMemPool.
Contains the following upstream commits:
- 05ab7141d3
  - Reverted because Travis is already at a more recent version
- 87b3756c8c
2016-11-18 13:19:35 -06:00
Dave Collins
26b74c431c
docs: Add chainhash to README.md
Upstream commit 4a5223266c.
2016-11-18 13:07:59 -06:00
Dave Collins
6cce15fe9e
txscript: Expose AddOps on ScriptBuilder.
Upstream commit cee207c64c.
2016-11-18 12:58:00 -06:00
Dave Collins
2756dbde3a
license: add title
Upstream commit fb9b640ef2.
2016-11-18 12:36:40 -06:00
Dave Collins
9d4ac11eca
dcrd: Simplify shutdown signal handling logic sync.
Upstream commit 044a11c9fc.
2016-11-18 12:06:55 -06:00
Dave Collins
60c812e735
multi: Upstream parameter abstraction sync
Upstream commit a7b35d9f9e.

Also, the merge commit contains necessary decred-specific alterations.
It also has the side effect of correcting a couple of min reduction bugs
even though they can't currently ever be hit due to the min reduction
interval flag being disabled for all networks.
2016-11-16 19:34:01 -06:00
David Hill
563f4d13b1 blockchain: LogBlockHeight only needs a wire.MsgBlock.. (#471) 2016-11-16 15:57:45 -06:00
Dave Collins
c162fbde71
multi: Upstream chainhash abstraction sync
Contains the following commits:

- 711f33450c
- b6b1e55d1e
  - Reverted because Travis is already at a more recent version
- bd4e64d1d4

Also, the merge commit contains the necessary decred-specific
alterations, converts all other references to sha to hash to keep with
the spirit of the merged commits, and various other cleanup intended to
bring the code bases more in line with one another.
2016-11-16 12:48:40 -06:00
Dave Collins
0aa33e0fbd
wire: Consolidate tests into the wire pkg.
Contains the following upstream commits:

- 6e644855f5
  - This commit has been reverted since newer versions are already set
- d406d9e52b
2016-11-14 15:29:40 -06:00
Dave Collins
8536f35db8 blockchain: optimize HaveBlock
Upstream commit 61a15f6f1b.
2016-11-14 15:05:10 -06:00
Dave Collins
a0c19ada7b
wire: Export transaction tree constants.
This exports the transaction tree constants from the wire package
instead of from dcrutil.  The tree is a fundamental part of a
transaction and therefore its definitions belong in wire alongside the
other constants that are also related to fundamental transaction fields.

Further, the wire package most definitely should not depend on dcrutil
since that would create a cyclic import cycle.
2016-11-14 14:35:22 -06:00
Dave Collins
748ecb2a52
blockchain: Associate time src with chain instance.
Upstream commit 00ebb9d14d

Also, the merge commit contains the necessary decred-specific
alterations.
2016-11-11 18:06:09 -06:00
Dave Collins
cf7fbc0406
peer: Extract protocol negotiation from main loops.
Contains the following upstream commits:
- 5cbd1f85bf
- 777ccdade3
- f3d759d783
- 1ffc3dc18d

Also the merge commit updates the code to use the correct Decred
protocol versions and contains a few style-related changes.
2016-11-11 14:57:30 -06:00
Dave Collins
7a8c90d18f
peer: use atomics instead of mutexes
Contains the following upstream commits:
- ff4ada0b0e
  - This commit has already been cherry-picked so it is a NOOP
- 7de7bddba9.
2016-11-11 13:36:07 -06:00