| 36 | } |
| 37 | |
| 38 | void CWalletTx::updateState(interfaces::Chain& chain) |
| 39 | { |
| 40 | bool active; |
| 41 | auto lookup_block = [&](const uint256& hash, int& height, TxState& state) { |
| 42 | // If tx block (or conflicting block) was reorged out of chain |
| 43 | // while the wallet was shutdown, change tx status to UNCONFIRMED |
| 44 | // and reset block height, hash, and index. ABANDONED tx don't have |
| 45 | // associated blocks and don't need to be updated. The case where a |
| 46 | // transaction was reorged out while online and then reconfirmed |
| 47 | // while offline is covered by the rescan logic. |
| 48 | if (!chain.findBlock(hash, FoundBlock().inActiveChain(active).height(height)) || !active) { |
| 49 | state = TxStateInactive{}; |
| 50 | } |
| 51 | }; |
| 52 | if (auto* conf = state<TxStateConfirmed>()) { |
| 53 | lookup_block(conf->confirmed_block_hash, conf->confirmed_block_height, m_state); |
| 54 | } else if (auto* conf = state<TxStateBlockConflicted>()) { |
| 55 | lookup_block(conf->conflicting_block_hash, conf->conflicting_block_height, m_state); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | void CWalletTx::CopyFrom(const CWalletTx& _tx) |
| 60 | { |
no test coverage detected