Bitcoin Core  22.99.0
P2P Digital Currency
transaction.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <wallet/transaction.h>
6 
7 namespace wallet {
8 bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const
9 {
10  CMutableTransaction tx1 {*this->tx};
11  CMutableTransaction tx2 {*_tx.tx};
12  for (auto& txin : tx1.vin) txin.scriptSig = CScript();
13  for (auto& txin : tx2.vin) txin.scriptSig = CScript();
14  return CTransaction(tx1) == CTransaction(tx2);
15 }
16 
18 {
19  return state<TxStateInMempool>();
20 }
21 
22 int64_t CWalletTx::GetTxTime() const
23 {
24  int64_t n = nTimeSmart;
25  return n ? n : nTimeReceived;
26 }
27 } // namespace wallet
wallet::CWalletTx::IsEquivalentTo
bool IsEquivalentTo(const CWalletTx &tx) const
True if only scriptSigs are different.
Definition: transaction.cpp:8
wallet::CWalletTx::InMempool
bool InMempool() const
Definition: transaction.cpp:17
wallet::CWalletTx::GetTxTime
int64_t GetTxTime() const
Definition: transaction.cpp:22
wallet
Definition: node.h:38
wallet::CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:137
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:259
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
transaction.h
wallet::CWalletTx::nTimeSmart
unsigned int nTimeSmart
Stable timestamp that never changes, and reflects the order a transaction was added to the wallet.
Definition: transaction.h:178
wallet::CWalletTx::nTimeReceived
unsigned int nTimeReceived
time received by this node
Definition: transaction.h:168
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:344
wallet::CWalletTx::tx
CTransactionRef tx
Definition: transaction.h:219