| 509 | } |
| 510 | |
| 511 | class ListCoinsTestingSetup : public TestChain100Setup |
| 512 | { |
| 513 | public: |
| 514 | ListCoinsTestingSetup() |
| 515 | { |
| 516 | CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); |
| 517 | wallet = CreateSyncedWallet(*m_node.chain, m_node.chainman->ActiveChain(), m_args, coinbaseKey); |
| 518 | } |
| 519 | |
| 520 | ~ListCoinsTestingSetup() |
| 521 | { |
| 522 | wallet.reset(); |
| 523 | } |
| 524 | |
| 525 | CWalletTx& AddTx(CRecipient recipient) |
| 526 | { |
| 527 | CTransactionRef tx; |
| 528 | CAmount fee; |
| 529 | int changePos = -1; |
| 530 | bilingual_str error; |
| 531 | CCoinControl dummy; |
| 532 | FeeCalculation fee_calc_out; |
| 533 | { |
| 534 | BOOST_CHECK(CreateTransaction(*wallet, {recipient}, tx, fee, changePos, error, dummy, fee_calc_out)); |
| 535 | } |
| 536 | wallet->CommitTransaction(tx, {}, {}); |
| 537 | CMutableTransaction blocktx; |
| 538 | { |
| 539 | LOCK(wallet->cs_wallet); |
| 540 | blocktx = CMutableTransaction(*wallet->mapWallet.at(tx->GetHash()).tx); |
| 541 | } |
| 542 | CreateAndProcessBlock({CMutableTransaction(blocktx)}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); |
| 543 | |
| 544 | LOCK(wallet->cs_wallet); |
| 545 | wallet->SetLastBlockProcessed(wallet->GetLastBlockHeight() + 1, m_node.chainman->ActiveChain().Tip()->GetBlockHash()); |
| 546 | auto it = wallet->mapWallet.find(tx->GetHash()); |
| 547 | BOOST_CHECK(it != wallet->mapWallet.end()); |
| 548 | it->second.m_state = TxStateConfirmed{m_node.chainman->ActiveChain().Tip()->GetBlockHash(), m_node.chainman->ActiveChain().Height(), /*position_in_block=*/1}; |
| 549 | return it->second; |
| 550 | } |
| 551 | |
| 552 | std::unique_ptr<CWallet> wallet; |
| 553 | }; |
| 554 | |
| 555 | BOOST_FIXTURE_TEST_CASE(ListCoinsTest, ListCoinsTestingSetup) |
| 556 | { |
nothing calls this directly
no test coverage detected