Skip to content

Commit 88a9060

Browse files
author
alex v
authored
Fix fixed stake reward check (#369)
* Fix fixed stake reward check The stake reward, even if fixed, includes the fees of the transactions included in the block. The removed check does not take the fees making the network reject all the blocks which include a transaction. At this point, the total amount of fees is still unknown. This is safely removed as the check is properly done in line 3322. * test tx sends after soft fork * file permission fix * adding blockcount param * corrected object calling rpc command * remove print
1 parent c59cd80 commit 88a9060

3 files changed

Lines changed: 45 additions & 5 deletions

File tree

qa/pull-tester/rpc-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
'coldstaking_staking.py',
165165
'coldstaking_spending.py',
166166
'staticr-staking-amount.py',
167+
'staticr-tx-send.py',
167168
]
168169
#if ENABLE_ZMQ:
169170
# testScripts.append('zmq_test.py')

qa/rpc-tests/staticr-tx-send.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2018 The Navcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
6+
from test_framework.test_framework import NavCoinTestFramework
7+
from test_framework.staticr_util import *
8+
9+
import time
10+
11+
class StaticRTxSend(NavCoinTestFramework):
12+
"""Tests the tx sending after softfork activation."""
13+
14+
def __init__(self):
15+
super().__init__()
16+
self.setup_clean_chain = True
17+
self.num_nodes = 1
18+
19+
def setup_network(self, split=False):
20+
self.nodes = self.setup_nodes()
21+
self.is_network_split = split
22+
23+
def run_test(self):
24+
25+
#check that a transaction can be sent after the reward changes to static
26+
27+
activate_staticr(self.nodes[0])
28+
29+
blockcount = self.nodes[0].getblockcount()
30+
address = self.nodes[0].getnewaddress()
31+
txid = self.nodes[0].sendtoaddress(address, 100)
32+
33+
# wait for a new block to be mined
34+
while self.nodes[0].getblockcount() == blockcount:
35+
print("waiting for a new block...")
36+
time.sleep(5)
37+
38+
transaction = self.nodes[0].gettransaction(txid)
39+
40+
# check the transaction confirmed
41+
assert(transaction["confirmations"] > 0)
42+
43+
if __name__ == '__main__':
44+
StaticRTxSend().main()

src/main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,11 +3054,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
30543054

30553055
}
30563056

3057-
if(IsStaticRewardEnabled(pindex->pprev, Params().GetConsensus()) && nStakeReward != Params().GetConsensus().nStaticReward)
3058-
return state.DoS(100, error("ConnectBlock(): block has incorrect block reward (actual=%d vs consensus=%d)",
3059-
nStakeReward, Params().GetConsensus().nStaticReward),
3060-
REJECT_INVALID, "bad-static-stake-amount");
3061-
30623057
}
30633058

30643059
std::vector<CScriptCheck> vChecks;

0 commit comments

Comments
 (0)