Merge branch 'v0.12.0.x'

This commit is contained in:
Evan Duffield 2015-08-18 18:04:04 -07:00
commit 37ae8d36b1
6 changed files with 59 additions and 42 deletions

View File

@ -14,26 +14,31 @@ Budgets go through a series of stages before being paid:
1. Prepare collateral transaction 1. Prepare collateral transaction
--
mnbudget prepare proposal-name url payment_count block_start dash_address monthly_payment_dash [use_ix(true|false)] mnbudget prepare proposal-name url payment_count block_start dash_address monthly_payment_dash [use_ix(true|false)]
Example: mnbudget prepare cool-project http://www.cool-project/one.json 12 100000 y6R9oN12KnB9zydzTLc3LikD9cCjjQzYG7 1200 true Example: ```mnbudget prepare cool-project http://www.cool-project/one.json 12 100000 y6R9oN12KnB9zydzTLc3LikD9cCjjQzYG7 1200 true```
Output : 464a0eb70ea91c94295214df48c47baa72b3876cfb658744aaf863c7b5bf1ff0 - This is the collateral hash, copy this output for the next step
In this transaction we prepare collateral for "cool-project". This proposal will pay 1200 DASh, 12 times over the course of a year totalling 24000 DASH. Output: ```464a0eb70ea91c94295214df48c47baa72b3876cfb658744aaf863c7b5bf1ff0``` - This is the collateral hash, copy this output for the next step
*Warning -- if you change any fields within this command, the collateral transaction will become invalid. In this transaction we prepare collateral for "_cool-project_". This proposal will pay _1200_ DASH, _12_ times over the course of a year totaling _24000_ DASH.
2. Submit proposal to network **Warning -- if you change any fields within this command, the collateral transaction will become invalid.**
mnbudget submit cool-project http://www.cool-project/one.json 12 100000 y6R9oN12KnB9zydzTLc3LikD9cCjjQzYG7 1200 464a0eb70ea91c94295214df48c47baa72b3876cfb658744aaf863c7b5bf1ff0 2 Submit proposal to network
--
Output : a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491 - This is your proposal hash, which other nodes will use to vote on it ```mnbudget submit cool-project http://www.cool-project/one.json 12 100000 y6R9oN12KnB9zydzTLc3LikD9cCjjQzYG7 1200 464a0eb70ea91c94295214df48c47baa72b3876cfb658744aaf863c7b5bf1ff0```
Output : ```a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491``` - This is your proposal hash, which other nodes will use to vote on it
3. Lobby for votes 3. Lobby for votes
--
Double check your information: mnbudget getinfo cool-project Double check your information: ```mnbudget getinfo cool-project```
```
{ {
"Name" : "cool-project", "Name" : "cool-project",
"Hash" : "a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491", "Hash" : "a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491",
@ -53,16 +58,19 @@ Double check your information: mnbudget getinfo cool-project
"IsValid" : true, "IsValid" : true,
"fValid" : true "fValid" : true
} }
```
If everything looks correct, you can ask for votes from other masternodes. To vote on a proposal, load a wallet with masternode.conf. You do not need to access your cold wallet to vote for proposals. If everything looks correct, you can ask for votes from other masternodes. To vote on a proposal, load a wallet with _masternode.conf_ file. You do not need to access your cold wallet to vote for proposals.
* mnbudget vote a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491 yes ```mnbudget vote a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491 yes```
4. Make it inte the budget 4. Make it into the budget
--
After you get enough votes, execute "mnbudget projection" to see if you made it into the budget. If you the budget was finalized at this moment which proposals would be in it. Note: Proposals must be active at least 1 day on the network and receive 10% of the masternode network in yes votes in order to qualify (E.g. if there is 2500 masternodes, you will need 250 yes votes.) After you get enough votes, execute ```mnbudget projection``` to see if you made it into the budget. If you the budget was finalized at this moment which proposals would be in it. Note: Proposals must be active at least 1 day on the network and receive 10% of the masternode network in yes votes in order to qualify (E.g. if there is 2500 masternodes, you will need 250 yes votes.)
mnbudget projection: ```mnbudget projection```:
```
{ {
"cool-project" : { "cool-project" : {
"Hash" : "a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491", "Hash" : "a2b29778ae82e45a973a94309ffa6aa2e2388b8f95b39ab3739f0078835f0491",
@ -83,9 +91,12 @@ mnbudget projection:
"fValid" : true "fValid" : true
} }
} }
```
5. Finalized budget 5. Finalized budget
--
```
"main" : { "main" : {
"FeeTX" : "d6b8de9a4cadfe148f91e8fe8eed407199f96639b482f956ae6f539b8339f87c", "FeeTX" : "d6b8de9a4cadfe148f91e8fe8eed407199f96639b482f956ae6f539b8339f87c",
"Hash" : "6e8bbaba5113de592f6888f200f146448440b7e606fcf62ef84e60e1d5ac7d64", "Hash" : "6e8bbaba5113de592f6888f200f146448440b7e606fcf62ef84e60e1d5ac7d64",
@ -95,26 +106,28 @@ mnbudget projection:
"VoteCount" : 46, "VoteCount" : 46,
"Status" : "OK" "Status" : "OK"
}, },
```
6. Get paid 6. Get paid
--
When block 1000000 is reached you'll receive a payment for 1200 DASH. When block ```1000000``` is reached you'll receive a payment for ```1200``` DASH.
The following new RPC commands are supported: The following new RPC commands are supported:
* mnbudget "command"... ( "passphrase" ) - mnbudget "command"... ( "passphrase" )
* prepare - Prepare proposal for network by signing and creating tx - prepare - Prepare proposal for network by signing and creating tx
* submit - Submit proposal for network - submit - Submit proposal for network
* vote-many - Vote on a Dash initiative - vote-many - Vote on a Dash initiative
* vote-alias - Vote on a Dash initiative - vote-alias - Vote on a Dash initiative
* vote - Vote on a Dash initiative/budget - vote - Vote on a Dash initiative/budget
* getvotes - Show current masternode budgets - getvotes - Show current masternode budgets
* getinfo - Show current masternode budgets - getinfo - Show current masternode budgets
* show - Show all budgets - show - Show all budgets
* projection - Show the projection of which proposals will be paid the next cycle - projection - Show the projection of which proposals will be paid the next cycle
* check - Scan proposals and remove invalid - check - Scan proposals and remove invalid
* mnfinalbudget "command"... ( "passphrase" ) - mnfinalbudget "command"... ( "passphrase" )
* vote-many - Vote on a finalized budget - vote-many - Vote on a finalized budget
* vote - Vote on a finalized budget - vote - Vote on a finalized budget
* show - Show existing finalized budgets - show - Show existing finalized budgets

