From 7a993143efc6180783608cc424c6e7bee7fd6eff Mon Sep 17 00:00:00 2001 From: miketout Date: Fri, 2 Nov 2018 12:49:36 -0700 Subject: [PATCH] Set expiry on stake transactions to allow deletion from wallets later to avoid possible double stake --- src/main.cpp | 3 ++- src/wallet/wallet.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 22ee250cb..35a5e0197 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3760,7 +3760,8 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) { for (int i = 0; i < block.vtx.size(); i++) { CTransaction &tx = block.vtx[i]; - if ((i == (block.vtx.size() - 1)) && ((ASSETCHAINS_LWMAPOS && block.IsVerusPOSBlock()) || (ASSETCHAINS_STAKED != 0 && (komodo_isPoS((CBlock *)&block) != 0)))) + //if ((i == (block.vtx.size() - 1)) && ((ASSETCHAINS_LWMAPOS && block.IsVerusPOSBlock()) || (ASSETCHAINS_STAKED != 0 && (komodo_isPoS((CBlock *)&block) != 0)))) + if ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED != 0 && (komodo_isPoS((CBlock *)&block) != 0))) { EraseFromWallets(tx.GetHash()); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3d89507b6..473c0c8b4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1424,6 +1424,9 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe // if we are staking with the extended format, add the opreturn data required if (extendedStake) { + // set expiry to time out after 100 blocks, so we can remove the transaction if it orphans + txNew.nExpiryHeight = stakeHeight + 100; + uint256 srcBlock = uint256(); CBlockIndex *pSrcIndex;