MCPcopy Create free account
hub / github.com/bcndev/bytecoin / undo_transaction

Method undo_transaction

src/Core/BlockChainState.cpp:966–981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

964}
965
966void 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
983void BlockChainState::redo_block(const Block &block,
984 const api::BlockHeader &info,

Callers

nothing calls this directly

Calls 3

pop_amount_outputMethod · 0.80
delete_keyimageMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected