LCOV - code coverage report
Current view: top level - src/wallet - spend.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 9 9 100.0 %
Date: 2021-06-29 14:35:33 Functions: 2 2 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 3 4 75.0 %

           Branch data     Line data    Source code
#       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                 :            : #ifndef BITCOIN_WALLET_SPEND_H
#       6                 :            : #define BITCOIN_WALLET_SPEND_H
#       7                 :            : 
#       8                 :            : #include <wallet/coinselection.h>
#       9                 :            : #include <wallet/transaction.h>
#      10                 :            : #include <wallet/wallet.h>
#      11                 :            : 
#      12                 :            : class COutput
#      13                 :            : {
#      14                 :            : public:
#      15                 :            :     const CWalletTx *tx;
#      16                 :            : 
#      17                 :            :     /** Index in tx->vout. */
#      18                 :            :     int i;
#      19                 :            : 
#      20                 :            :     /**
#      21                 :            :      * Depth in block chain.
#      22                 :            :      * If > 0: the tx is on chain and has this many confirmations.
#      23                 :            :      * If = 0: the tx is waiting confirmation.
#      24                 :            :      * If < 0: a conflicting tx is on chain and has this many confirmations. */
#      25                 :            :     int nDepth;
#      26                 :            : 
#      27                 :            :     /** Pre-computed estimated size of this output as a fully-signed input in a transaction. Can be -1 if it could not be calculated */
#      28                 :            :     int nInputBytes;
#      29                 :            : 
#      30                 :            :     /** Whether we have the private keys to spend this output */
#      31                 :            :     bool fSpendable;
#      32                 :            : 
#      33                 :            :     /** Whether we know how to spend this output, ignoring the lack of keys */
#      34                 :            :     bool fSolvable;
#      35                 :            : 
#      36                 :            :     /** Whether to use the maximum sized, 72 byte signature when calculating the size of the input spend. This should only be set when watch-only outputs are allowed */
#      37                 :            :     bool use_max_sig;
#      38                 :            : 
#      39                 :            :     /**
#      40                 :            :      * Whether this output is considered safe to spend. Unconfirmed transactions
#      41                 :            :      * from outside keys and unconfirmed replacement transactions are considered
#      42                 :            :      * unsafe and will not be used to fund new spending transactions.
#      43                 :            :      */
#      44                 :            :     bool fSafe;
#      45                 :            : 
#      46                 :            :     COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn, bool use_max_sig_in = false)
#      47                 :     511913 :     {
#      48                 :     511913 :         tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn; nInputBytes = -1; use_max_sig = use_max_sig_in;
#      49                 :            :         // If known and signable by the given wallet, compute nInputBytes
#      50                 :            :         // Failure will keep this value -1
#      51 [ +  + ][ +  - ]:     511913 :         if (fSpendable && tx) {
#      52                 :     510676 :             nInputBytes = tx->GetSpendSize(i, use_max_sig);
#      53                 :     510676 :         }
#      54                 :     511913 :     }
#      55                 :            : 
#      56                 :            :     std::string ToString() const;
#      57                 :            : 
#      58                 :            :     inline CInputCoin GetInputCoin() const
#      59                 :    1965507 :     {
#      60                 :    1965507 :         return CInputCoin(tx->tx, i, nInputBytes);
#      61                 :    1965507 :     }
#      62                 :            : };
#      63                 :            : 
#      64                 :            : #endif // BITCOIN_WALLET_SPEND_H

Generated by: LCOV version 1.14