Skip to content

Commit 275f443

Browse files
authored
Merge pull request #31 from ghost-coin/fix/avgr-blocks
Fix block rejection
2 parents fb8daa5 + fc83db8 commit 275f443

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AC_PREREQ([2.69])
22
define(_CLIENT_VERSION_MAJOR, 0)
33
define(_CLIENT_VERSION_MINOR, 22)
4-
define(_CLIENT_VERSION_REVISION, 1)
4+
define(_CLIENT_VERSION_REVISION, 2)
55
define(_CLIENT_VERSION_GHOST, 0)
66
define(_CLIENT_VERSION_BUILD, 0)
77
define(_CLIENT_VERSION_RC, 0)

src/validation.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,10 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
21352135
std::size_t outputsSize = 0;
21362136
for(const auto& tx: block.vtx) {
21372137
for (const auto& txout: tx->vpout) {
2138-
if (txout->IsStandardOutput()) {
2138+
CScript outScript;
2139+
txout->GetScriptPubKey(outScript);
2140+
2141+
if (outScript[0] != OP_RETURN && txout->IsStandardOutput()) {
21392142
outputsSize++;
21402143
}
21412144
}
@@ -3415,6 +3418,7 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
34153418
rewardTracker.addAddressTransaction(pindex->nHeight, addr, txout->GetValue(), ::Params().GetGvrCheckpoints());
34163419
rewardUndo.outputs[pindex->nHeight].emplace_back(make_pair(addr, txout->GetValue()));
34173420
} else {
3421+
if (outScript[0] == OP_RETURN) continue;
34183422
LogPrintf("%s Can't extract destination address for tracking outputs \n", __func__);
34193423
return error("ConnectBlock(): Can't extract destination address for outputs\n");
34203424
}

test/functional/feature_gvr3.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
assert_equal
1212
)
1313

14+
from test_framework.script import (
15+
CScript,
16+
OP_RETURN,
17+
)
18+
1419
class GhostVeteranReward3Test(GhostTestFramework):
1520
def set_test_params(self):
1621
self.setup_clean_chain = True
@@ -101,6 +106,11 @@ def run_test(self):
101106
nodes[0].sendghosttoanon(node1_receiving_addr, 1000, '', '', False, 'node0 -> node1 p->a')
102107
self.stakeBlocks(1)
103108

109+
# Spending to DATA_OUTPUT
110+
burn_script = CScript([OP_RETURN, ])
111+
nodes[0].sendtypeto('ghost', 'ghost', [{'address': 'script', 'amount': 10, 'script': burn_script.hex()},])
112+
self.stakeBlocks(1)
113+
104114
res = nodes[0].verifychain(3)
105115
assert_equal(res, True)
106116

0 commit comments

Comments
 (0)