PIVX Core  5.6.99
P2P Digital Currency
Classes | Functions | Variables
wallet_shielded_balances_tests.cpp File Reference
#include "wallet/test/wallet_test_fixture.h"
#include "consensus/merkle.h"
#include "primitives/block.h"
#include "random.h"
#include "sapling/note.h"
#include "sapling/noteencryption.h"
#include "sapling/transaction_builder.h"
#include "test/librust/utiltest.h"
#include "wallet/wallet.h"
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
Include dependency graph for wallet_shielded_balances_tests.cpp:

Go to the source code of this file.

Classes

struct  SaplingSpendValues
 
struct  FakeBlock
 

Functions

void setupWallet (CWallet &wallet)
 
CWalletTxSetWalletNotesData (CWallet *wallet, CWalletTx &wtx)
 
CWalletTxAddShieldedBalanceToWallet (CAmount inputAmount, const std::vector< ShieldedDestination > &vDest, CWallet *wallet, const Consensus::Params &consensusParams)
 Creates and send a tx with an input of 'inputAmount' to 'vDest'. More...
 
CWalletTxAddShieldedBalanceToWallet (const libzcash::SaplingPaymentAddress &sendTo, CAmount amount, CWallet &wallet, const Consensus::Params &consensusParams, libzcash::SaplingExtendedSpendingKey &extskOut)
 
SaplingSpendValues UpdateWalletInternalNotesData (CWalletTx &wtx, const SaplingOutPoint &sapPoint, CWallet &wallet)
 Update the wallet internally as if the wallet would had received a valid block containing wtx. More...
 
 BOOST_AUTO_TEST_CASE (GetShieldedSimpleCachedCreditAndDebit)
 Validates: 1) CWalletTx getCredit for shielded credit. More...
 
libzcash::SaplingPaymentAddress getNewDummyShieldedAddress ()
 
CWalletTxbuildTxAndLoadToWallet (CWallet &wallet, const libzcash::SaplingExtendedSpendingKey &extskOut, const SaplingSpendValues &sapSpendValues, libzcash::SaplingPaymentAddress dest, const CAmount &destAmount, const Consensus::Params &consensus)
 
 BOOST_AUTO_TEST_CASE (VerifyShieldedToRemoteShieldedCachedBalance)
 Validates shielded to remote shielded + change cached balances. More...
 
FakeBlock SimpleFakeMine (CWalletTx &wtx, SaplingMerkleTree &currentTree, CWallet &wallet)
 
 BOOST_AUTO_TEST_CASE (GetShieldedAvailableCredit)
 Test: 1) receive two shielded notes on the same tx. More...
 

Variables

CAmount fee = COIN
 

Function Documentation

◆ AddShieldedBalanceToWallet() [1/2]

CWalletTx& AddShieldedBalanceToWallet ( CAmount  inputAmount,
const std::vector< ShieldedDestination > &  vDest,
CWallet wallet,
const Consensus::Params consensusParams 
)

Creates and send a tx with an input of 'inputAmount' to 'vDest'.

Definition at line 44 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddShieldedBalanceToWallet() [2/2]

CWalletTx& AddShieldedBalanceToWallet ( const libzcash::SaplingPaymentAddress sendTo,
CAmount  amount,
CWallet wallet,
const Consensus::Params consensusParams,
libzcash::SaplingExtendedSpendingKey extskOut 
)

Definition at line 67 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/3]

BOOST_AUTO_TEST_CASE ( GetShieldedAvailableCredit  )

Test: 1) receive two shielded notes on the same tx.

2) check available credit. 3) spend one of them. 4) force available credit cache recalculation and validate the updated amount.

Definition at line 314 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( GetShieldedSimpleCachedCreditAndDebit  )

Validates: 1) CWalletTx getCredit for shielded credit.

Incoming spendable shielded balance must be cached in the cacheableAmounts.

2) CWalletTx getDebit & getCredit for shielded debit to transparent address. Same wallet as point (1), spending half of the credit received in (1) to a transparent remote address. The other half of the balance - minus fee - must appear as credit (shielded change).

Definition at line 129 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( VerifyShieldedToRemoteShieldedCachedBalance  )

Validates shielded to remote shielded + change cached balances.

Definition at line 234 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ buildTxAndLoadToWallet()

CWalletTx& buildTxAndLoadToWallet ( CWallet wallet,
const libzcash::SaplingExtendedSpendingKey extskOut,
const SaplingSpendValues sapSpendValues,
libzcash::SaplingPaymentAddress  dest,
const CAmount destAmount,
const Consensus::Params consensus 
)

Definition at line 202 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ getNewDummyShieldedAddress()

libzcash::SaplingPaymentAddress getNewDummyShieldedAddress ( )

Definition at line 195 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ setupWallet()

void setupWallet ( CWallet wallet)

Definition at line 23 of file wallet_shielded_balances_tests.cpp.

Here is the caller graph for this function:

◆ SetWalletNotesData()

CWalletTx& SetWalletNotesData ( CWallet wallet,
CWalletTx wtx 
)

Definition at line 30 of file wallet_shielded_balances_tests.cpp.

Here is the caller graph for this function:

◆ SimpleFakeMine()

FakeBlock SimpleFakeMine ( CWalletTx wtx,
SaplingMerkleTree currentTree,
CWallet wallet 
)

Definition at line 287 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

◆ UpdateWalletInternalNotesData()

SaplingSpendValues UpdateWalletInternalNotesData ( CWalletTx wtx,
const SaplingOutPoint sapPoint,
CWallet wallet 
)

Update the wallet internally as if the wallet would had received a valid block containing wtx.

Then return the note, anchor and witness for any subsequent spending process.

Definition at line 88 of file wallet_shielded_balances_tests.cpp.

Here is the call graph for this function:

Variable Documentation

◆ fee

CAmount fee = COIN

Definition at line 19 of file wallet_shielded_balances_tests.cpp.