| 964 | } |
| 965 | |
| 966 | void BlockChainState::undo_transaction(IBlockChainState *delta_state, Height, const Transaction &tx) { |
| 967 | for (size_t out_index = tx.outputs.size(); out_index-- > 0;) { |
| 968 | const auto &output = tx.outputs[out_index]; |
| 969 | if (const auto *out = boost::get<OutputKey>(&output)) { |
| 970 | BlockOrTimestamp ut = tx.unlock_block_or_timestamp; |
| 971 | delta_state->pop_amount_output(out->amount, ut, out->public_key); |
| 972 | } |
| 973 | } |
| 974 | for (size_t input_index = tx.inputs.size(); input_index-- > 0;) { |
| 975 | const auto &input = tx.inputs[input_index]; |
| 976 | if (const auto *in = boost::get<InputKey>(&input)) { |
| 977 | unprocess_input(*in); |
| 978 | delta_state->delete_keyimage(in->key_image); |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | |
| 983 | void BlockChainState::redo_block(const Block &block, |
| 984 | const api::BlockHeader &info, |
nothing calls this directly
no test coverage detected