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
Tom
crown-core
Commits
baadea2e
Commit
baadea2e
authored
7 years ago
by
Volodymyr Shamray
Browse files
Options
Download
Email Patches
Plain Diff
Revert "Budget fail safe payment to devfund address"
This reverts commit
d187a5cf
. Issue #97
parent
c9a93ae5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/masternode-budget.cpp
+9
-69
src/masternode-budget.cpp
src/masternode-budget.h
+0
-1
src/masternode-budget.h
with
9 additions
and
70 deletions
+9
-70
src/masternode-budget.cpp
View file @
baadea2e
...
...
@@ -486,13 +486,13 @@ void CBudgetManager::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
CAmount
blockValue
=
GetBlockValue
(
pindexPrev
->
nBits
,
pindexPrev
->
nHeight
,
nFees
);
//
M
iners get the full amount on these blocks
//
m
iners get the full amount on these blocks
txNew
.
vout
[
0
].
nValue
=
blockValue
;
if
(
nHighestCount
>
0
){
txNew
.
vout
.
resize
(
2
);
//
T
hese are super blocks, so their value can be much larger than normal
//
t
hese are super blocks, so their value can be much larger than normal
txNew
.
vout
[
1
].
scriptPubKey
=
payee
;
txNew
.
vout
[
1
].
nValue
=
nAmount
;
...
...
@@ -501,22 +501,7 @@ void CBudgetManager::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
CBitcoinAddress
address2
(
address1
);
LogPrintf
(
"CBudgetManager::FillBlockPayee - Budget payment to %s for %lld
\n
"
,
address2
.
ToString
(),
nAmount
);
}
else
{
// Pay dev fund
txNew
.
vout
.
resize
(
2
);
// These are super blocks, so their value can be much larger than normal
CTxDestination
dest
=
CBitcoinAddress
(
Params
().
DevfundAddress
()).
Get
();
txNew
.
vout
[
1
].
scriptPubKey
=
GetScriptForDestination
(
dest
);
CAmount
coins
=
43200
*
COIN
;
if
(
Params
().
NetworkID
()
==
CBaseChainParams
::
TESTNET
)
{
coins
=
50
*
COIN
;
}
txNew
.
vout
[
1
].
nValue
=
coins
;
LogPrintf
(
"CBudgetManager::FillBlockPayee - Budget payment to Dev fund for %lld
\n
"
,
nAmount
);
}
}
}
CFinalizedBudget
*
CBudgetManager
::
FindFinalizedBudget
(
uint256
nHash
)
...
...
@@ -576,10 +561,9 @@ bool CBudgetManager::IsBudgetPaymentBlock(int nBlockHeight)
}
/*
If budget doesn't have 5% of the network votes, then we should pay
the dev fund
instead
If budget doesn't have 5% of the network votes, then we should pay
a masternode
instead
*/
if
(
nHighestCount
>
mnodeman
.
CountEnabled
(
MIN_BUDGET_PEER_PROTO_VERSION
)
/
20
)
return
true
;
if
(
nBlockHeight
%
GetBudgetPaymentCycleBlocks
()
==
0
)
return
true
;
return
false
;
}
...
...
@@ -629,15 +613,12 @@ bool CBudgetManager::IsTransactionValid(const CTransaction& txNew, int nBlockHei
}
/*
If budget doesn't have 5% of the network votes, then we should
the dev fund
instead
If budget doesn't have 5% of the network votes, then we should
pay a masternode
instead
*/
if
(
nHighestCount
<
mnodeman
.
CountEnabled
(
MIN_BUDGET_PEER_PROTO_VERSION
)
/
20
)
{
return
false
;
}
else
if
(
IsDevTransactionValid
(
txNew
,
nBlockHeight
))
{
return
true
;
}
if
(
nHighestCount
<
mnodeman
.
CountEnabled
(
MIN_BUDGET_PEER_PROTO_VERSION
)
/
20
)
return
false
;
// check the highest finalized budgets (+/- 10% to assist in consensus)
// Check the highest finalized budgets (+/- 10% to assist in consensus)
it
=
mapFinalizedBudgets
.
begin
();
while
(
it
!=
mapFinalizedBudgets
.
end
())
{
...
...
@@ -654,51 +635,10 @@ bool CBudgetManager::IsTransactionValid(const CTransaction& txNew, int nBlockHei
++
it
;
}
// If budget has more than 5% of the votes but less than 10% pay the dev fund.
// If anything goes wrong above it will default to use IsDevTransactionValid.
if
(
nHighestCount
<
mnodeman
.
CountEnabled
(
MIN_BUDGET_PEER_PROTO_VERSION
)
/
10
)
{
// Check dev fund payment
if
(
IsDevTransactionValid
(
txNew
,
nBlockHeight
))
{
return
true
;
}
}
// We looked through all of the known budgets
//we looked through all of the known budgets
return
false
;
}
bool
CBudgetManager
::
IsDevTransactionValid
(
const
CTransaction
&
txNew
,
int
nBlockHeight
)
{
int
nCurrentBudgetPayment
=
nBlockHeight
%
GetBudgetPaymentCycleBlocks
();
if
(
nCurrentBudgetPayment
>
0
)
{
LogPrintf
(
"CFinalizedBudget::IsTransactionValid - Invalid block - height: %d
\n
"
,
nBlockHeight
);
return
false
;
}
bool
found
=
false
;
CTxDestination
dest
=
CBitcoinAddress
(
Params
().
DevfundAddress
()).
Get
();
CScript
devscript
=
GetScriptForDestination
(
dest
);
BOOST_FOREACH
(
CTxOut
out
,
txNew
.
vout
)
{
CAmount
coins
=
43200
*
COIN
;
if
(
Params
().
NetworkID
()
==
CBaseChainParams
::
TESTNET
)
{
coins
=
50
*
COIN
;
}
if
(
devscript
==
out
.
scriptPubKey
&&
coins
==
out
.
nValue
)
found
=
true
;
}
if
(
!
found
)
{
CTxDestination
address1
;
ExtractDestination
(
devscript
,
address1
);
CBitcoinAddress
address2
(
address1
);
LogPrintf
(
"CFinalizedBudget::IsTransactionValid - Missing required payment - %s
\n
"
,
address2
.
ToString
());
}
return
found
;
}
std
::
vector
<
CBudgetProposal
*>
CBudgetManager
::
GetAllProposals
()
{
LOCK
(
cs
);
...
...
This diff is collapsed.
Click to expand it.
src/masternode-budget.h
View file @
baadea2e
...
...
@@ -138,7 +138,6 @@ public:
bool
UpdateFinalizedBudget
(
CFinalizedBudgetVote
&
vote
,
CNode
*
pfrom
,
std
::
string
&
strError
);
bool
PropExists
(
uint256
nHash
);
bool
IsTransactionValid
(
const
CTransaction
&
txNew
,
int
nBlockHeight
);
bool
IsDevTransactionValid
(
const
CTransaction
&
txNew
,
int
nBlockHeight
);
std
::
string
GetRequiredPaymentsString
(
int
nBlockHeight
);
void
FillBlockPayee
(
CMutableTransaction
&
txNew
,
CAmount
nFees
);
...
...
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