bool leveldb_chain_keeper::remove_address(leveldb::WriteBatch& batch, const script& output_script, const output_point& outpoint) { payment_address address; if (!extract(address, output_script)) return false; data_chunk raw_address = create_address_key(address); BITCOIN_ASSERT(!raw_address.empty()); data_chunk outpoint_value = create_spent_key(outpoint); bool is_found = false; leveldb_iterator it(address_iterator(db_.addr, raw_address)); for (; valid_address_iterator(it, raw_address); it->Next()) { if (slice_to_output_point(it->value()) != outpoint) continue; // We found the address entry we were looking for. BITCOIN_ASSERT(!is_found); is_found = true; // Put changes into batch finally. batch.Delete(it->key()); break; } BITCOIN_ASSERT(it->status().ok()); if (!is_found) return false; return true; }
bool remove_credit(leveldb::WriteBatch& batch, const transaction_output_type& output, const output_point& outpoint) { payment_address address; // Not a Bitcoin address so skip this output. if (!extract(address, output.script)) return true; data_chunk addr_key = create_address_key(address, outpoint); batch.Delete(slice(addr_key)); return true; }
void c_seq::seq_del(uint32 keyId, leveldb::WriteBatch& bh) { bh.Delete(__tos(m_key << "@" << keyId)); m_seq_head.s_count(m_seq_head.g_count() - 1); //LOG4_ERROR("SEQ DEL KEY:" << __tos(m_key << "@" << keyId)); }