View File

@ -2235,7 +2235,7 @@ void ThreadCheckDarkSendPool()
CleanTransactionLocksList(); CleanTransactionLocksList();
} }
if(c % MASTERNODES_DUMP_SECONDS == 0) DumpMasternodes(); //if(c % MASTERNODES_DUMP_SECONDS == 0) DumpMasternodes();
darkSendPool.CheckTimeout(); darkSendPool.CheckTimeout();
darkSendPool.CheckForCompleteQueue(); darkSendPool.CheckForCompleteQueue();

View File

@ -169,7 +169,7 @@ void PrepareShutdown()
GenerateBitcoins(false, NULL, 0); GenerateBitcoins(false, NULL, 0);
#endif #endif
StopNode(); StopNode();
DumpMasternodes(); //DumpMasternodes();
//DumpBudgets(); //DumpBudgets();
//DumpMasternodePayments(); //DumpMasternodePayments();
UnregisterNodeSignals(GetNodeSignals()); UnregisterNodeSignals(GetNodeSignals());
@ -1411,6 +1411,11 @@ bool AppInit2(boost::thread_group& threadGroup)
/*
We sync all of this information on boot anyway, as it's kept on the network so there's really no point.
Also, it seems it might be causing some edge cases where clients can get stuck. I think it's better to just
sync from the network instead.
uiInterface.InitMessage(_("Loading masternode cache...")); uiInterface.InitMessage(_("Loading masternode cache..."));
CMasternodeDB mndb; CMasternodeDB mndb;
@ -1426,11 +1431,6 @@ bool AppInit2(boost::thread_group& threadGroup)
LogPrintf("file format is unknown or invalid, please fix it manually\n"); LogPrintf("file format is unknown or invalid, please fix it manually\n");
} }
/*
We sync all of this information on boot anyway, as it's kept on the network so there's really no point.
Also, it seems it might be causing some edge cases where clients can get stuck. I think it's better to just
sync from the network instead.
// --------- // ---------
// uiInterface.InitMessage(_("Loading budget cache...")); // uiInterface.InitMessage(_("Loading budget cache..."));

View File

@ -661,7 +661,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
//reference node - hybrid mode //reference node - hybrid mode
if(!IsReferenceNode(activeMasternode.vin)){ if(!IsReferenceNode(activeMasternode.vin)){
int n = mnodeman.GetMasternodeRank(activeMasternode.vin, nBlockHeight-100, GetMinMasternodePaymentsProto()); int n = mnodeman.GetMasternodeRank(activeMasternode.vin, nBlockHeight-100, MIN_MNW_PEER_PROTO_VERSION);
if(n == -1) if(n == -1)
{ {

View File

@ -103,6 +103,7 @@ NodeId nLastNodeId = 0;
CCriticalSection cs_nLastNodeId; CCriticalSection cs_nLastNodeId;
static CSemaphore *semOutbound = NULL; static CSemaphore *semOutbound = NULL;
boost::condition_variable messageHandlerCondition;
// Signals for message handling // Signals for message handling
static CNodeSignals g_signals; static CNodeSignals g_signals;
@ -601,8 +602,10 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)
pch += handled; pch += handled;
nBytes -= handled; nBytes -= handled;
if (msg.complete()) if (msg.complete()) {
msg.nTime = GetTimeMicros(); msg.nTime = GetTimeMicros();
messageHandlerCondition.notify_one();
}
} }
return true; return true;
@ -1433,6 +1436,9 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu
void ThreadMessageHandler() void ThreadMessageHandler()
{ {
boost::mutex condition_mutex;
boost::unique_lock<boost::mutex> lock(condition_mutex);
SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
while (true) while (true)
{ {
@ -1493,10 +1499,7 @@ void ThreadMessageHandler()
} }
if (fSleep) if (fSleep)
MilliSleep(1); messageHandlerCondition.timed_wait(lock, boost::posix_time::microsec_clock::universal_time() + boost::posix_time::milliseconds(100));
boost::this_thread::interruption_point();
} }
} }

View File

@ -784,6 +784,7 @@ void BitcoinGUI::setNumBlocks(int count)
masternodeSync.RequestedMasternodeAttempt + 1 : MASTERNODE_SYNC_THRESHOLD; masternodeSync.RequestedMasternodeAttempt + 1 : MASTERNODE_SYNC_THRESHOLD;
progress = nAttempt + (masternodeSync.RequestedMasternodeAssets - 1) * MASTERNODE_SYNC_THRESHOLD; progress = nAttempt + (masternodeSync.RequestedMasternodeAssets - 1) * MASTERNODE_SYNC_THRESHOLD;
progressBar->setMaximum(4 * MASTERNODE_SYNC_THRESHOLD); progressBar->setMaximum(4 * MASTERNODE_SYNC_THRESHOLD);
progressBar->setFormat(tr("Synchronizing additional data: %p%"));
progressBar->setValue(progress); progressBar->setValue(progress);
} }