Add expiry to z_mergetoaddress
This commit is contained in:
@@ -4065,13 +4065,17 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
|
|||||||
contextInfo.push_back(Pair("fee", ValueFromAmount(nFee)));
|
contextInfo.push_back(Pair("fee", ValueFromAmount(nFee)));
|
||||||
|
|
||||||
// Contextual transaction we will build on
|
// Contextual transaction we will build on
|
||||||
|
int nextBlockHeight = chainActive.Height() + 1;
|
||||||
CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction(
|
CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction(
|
||||||
Params().GetConsensus(),
|
Params().GetConsensus(),
|
||||||
chainActive.Height() + 1);
|
nextBlockHeight);
|
||||||
bool isShielded = numNotes > 0 || isToZaddr;
|
bool isShielded = numNotes > 0 || isToZaddr;
|
||||||
if (contextualTx.nVersion == 1 && isShielded) {
|
if (contextualTx.nVersion == 1 && isShielded) {
|
||||||
contextualTx.nVersion = 2; // Tx format should support vjoinsplit
|
contextualTx.nVersion = 2; // Tx format should support vjoinsplit
|
||||||
}
|
}
|
||||||
|
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
||||||
|
contextualTx.nExpiryHeight = nextBlockHeight + expiryDelta;
|
||||||
|
}
|
||||||
|
|
||||||
// Create operation and add to global queue
|
// Create operation and add to global queue
|
||||||
std::shared_ptr<AsyncRPCQueue> q = getAsyncRPCQueue();
|
std::shared_ptr<AsyncRPCQueue> q = getAsyncRPCQueue();
|
||||||
|
|||||||
@@ -2584,6 +2584,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
||||||
if (nextBlockHeight + expiryDelta >= TX_EXPIRY_HEIGHT_THRESHOLD){
|
if (nextBlockHeight + expiryDelta >= TX_EXPIRY_HEIGHT_THRESHOLD){
|
||||||
strFailReason = _("nExpiryHeight must be less than TX_EXPIRY_HEIGHT_THRESHOLD.");
|
strFailReason = _("nExpiryHeight must be less than TX_EXPIRY_HEIGHT_THRESHOLD.");
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
txNew.nExpiryHeight = nextBlockHeight + expiryDelta;
|
txNew.nExpiryHeight = nextBlockHeight + expiryDelta;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user