Merge branch 'master' into catchup

This commit is contained in:
Steven Roose 2019-05-14 15:11:48 +01:00
commit dc900eb7d7
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
10 changed files with 137 additions and 58 deletions

View file

@ -682,10 +682,27 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
}
// do all inputs exist?
for (const CTxIn& txin : tx.vin) {
for (unsigned int i = 0; i < tx.vin.size(); i++) {
const CTxIn& txin = tx.vin[i];
// ELEMENTS:
// Don't look for coins that only exist in parent chain
// For pegin inputs check whether the pegins have already been claimed before.
// This only checks the UTXO set for already claimed pegins. For mempool conflicts,
// we rely on the GetConflictTx check done above.
if (txin.m_is_pegin) {
// Quick sanity check on witness first.
if (tx.witness.vtxinwit.size() <= i ||
tx.witness.vtxinwit[i].m_pegin_witness.stack.size() < 6 ||
uint256(tx.witness.vtxinwit[i].m_pegin_witness.stack[2]).IsNull() ||
tx.vin[i].prevout.hash.IsNull()) {
return state.Invalid(false, REJECT_INVALID, "pegin-no-witness");
}
std::pair<uint256, COutPoint> pegin = std::make_pair(uint256(tx.witness.vtxinwit[i].m_pegin_witness.stack[2]), tx.vin[i].prevout);
// This assumes non-null prevout and genesis block hash
if (view.IsPeginSpent(pegin)) {
return state.Invalid(false, REJECT_INVALID, "pegin-already-claimed");
}
continue;
}
@ -5165,7 +5182,8 @@ bool MainchainRPCCheck(const bool init)
if (!error.isNull()) {
// On the first call, it's possible to node is still in
// warmup; in that case, just wait and retry.
if (error["code"].get_int() == RPC_IN_WARMUP) {
// If this is not the initial call, just report failure.
if (init && error["code"].get_int() == RPC_IN_WARMUP) {
MilliSleep(1000);
continue;
}