Enable seamless spending of timelocked coinbases through z_shieldcoinbase
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user