Commit Graph

9 Commits

Author SHA1 Message Date
David Hill
5fc31ca578 multi: fix misspell linter warnings 2018-02-18 12:26:52 -06:00
Dave Collins
2296b31e5d
blockchain: Refactor main block index logic.
This refactors the block index logic into a separate struct and
introduces an individual lock for it so it can be queried independent of
the chain lock.

It also modifies the `newBlockNode` function to accept nil for the
ticket spend information parameter and updates all of the test code that
doesn't require it to use nil.
2018-01-30 13:21:57 -06:00
Dave Collins
855305962a
multi: Enable vote for DCP0002 and DCP0003.
This implements the agenda for voting on the LN features as defined in
DCP0002 and DCP0003 along with consensus tests to ensure its correctness.

The following is an overview of the changes:

- Generate new version blocks and reject old version blocks after a
  super majority has been reached
  - New block version on mainnet is version 5
  - New block version on testnet is version 6
- Introduce a convenience function for determining if the vote passed
  and is now active
- Introduce a new function for getting the consensus script verification
  flags and setting the appropriate flags to enforce the new consensus
  semantics in accordance with the state of the vote
- Enforce transaction finality checks based on the past median time in
  accordance with the state of the vote
- Enforce relative time locks via sequence numbers in accordance with
  the state of the vote
- Modify the more strict standardness checks (acceptance to the mempool
  and relay) to enforce DCP0002 in accordance with the state of the vote
  - It should be noted that the flag for DCP0003 is always set for
    the more strict standardness checks because it is a soft fork while
    the DCP0002 enforcement must depend on the result of the vote
    because it is a hard fork
- Add tests for determining consensus script verification flags for both
  mainnet and testnet
- Add tests for determining if the agenda is active for both mainnet and
  testnet
2017-09-22 11:43:58 -05:00
Dave Collins
05d8456d3e
multi: Rename vote choice IsIgnore to IsAbstain.
This renames the chaincfg parameter for the vote choice which represents
an abstaining vote to be named IsAbstain instead of IsIgnore since that
more accurately describes its intent and behavior.

It also updates the RPC server choice result field for isignore to be
named isabstain to match and bumps the major version accordingly.

Finally, it renames other internal variables which make use of the
choice to include the word abstain as well for clarity and renames a
couple of other internal variables.
2017-04-24 16:17:27 -05:00
Marco Peereboom
02d024be5a blockchain: use next block stake version.
Modify threshold state to use the stake version that will be used in the
next block. That removes a full interval before voting can start and it
makes all voting intervals consistent.

Fixes #595
Requires #596
2017-03-15 18:12:16 -05:00
Marco Peereboom
54d1da3151 Convert version array to version:bits tuple. (#586)
Propagate version and bits on the getstakeversions call.  Now we can
interrogate all raw vote version/bits data in addition to cooked values.

Diff is mostly mechanical exporting the Version:Bits tuple.
2017-02-21 12:39:43 -05:00
Marco Peereboom
b3763d4594 Create a tuple for vote version+bits.
With this change we can keep the version and the bits in blockNode.
This is used to fix an oversight where we weren't strictly enforcing
the vote version.  This also adds tests that validate quorum-1, quorum,
75%-1 and 75% rules during tallying.

Also adjust getvoteinfo totals to only return the specified vote version
totals.
2017-02-15 13:12:23 -06:00
Dave Collins
637e6d9e10
multi: Implement block size hard fork demo voting.
This implements a new voting agenda for the testnet and simnet networks
for increasing the maximum block size from 1MiB to 1.25MB.

The following is an overview of the changes:

- Bump the maximum protocol block size limit to 1.25MB
- Bump the protocol version to 4
- Add wire tests for v3 protocol sizes and update tests for latest
- Update all wire values that are defined in terms of the max block size
  to respect the protocol version
- Update the MaxSigOpsPerBlock constant to maintain existing value
  regardless of the raised max protocol block size
- Decouple the maximum tx size from the block size by creating a chain
  parameter for it with the current sizes so it is not a part of the
  hard fork vote
- Add definition for new version 4 stake vote along with agenda to vote
  on block size to the testnet and simnet networks
- Convert the MaximumBlockSize chain parameter to a slice in order to
  hold the different possible sizes
- Adds a new function that returns the maximum block size based upon the
  result of the vote
- Change the existing context-free block size check to enforce the max
  protocol size and introduce a context-specific check which enforces a
  restricted size based upon the network consensus parameters and the
  result of the vote
- Set the max allowed size in generated block templates based upon the
  network params and result of the vote
- Generate version 4 blocks and reject version 3 blocks after a super
  majority has been reached
2017-02-13 13:28:21 -06:00
Marco Peereboom
6967358649 blockchain: Implement configurable voting on top of PoS. (#542)
Port BIP0009 over from btcd.  The following is an overview of the
changes:
- Add new configuration options to the chaincfg package which allows the
  rule deployments to be defined per chain
- Implement code to calculate the threshold state as required by voting
  - Use threshold state caches that are stored to the database in order
    to accelerate startup time
  - Remove caches that are invalid due to definition changes in the
    params including additions, deletions, and changes to existing
    entries
  - Verify that PoW and PoS majorities have been reached.
- Add tests for new error type
- Add tests for threshold state
- Deployments are per stake version.
- Add human readable vote/choice infrastructure.
- Add RPC command to interrogate vote status (getvoteinfo).
2017-02-13 13:32:40 -05:00