Move CMerkleTx to wallet.cpp/h
It is only used by the wallet so it has no place in main.
This commit is contained in:
57
src/wallet.h
57
src/wallet.h
@@ -457,6 +457,63 @@ struct COutputEntry
|
||||
int vout;
|
||||
};
|
||||
|
||||
/** A transaction with a merkle branch linking it to the block chain. */
|
||||
class CMerkleTx : public CTransaction
|
||||
{
|
||||
private:
|
||||
int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const;
|
||||
|
||||
public:
|
||||
uint256 hashBlock;
|
||||
std::vector<uint256> vMerkleBranch;
|
||||
int nIndex;
|
||||
|
||||
// memory only
|
||||
mutable bool fMerkleVerified;
|
||||
|
||||
|
||||
CMerkleTx()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
CMerkleTx(const CTransaction& txIn) : CTransaction(txIn)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
hashBlock = 0;
|
||||
nIndex = -1;
|
||||
fMerkleVerified = false;
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
nSerSize += SerReadWrite(s, *(CTransaction*)this, nType, nVersion, ser_action);
|
||||
nVersion = this->nVersion;
|
||||
READWRITE(hashBlock);
|
||||
READWRITE(vMerkleBranch);
|
||||
READWRITE(nIndex);
|
||||
)
|
||||
|
||||
|
||||
int SetMerkleBranch(const CBlock* pblock=NULL);
|
||||
|
||||
// Return depth of transaction in blockchain:
|
||||
// -1 : not in blockchain, and not in memory pool (conflicted transaction)
|
||||
// 0 : in memory pool, waiting to be included in a block
|
||||
// >=1 : this many blocks deep in the main chain
|
||||
int GetDepthInMainChain(CBlockIndex* &pindexRet) const;
|
||||
int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
|
||||
bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
|
||||
int GetBlocksToMaturity() const;
|
||||
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true);
|
||||
};
|
||||
|
||||
|
||||
/** A transaction with a bunch of additional info that only the owner cares about.
|
||||
* It includes any unrecorded transactions needed to link it back to the block chain.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user