MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / AccountMove

Method AccountMove

src/wallet/wallet.cpp:819–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

817}
818
819bool CWallet::AccountMove(std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment)
820{
821 WalletBatch batch(*database);
822 if (!batch.TxnBegin())
823 return false;
824
825 int64_t nNow = GetAdjustedTime();
826
827 // Debit
828 CAccountingEntry debit;
829 debit.nOrderPos = IncOrderPosNext(&batch);
830 debit.strAccount = strFrom;
831 debit.nCreditDebit = -nAmount;
832 debit.nTime = nNow;
833 debit.strOtherAccount = strTo;
834 debit.strComment = strComment;
835 AddAccountingEntry(debit, &batch);
836
837 // Credit
838 CAccountingEntry credit;
839 credit.nOrderPos = IncOrderPosNext(&batch);
840 credit.strAccount = strTo;
841 credit.nCreditDebit = nAmount;
842 credit.nTime = nNow;
843 credit.strOtherAccount = strFrom;
844 credit.strComment = strComment;
845 AddAccountingEntry(credit, &batch);
846
847 if (!batch.TxnCommit())
848 return false;
849
850 return true;
851}
852
853bool CWallet::GetLabelDestination(CTxDestination &dest, const std::string& label, bool bForceNew)
854{

Callers 1

movecmdFunction · 0.80

Calls 3

GetAdjustedTimeFunction · 0.85
TxnBeginMethod · 0.45
TxnCommitMethod · 0.45

Tested by

no test coverage detected