Skip to content

Commit

Permalink
Fixup minor regression bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 committed Apr 7, 2021
1 parent c9ad416 commit f0150a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions qa/rpc-tests/sc_cert_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand All @@ -271,7 +271,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand All @@ -291,7 +291,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand All @@ -311,7 +311,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand All @@ -331,7 +331,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand All @@ -352,7 +352,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand All @@ -374,7 +374,7 @@ def run_test(self):
errorString = e.error['message']
mark_logs(errorString, self.nodes, DEBUG_MODE)

assert_equal("bad-sc-cert-not-applicable" in errorString, True)
assert_equal("bad-sc-cert-proof" in errorString, True)
assert_equal(self.nodes[0].getscinfo(scid)['items'][0]['balance'], creation_amount + fwt_amount) # Sc has not been affected by faulty certificate
assert_equal(len(self.nodes[0].getscinfo(scid)['items'][0]['immature amounts']), 0)

Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,15 +1352,15 @@ MempoolReturnValue AcceptTxToMemoryPool(CTxMemPool& pool, CValidationState &stat
if (!view.IsScTxApplicableToStateWithoutProof(tx))
{
state.Invalid(error("%s():%d - ERROR: sc-related tx [%s] is not applicable\n",
__func__, __LINE__, hash.ToString()), REJECT_INVALID, "bad-sc-tx");
__func__, __LINE__, hash.ToString()), REJECT_INVALID, "bad-sc-tx-not-applicable");
return MempoolReturnValue::INVALID;
}

CScProofVerifier scVerifier{CScProofVerifier::Verification::Strict};
if (!view.CheckScTxProof(tx, scVerifier))
{
state.Invalid(error("%s():%d - ERROR: sc-related tx [%s] proofs do not verify\n",
__func__, __LINE__, hash.ToString()), REJECT_INVALID, "bad-sc-tx");
__func__, __LINE__, hash.ToString()), REJECT_INVALID, "bad-sc-tx-proof");
return MempoolReturnValue::INVALID;
}

Expand Down Expand Up @@ -2758,7 +2758,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if (!view.IsScTxApplicableToStateWithoutProof(tx))
{
return state.DoS(100, error("%s():%d - ERROR: tx=%s\n", __func__, __LINE__, tx.GetHash().ToString()),
REJECT_INVALID, "bad-sc-tx");
REJECT_INVALID, "bad-sc-tx-not-applicable");
}

CScProofVerifier scVerifier {fExpensiveChecks ?
Expand All @@ -2767,7 +2767,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if (!view.CheckScTxProof(tx, scVerifier))
{
return state.DoS(100, error("%s():%d - ERROR: tx=%s\n", __func__, __LINE__, tx.GetHash().ToString()),
REJECT_INVALID, "bad-sc-tx");
REJECT_INVALID, "bad-sc-tx-proof");
}

// are the JoinSplit's requirements met?
Expand Down Expand Up @@ -2875,7 +2875,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if (!view.CheckCertificateProof(cert, scVerifier) )
{
return state.DoS(100, error("%s():%d: invalid sc certificate [%s]", cert.GetHash().ToString(),__func__, __LINE__),
REJECT_INVALID, "bad-sc-cert-not-applicable");
REJECT_INVALID, "bad-sc-cert-proof");
}

blockundo.vtxundo.push_back(CTxUndo());
Expand Down
2 changes: 1 addition & 1 deletion src/sc/sidechain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool Sidechain::InitSidechainsFolder()
boost::filesystem::create_directories(Sidechain::GetSidechainDataDir());
//Todo: validate (possible here) availability (rw) of files with precalculated keys or create them
}
return false;
return true;
}

void Sidechain::ClearSidechainsFolder()
Expand Down

0 comments on commit f0150a7

Please sign in to comment.