Commit Graph

192 Commits

Author SHA1 Message Date
UdjinM6
27f3218de9 HD wallet (#1405)
* HD wallet

Minimal set of changes (no refactoring) backported from Bitcoin upstream to make HD wallets work in Dash 0.12.1.x+

* minimal bip44 (hardcoded account and change)

* minimal bip39

Additional cmd-line options for new wallet:
-mnemonic
-mnemonicpassphrase

* Do not recreate HD wallet on encryption

Adjusted keypool.py test

* Do not store any private keys for hd wallet besides the master one

Derive all keys on the fly.
Original idea/implementation - btc PR9298, backported and improved

* actually use bip39

* pbkdf2 test

* backport wallet-hd.py test

* Allow specifying hd seed, add dumphdseed rpc, fix bugs

- -hdseed cmd-line param to specify HD seed on wallet creation
- dumphdseed rpc to dump HD seed
- allow seed of any size
- fix dumpwallet rpc bug (wasn't decrypting HD seed)
- print HD seed and extended public masterkey on dumpwallet

* top up keypool on HD wallet encryption

* split HD chain: external/internal

* add missing cs_wallet lock in init.cpp

* fix `const char *` issues (use strings)

* default mnemonic passphrase is an empty string in all cases

* store mnemonic/mnemonicpassphrase

replace dumphdseed with dumphdinfo

* Add fCrypted flag to CHDChain

* prepare internal structures for multiple HD accounts

(plus some code cleanup)

* use secure allocator for storing sensitive HD data

* use secure strings for mnemonic(passphrase)

* small fix in GenerateNewHDChain

* use 24 words for mnemonic by default

* make sure mnemonic passphrase provided by user does not exceed 256 symbols

* more usage of secure allocators and memory_cleanse

* code cleanup

* rename: CSecureVector -> SecureVector

* add missing include

* fix warning in rpcdump.cpp

* refactor mnemonic_check (also fix a bug)

* move bip39 functions to CMnemonic

* Few fixes for CMnemonic:
- use `SecureVector` for data, bits, seed
- `Check` should return bool

* init vectors with desired size where possible
2017-05-29 14:51:40 +03:00
Holger Schinzel
eaf90b7717 replace legacy dnsseed (#1395) 2017-03-15 00:55:52 +01:00
UdjinM6
cedd269cb0 shift CSV deployment window on mainnet to "Feb 5th, 2017 - Feb 5th, 2018" (#1314) 2017-02-04 04:41:18 +04:00
Tim Flynn
0ecc7c61eb Adjust start of 12.1 superblocks (#1311) 2017-02-03 21:41:22 +04:00
Tim Flynn
399330d42d Improve governance syncing efficiency with bloom filter (#1299)
* Use bloom filter for governance vote syncing

Modify masternode-sync to send bloom filters

Correctly initialize bloom filter

Set fUseFilter argument

Increase bloom filter size to account for multiple signals

Set bloom filter parameters

Use constants for bloom filter parameters

Added filter size check

Added filter size check in masternode-sync

Update bloom filter

Changed bloom parameters

* Bump protocol version

* Update sync time for inv's

* Changes based on code review comments

* Make bloom filter size network dependent

* Fix network dependent filter parameters

* Remove unneeded constant definition

* Move constant definition

* Add blank line
2017-02-02 12:50:44 +04:00
UdjinM6
60409df822 InstantSend overhaul (#1288)
* Multi-quorum InstantSend, complete refactoring
+ cleanup for IS and partial protobump

* more changes:
- allow InstantSend tx to have 10 inputs max
- store many unique tx hashes in mapVotedOutpoints
- more checks in AcceptToMemoryPoolWorker (moved from ProcessMessage + CTxLockRequest(tx).IsValid() )

* More changes:
- let multiple lock candidates compete for votes
- fail to vote on the same outpoint twice early

* More changes:
- notify CInstantSend on UpdatedBlockTip -> remove cs_main from CheckAndRemove()
- notify CInstantSend on SyncTransaction -> count expiration block starting from the block corresponding tx was confirmed instead of the block lock candidate/vote was created
- fixed few locks

* add comments about nConfirmedHeight

* Fix "Block vs Lock" edge case

* Fix "Block vs Lock" edge case, p2

* Fix issues:
- fix logic for locking inputs and notifying - see UpdateLockedTransaction, TryToFinalizeLockCandidate
- add missing hash inserting in ProcessTxLockVote
- add nMaxBlocks param to ResolveConflicts to limit max depth allowed to disconnect blocks recursively
- fix false positive mempool conflict
- add missing mutex locks
- fix fRequireUnspent logic in CTxLockRequest::IsValid
2017-01-29 12:22:14 +04:00
Holger Schinzel
96dda2790c added testnet checkpoint (#1235) 2016-12-30 08:05:29 +01:00
Holger Schinzel
e1702cd4ec bump copyright notice to 2017 (#1207) 2016-12-20 17:26:45 +04:00
UdjinM6
072b0fd708 fix annoying compiler warnings (#1204) 2016-12-14 17:33:46 +04:00
UdjinM6
b8557662d3 Rewrite fulfilled requests handling (#1040) 2016-09-27 11:50:04 +04:00
Evan Duffield
7d1dd5f63c Merge pull request #1008 from UdjinM6/makeTestnetMixingHarder
Make testnet mixing as hard as on mainnet
2016-09-13 08:16:41 -07:00
UdjinM6
8641ae189b Assign base58Prefixes[EXT_COIN_TYPE] properly (#1007) 2016-09-12 21:40:46 +04:00
UdjinM6
9ae4d51bc7 Make testnet mixing harder.
Require 3 participants (same as on mainnet)
2016-09-11 21:34:26 +03:00
Tim Flynn
a31e0cadec Set mainnet superblock cycle to monthly 2016-09-11 14:01:26 -04:00
Tim Flynn
740d1e0b1e Push out mainnet superblock start, in case people run 12.1 on mainnet (#999) 2016-09-09 19:51:46 +04:00
Holger Schinzel
9738a238fa Merge #997: update testnet checkpoint
696d8f4 update testnet checkpoint
2016-09-08 13:33:29 +02:00
Tim Flynn
b68e119e4d Changed testnet parameters to activate superblocks for 12.1 with sentinel. (#971)
- Note that this is expected to fork testnet around block 60000
2016-08-29 03:22:25 +04:00
Tim Flynn
0c65204ee6 Merge #967: V0.12.1.x sentinel pr 1 (#967)
d371930 Added nMinGivernanceQuorum chain parameter

6e24c9c Replace hardcoded minimum with nMinGovernanceQuorum parameter

66c0d9e Added new RPC calls needed by Sentinel
 - getsuperblockcycle
 - getsuperblockbudget
 - getmingovernancequorum

6bb2338 Replaced two new RPC calls with getgovernanceinfo

c9fbd8a Changed parameter nMinGovernanceQuorum to nGovernanceMinQuorum
2016-08-28 13:15:48 -06:00
UdjinM6
f678ea48bd Update checkpoints to match latest 0.12.0.x (#962) 2016-08-28 14:11:54 +04:00
UdjinM6
3b606b0c63 Merge #951: More block validation for governance (#951)
b6b6d6c Added nSuperblockStartBlock, adjusted testnet/regtest params

15a3c64 More for governance block checks, p1 (non-compilable):
    - add GetPaymentsLimit() and GetPaymentsTotalAmount()
    - IsValidBlockHeight() should check nSuperblockStartBlock
    - CSuperblock::IsValid should check payment limit and miner payout
    - no cs_main
    - slightly refactored related things

e8f9e5d More for governance checks, p2 (compilable):
    - IsBlockValueValid(), IsBlockPayeeValid() and FillBlockPayee() rewritten, no cs_main for them
    - CreateNewBlock adjusted, need more work on CBlockTemplate (see TODO)
    - moved (and simplified) IsBlockPayeeValid() call from CheckBlock() to ConnectBlock()

51434cf Add ability to calculate only superblock part of subsidy in GetBlockSubsidy()

aa74200 Fix GetPaymentsLimit()

f7b6234 braces and comment

ade8f64 more checks for IsValidBlockHeight()
2016-08-21 19:41:40 -06:00
Tim Flynn
de7b2b6c51 Merge #944: V0.12.1.x governance pr - part 1 - base functionality
068c178 Added DBG macro in util.h to facilitate debugging

    - This macro allows debugging statements (typically printf's or cout's) to
      be activated or deactivated with a single comment.  Uncomment the line:
      //#define ENABLE_DASH_DEBUG
      in util.h to enable debugging statements.

    - When commented any code wrapped with the DBG() macro will simply be removed
      by the preprocessor.  When not commented all such wrapped statements will
      be present.

    - For maximum effectiveness it is best that util.h be the first effective include
      in all source files.  It is also possible to enable the macro for a single file
      by temporarily adding #define ENABLE_DASH_DEBUG to the top of the file.

    - Code committed to non-development branches should always have the define
      commented.

d125d9b V0.12.1.x -- merging trigger/generic object/superblock changes for testnet phase II

    - This commit contains the core governance system changes for 0.12.1.  Any unrelated
      changes have either been removed or moved to separate commits.

120724c File mode fixes

    - Changed mode 0755->0644 on several source files.

c7f9e11 Updated todo reminders

    - Added reminder to revert temporary reduction of number of votes
      required to trigger superblock to 1 for testing

92adc98 Made CSuperblockManager::IsValidSuperblockHeight an inline function

    - This is for efficiency since this function is called often and is
      only 1 line of code.

c050ed7 Added comment explaining rationale for no LOCK(cs) in CSuperblock::IsValid

dc933fe Removed unused CSuperblockManager::IsBlockValid function

decec88 Moved calls to SuperblockManager::IsValidSuperblockHeight into IsSuperblockTriggered.

    - Since calls to the later function are always protected by the former there's
      no reason to keep these separate and this simplifies the code in
      masternode-payments.cpp.

8672885 Reestablished expected value check for non-superblocks in IsBlockValueValid

b01cbe0 Changes to IsBlockValueValid to fix rpc test failure

a937c76 Changed include order to allow per file activation of the DBG macro

d116aa5 Fixed IsValidSuperblockHeight logic

    - Note this has an effect on testing because we can now only create
      1 superblock per day.  Devs may need to temporarily change testnet params
      for easier testing.

2d0c2de Convert superblock payments to CAmount

    - We assume that payment values in JSON are in units of DASH
      for consistency with other RPC functions, such as
      createrawtransaction.

376b833 Revert temporary testing value for nAbsVoteReq

    - Also ensure that number of votes required is never smaller than 1

8c89f4b Cleaned up CSuperblock error handling

    - Exceptions are now thrown consistently rather than using a mix of
      exceptions and return code checking.  Exceptions are now caught only
      in AddNewTrigger when the CSuperblock constructor is called.  Unnecessary object
      status members have been removed.

d7c8a6b Removed utilstrencodings header

    - This appears to help with travis tests, for unknown reasons.

c4dfc7a Fixed some minor code review issues

63c3580 Reverted locking change in miner.

    - This should have been done in the original PR but was overlooked.

4ab72de Fixed variable name to match common practice and bracket formatting

886a678 Improvements to vote conversion code

    - Replaced redundantly defined function with inclusion of governance-vote.h

    - Replaced magic numbers with their corresponding constant symbols

0a37966 Reordered governance message handling
2016-08-17 09:08:25 +02:00
UdjinM6
7f89bba83e Refactor InstantSend to use block count instead of local time to set expiration limit - nInstantSendKeepLock. Also make it (and number of blocks to reprocess in case of a conflict) a part of Consensus params and set it to lower numbers for testnet/regtest to be able to break things easier there.
Bump MIN_INSTANTX_PROTO_VERSION
2016-08-08 16:43:15 +03:00
Andy Freer
d2c6b2a74e Merge #926: Change extended key version bytes to BIP32
77613d9 Revert changing BIP32 version bytes to maintain existing Dash versions
6ce0d3e Change to BIP32 values
fe6174b Comments and add regnet EXT_COIN_TYPE
c874a0f Update testnet/regtest EXT_COIN_TYPE
2016-08-02 00:00:24 +02:00
UdjinM6
d514ee7f9a Merge #922: Refactor/fix spork
42bdf42 Refactor/fix spork:
- move ProcessSpork, GetSporkValue, IsSporkActive, ExecuteSpork and mapSporksActive to CSporkManager
- move Sign, CheckSignature, Relay to CSporkMessage
- move ReprocessBlocks out of sporks to main.cpp / rename DisconnectBlocksAndReprocess to DisconnectBlocks
- rename SporkKey to SporkPubKey
- bugfix: only set strMasterPrivKey if spork signature produced by that key was verified successfully
- few log format changes, cleaned up includes
2016-07-30 13:04:27 +02:00
Holger Schinzel
f4e4dd65e7 Tag 0.12.1 final
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEbBAABCgAGBQJXD/i3AAoJEHSBCwEjRsmmOHsH+L5eRpiPeLhrDYyBFbp9RFKU
 TztyoeKAM4llEPmk6vAawgSL8HNY4va6lbY84sDfvCdLJqCxVR7MyiuQ4AQPXG4R
 Ke5DJ/G/K4ngyqruCBsSh2RJdVDrbE3zCmjN5gxPxrNKpi+mXs//A6gjvfxn4U1F
 WZepN3FzNFcqFG/ndKxptMYZoIuiK9JIhK7V/ksFKRPlUhipa1jh5sIWvCeFjiLT
 Wt8wGlHPHDFsPJW1o7EWMTHRhNCVqYhMDU7GT6FixIJFRGANIGlwfIUuqqUt0sil
 7YWIwD/+ai3dfeODazauqJAOEBXjoWCkuXn9IN/VhtvHOFR6AZO2aljS9ks6Cw==
 =6vRi
 -----END PGP SIGNATURE-----

Merge bitcoin tag 'v0.12.1' into dash v0.12.1.x

Merging Bitcoin 0.12.1 into Dash 0.12.1.x
2016-07-04 11:20:16 +02:00
Holger Schinzel
a38d983b18 Merge #892: Update dnsseeds
c8d3b55 Update dnsseeds
- removed darkcoin.qa
- added dashdot.io
2016-06-21 18:33:33 +02:00
Holger Schinzel
839ae4ba17 merge #856: update testnet checkpoint
0143dc9 update testnet checkpoint
2016-06-02 08:12:02 +02:00
Holger Schinzel
9b9d105c23 merge #854: update testnet checkpoint
c4b12e9 update testnet checkpoint
2016-06-01 19:33:26 +02:00
Holger Schinzel
3f76398e68
updated testnet seeders 2016-05-31 13:54:09 +02:00
UdjinM6
9745914c15 remove hardcoded strDarksendPoolDummyAddress (#828)
- use "" account address instead
- remove `collateralPubKey` and `SetCollateralAddress()` from darksend and create `dummyScriptPubkey` and `InitDummyScriptPubkey()` in masternodeman instead
- initialize `dummyScriptPubkey` before loading cache otherwise MNs could be removed because of the invalid tx
2016-05-30 08:22:08 +02:00
Holger Schinzel
940035393c updated testnet checkpoint (#819) 2016-05-28 12:31:38 +02:00
Evan Duffield
d8453bb92b Use chainparams instead of standalone func for mn confirms
- Use function instead of chainparams directly
2016-05-19 13:54:23 -07:00
Evan Duffield
9031c5e3cb Update some governance logic 2016-05-13 09:03:01 -07:00
UdjinM6
b9ad319d00 Unify subsidy formulas for different networks, add few comments 2016-05-10 12:50:57 +03:00
Holger Schinzel
05661617a6 Some houskeeping:
- fixed testnet checkpoints
- revert testnet mining patch
2016-05-10 09:57:05 +02:00
moocowmoo
c5004ce308 config - changed network bip32 values, testnet/regtest pubkey
mainnet bip32 seeds start with dpub/dprv
testnet/regtest  bip32 seeds start with DPUB/DPRV
only create public testnet/regtest addresses starting with y
2016-05-09 19:13:22 +00:00
Pieter Wuille
ee40924fef Add CHECKSEQUENCEVERIFY softfork through BIP9 2016-03-18 09:28:40 +00:00
Suhas Daftuar
8ebc6f2aac Add testing of ComputeBlockVersion 2016-03-18 09:14:53 +00:00
Pieter Wuille
6f83cf2adb BIP9 Implementation
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and
based on code by Jorge Timon.
2016-03-18 09:14:52 +00:00
TheLazieR Yip
d401d64281 Clean duplicated params setting for test network.
Closes #724
2016-03-09 07:18:59 +01:00
UdjinM6
b682fcb8d6 Fix GetBlockSubsidy for regtest, bump regtest settings
Closes #719
2016-03-06 18:15:33 +01:00
UdjinM6
f50d534440 fix nMaxTipAge 2016-02-19 07:59:22 +03:00
UdjinM6
e8d9aabb62 Move many hardcoded mainnet/testnet magic numbers to consensus part of chainparams,
get rid of most `if(Params().NetworkIDString() == CBaseChainParams::MAIN)` and alike to unify formulas.
Further improvements will require testnet restart (see TODO notes in changed code) so I'm keeping few things as they are till then.
2016-02-17 21:54:24 +03:00
UdjinM6
8092c84694 fix consensus.nSubsidyHalvingInterval (210000 -> 210240) and ConnectBlock 2016-02-15 16:40:35 +03:00
UdjinM6
a5ac60b868 Merge remote-tracking branch 'bitcoin/0.12' into HEAD
+ merge fixes
+ keepass on evhttp
2016-02-06 16:48:04 +03:00
Holger Schinzel
274145f1a7 checkpoint 2016-01-22 13:42:22 +01:00
MarcoFalke
333e1eaeea
Bump copyright headers to 2015
- Bump copyright headers to 2015
- [devtools] Rewrite fix-copyright-headers.py
- [devtools] Use git pretty-format for year parsing

Github-Pull: #7205
Rebased-From: fa6ad855e9 fa24439ff3 fa71669452
2016-01-05 14:13:33 +01:00
Elias Rohrer
9572e4944a
Removed offline testnet DNSSeed 'alexykot.me'.
Github-Pull: #7216
Rebased-From: e18378e53f
2015-12-17 10:40:50 +01:00
Pieter Wuille
eece63fa72 Switch blocks to a constant-space Merkle root/branch algorithm.
This switches the Merkle tree logic for blocks to one that runs in constant (small) space.
The old code is moved to tests, and a new test is added that for various combinations of
block sizes, transaction positions to compute a branch for, and mutations:
 * Verifies that the old code and new code agree for the Merkle root.
 * Verifies that the old code and new code agree for the Merkle branch.
 * Verifies that the computed Merkle branch is valid.
 * Verifies that mutations don't change the Merkle root.
 * Verifies that mutations are correctly detected.
2015-11-27 15:36:52 +01:00
Alex Morcos
33c90cf197 Make skipping BIP30 check chain agnostic 2015-11-02 20:11:55 -05:00