Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Josh Wilcox
crown-core
Commits
2b837143
Commit
2b837143
authored
9 years ago
by
Evan Duffield
Browse files
Options
Download
Email Patches
Plain Diff
Fix payment cycle when network is in the process of updating
parent
655a78ac
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
configure.ac
+1
-1
configure.ac
src/clientversion.h
+1
-1
src/clientversion.h
src/masternode-payments.cpp
+2
-2
src/masternode-payments.cpp
src/masternodeman.cpp
+8
-3
src/masternodeman.cpp
src/masternodeman.h
+1
-1
src/masternodeman.h
src/rpcmasternode.cpp
+10
-3
src/rpcmasternode.cpp
with
23 additions
and
11 deletions
+23
-11
configure.ac
View file @
2b837143
...
...
@@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 12)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 4
6
)
define(_CLIENT_VERSION_BUILD, 4
7
)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2015)
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dashpay.io],[dash])
...
...
This diff is collapsed.
Click to expand it.
src/clientversion.h
View file @
2b837143
...
...
@@ -17,7 +17,7 @@
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 12
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 4
6
#define CLIENT_VERSION_BUILD 4
7
//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
...
...
This diff is collapsed.
Click to expand it.
src/masternode-payments.cpp
View file @
2b837143
...
...
@@ -686,8 +686,8 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
LogPrintf
(
"CMasternodePayments::ProcessBlock() Start nHeight %d - vin %s.
\n
"
,
nBlockHeight
,
activeMasternode
.
vin
.
ToString
().
c_str
());
// pay to the oldest MN that still had no payment but its input is old enough and it was active long enough
CMasternode
*
pmn
=
mnodeman
.
GetNextMasternodeInQueueForPayment
(
nBlockHeight
,
true
)
;
if
(
pmn
==
NULL
)
pmn
=
mnodeman
.
GetNextMasternodeInQueueForPayment
(
nBlockHeight
,
false
);
// if no results, look for any node with a newer sigTime
int
nCount
=
0
;
CMasternode
*
pmn
=
mnodeman
.
GetNextMasternodeInQueueForPayment
(
nBlockHeight
,
true
,
nCount
);
if
(
pmn
!=
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/masternodeman.cpp
View file @
2b837143
...
...
@@ -414,9 +414,10 @@ CMasternode *CMasternodeMan::Find(const CPubKey &pubKeyMasternode)
//
// Deterministically select the oldest/best masternode to pay on the network
//
CMasternode
*
CMasternodeMan
::
GetNextMasternodeInQueueForPayment
(
int
nBlockHeight
,
bool
fFilterSigTime
)
CMasternode
*
CMasternodeMan
::
GetNextMasternodeInQueueForPayment
(
int
nBlockHeight
,
bool
fFilterSigTime
,
int
&
nCount
)
{
LOCK
(
cs
);
nCount
=
0
;
CMasternode
*
pBestMasternode
=
NULL
;
std
::
vector
<
pair
<
int64_t
,
CTxIn
>
>
vecMasternodeLastPaid
;
...
...
@@ -444,8 +445,12 @@ CMasternode* CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight
if
(
mn
.
GetMasternodeInputAge
()
<
nMnCount
)
continue
;
vecMasternodeLastPaid
.
push_back
(
make_pair
(
mn
.
SecondsSincePayment
(),
mn
.
vin
));
nCount
++
;
}
//when the network is in the process of upgrading, don't penalize nodes that recently restarted
if
(
fFilterSigTime
&&
nCount
<
nMnCount
/
3
)
return
GetNextMasternodeInQueueForPayment
(
nBlockHeight
,
false
,
nCount
);
// Sort them low to high
sort
(
vecMasternodeLastPaid
.
rbegin
(),
vecMasternodeLastPaid
.
rend
(),
CompareLastPaid
());
...
...
@@ -454,7 +459,7 @@ CMasternode* CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight
// -- 1/100 payments should be a double payment on mainnet - (1/(3000/10))*2
// -- (chance per block * chances before IsScheduled will fire)
int
nTenthNetwork
=
CountEnabled
()
/
10
;
int
nCount
=
0
;
int
nCount
Tenth
=
0
;
uint256
nHigh
=
0
;
BOOST_FOREACH
(
PAIRTYPE
(
int64_t
,
CTxIn
)
&
s
,
vecMasternodeLastPaid
){
CMasternode
*
pmn
=
Find
(
s
.
second
);
...
...
@@ -465,7 +470,7 @@ CMasternode* CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight
nHigh
=
n
;
pBestMasternode
=
pmn
;
}
nCount
++
;
nCount
Tenth
++
;
if
(
nCount
>=
nTenthNetwork
)
break
;
}
return
pBestMasternode
;
...
...
This diff is collapsed.
Click to expand it.
src/masternodeman.h
View file @
2b837143
...
...
@@ -116,7 +116,7 @@ public:
CMasternode
*
Find
(
const
CPubKey
&
pubKeyMasternode
);
/// Find an entry in the masternode list that is next to be paid
CMasternode
*
GetNextMasternodeInQueueForPayment
(
int
nBlockHeight
,
bool
fFilterSigTime
=
true
);
CMasternode
*
GetNextMasternodeInQueueForPayment
(
int
nBlockHeight
,
bool
fFilterSigTime
,
int
&
nCount
);
/// Find a random entry
CMasternode
*
FindRandomNotInVec
(
std
::
vector
<
CTxIn
>
&
vecToExclude
,
int
protocolVersion
=
-
1
);
...
...
This diff is collapsed.
Click to expand it.
src/rpcmasternode.cpp
View file @
2b837143
...
...
@@ -134,7 +134,7 @@ Value masternode(const Array& params, bool fHelp)
"1.
\"
command
\"
(string or set of strings, required) The command to execute
\n
"
"2.
\"
passphrase
\"
(string, optional) The wallet passphrase
\n
"
"
\n
Available commands:
\n
"
" count - Print number of all known masternodes (optional: 'ds', 'enabled', 'all')
\n
"
" count - Print number of all known masternodes (optional: 'ds', 'enabled', 'all'
, 'qualify'
)
\n
"
" current - Print info on current masternode winner
\n
"
" debug - Print masternode status
\n
"
" genkey - Generate new masternodeprivkey
\n
"
...
...
@@ -186,12 +186,19 @@ Value masternode(const Array& params, bool fHelp)
}
if
(
params
.
size
()
==
2
)
{
int
nCount
=
0
;
if
(
chainActive
.
Tip
())
mnodeman
.
GetNextMasternodeInQueueForPayment
(
chainActive
.
Tip
()
->
nHeight
,
true
,
nCount
);
if
(
params
[
1
]
==
"ds"
)
return
mnodeman
.
CountEnabled
(
MIN_POOL_PEER_PROTO_VERSION
);
if
(
params
[
1
]
==
"enabled"
)
return
mnodeman
.
CountEnabled
();
if
(
params
[
1
]
==
"all"
)
return
strprintf
(
"Total: %d (DS Compatible: %d / Enabled: %d)"
,
if
(
params
[
1
]
==
"qualify"
)
return
nCount
;
if
(
params
[
1
]
==
"all"
)
return
strprintf
(
"Total: %d (DS Compatible: %d / Enabled: %d / Qualify: %d)"
,
mnodeman
.
size
(),
mnodeman
.
CountEnabled
(
MIN_POOL_PEER_PROTO_VERSION
),
mnodeman
.
CountEnabled
());
mnodeman
.
CountEnabled
(),
nCount
);
}
return
mnodeman
.
size
();
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help