diff --git a/src/miner.cpp b/src/miner.cpp index 14bd0e172..4c8e749dd 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -784,7 +784,7 @@ void static BitcoinMiner_noeq() do { curTip = chainActive.Tip(); printf("Verifying block height %d \n", chainActive.Tip()->nHeight); - MilliSleep(100 + rand() % 1900); + MilliSleep(1000 + rand() % 1900); } while (curTip != chainActive.Tip()); SetThreadPriority(THREAD_PRIORITY_LOWEST); diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 1aade8477..4b17a9f73 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -75,8 +75,25 @@ static bool SignStep(const BaseSignatureCreator& creator, const CScript& scriptP ret.clear(); vector vSolutions; + if (!Solver(scriptPubKey, whichTypeRet, vSolutions)) - return false; + { + // if this is a CLTV script, solve for the destination after CLTV + if (scriptPubKey.IsCheckLockTimeVerify()) + { + uint8_t pushOp = scriptPubKey.data()[0]; + uint32_t scriptStart = pushOp + 3; + + // check post CLTV script + CScript postfix = CScript(scriptPubKey.size() > scriptStart ? scriptPubKey.begin() + scriptStart : scriptPubKey.end(), scriptPubKey.end()); + + // check again with only postfix subscript + if (!Solver(postfix, whichTypeRet, vSolutions)) + return false; + } + else + return false; + } CKeyID keyID; switch (whichTypeRet) diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index 1bc82fdbe..d237bd57c 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp @@ -211,6 +211,7 @@ bool AsyncRPCOperation_shieldcoinbase::main_impl() { CMutableTransaction rawTx(tx_); for (ShieldCoinbaseUTXO & t : inputs_) { CTxIn in(COutPoint(t.txid, t.vout)); + in.nSequence = 0; rawTx.vin.push_back(in); } tx_ = CTransaction(rawTx); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 4cc79cfdb..965eebdcf 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3971,6 +3971,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp) if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) { continue; } + // If taddr is not wildcard "*", filter utxos if (setAddress.size()>0 && !setAddress.count(address)) { continue; @@ -4035,6 +4036,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp) int nextBlockHeight = chainActive.Height() + 1; CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction( Params().GetConsensus(), nextBlockHeight); + contextualTx.nLockTime = nextBlockHeight; if (contextualTx.nVersion == 1) { contextualTx.nVersion = 2; // Tx format should support vjoinsplits } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e0d7bc8ac..e9b353f3e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3916,9 +3916,10 @@ int CMerkleTx::GetBlocksToMaturity() const if (!IsCoinBase()) return 0; int32_t depth = GetDepthInMainChain(); - int32_t ui; - int32_t toMaturity = (ui = UnlockTime(0) - chainActive.Height()) < 0 ? 0 : ui; - return((ui = COINBASE_MATURITY - depth) < toMaturity ? toMaturity : ui); + int32_t ut = UnlockTime(0); + int32_t toMaturity = ut - chainActive.Height() < 0 ? 0 : ut - chainActive.Height(); + ut = COINBASE_MATURITY - depth < 0 ? 0 : COINBASE_MATURITY - depth; + return(ut < toMaturity ? toMaturity : ut); } bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectAbsurdFee)