Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GlobalSend transactions. #347

Merged
merged 1 commit into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ bool Consensus::CheckTxOutputs(
CValidationState& state,
const referral::ReferralsViewCache& referralsCache,
const std::vector<referral::ReferralRef>& vExtraReferrals,
const ConfirmationSet* block_invites)
const ConfirmationSet* block_invites,
bool check_mempool)
{
// check addresses used for vouts are beaconed
for (const auto& txout: tx.vout) {
Expand Down Expand Up @@ -247,7 +248,7 @@ bool Consensus::CheckTxOutputs(
}

if (!tx.IsInvite() && ExpectDaedalus(chainActive.Tip(), ::Params().GetConsensus())) {
if (!CheckAddressConfirmed(CMeritAddress{dest}, false)) {
if (!CheckAddressConfirmed(CMeritAddress{dest}, check_mempool)) {
if (block_invites != nullptr) {
if (block_invites->count(addr) == 0) {
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-not-confirmed");
Expand Down
3 changes: 2 additions & 1 deletion src/consensus/tx_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ bool CheckTxOutputs(
CValidationState& state,
const referral::ReferralsViewCache& referralsCache,
const std::vector<referral::ReferralRef>& vExtraReferrals,
const ConfirmationSet* block_invites = nullptr);
const ConfirmationSet* block_invites = nullptr,
bool check_mempool = false);
} // namespace Consensus

/** Auxiliary functions for transaction validation (ideally should not be exposed) */
Expand Down
7 changes: 6 additions & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,12 @@ bool BlockAssembler::CheckReferrals(
const auto tx = it->GetEntryValue();

CValidationState dummy;
if (!Consensus::CheckTxOutputs(tx, dummy, *prefviewcache, candidate_referrals)) {
if (!Consensus::CheckTxOutputs(
tx,
dummy,
*prefviewcache,
candidate_referrals,
&confirmations)) {
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins, const referral::ReferralsV
CValidationState state;
bool fCheckResult = tx.IsCoinBase() ||
(Consensus::CheckTxInputs(tx, state, mempoolDuplicate, nSpendHeight) &&
Consensus::CheckTxOutputs(tx, state, referralsCache, refs));
Consensus::CheckTxOutputs(tx, state, referralsCache, refs, nullptr, true));
assert(fCheckResult);
UpdateCoins(tx, mempoolDuplicate, 1000000);
}
Expand All @@ -952,7 +952,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins, const referral::ReferralsV
} else {
bool fCheckResult = entry->GetEntryValue().IsCoinBase() ||
(Consensus::CheckTxInputs(entry->GetEntryValue(), state, mempoolDuplicate, nSpendHeight) &&
Consensus::CheckTxOutputs(entry->GetEntryValue(), state, referralsCache, refs));
Consensus::CheckTxOutputs(entry->GetEntryValue(), state, referralsCache, refs, nullptr, true));
assert(fCheckResult);
UpdateCoins(entry->GetEntryValue(), mempoolDuplicate, 1000000);
stepsSinceLastRemove = 0;
Expand Down
4 changes: 3 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,9 @@ static bool AcceptToMemoryPoolWorker(
tx,
state,
*prefviewcache,
mempoolReferral.GetReferrals())) {
mempoolReferral.GetReferrals(),
nullptr,
true)) {

return false;
}
Expand Down