aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/asset_db.h
blob: b5a763b756933c170bb0f140e71fd4f766ab0f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once

#include <string>
#include <vector>

#include "blockchain_db.h"
#include "cryptonote_basic/asset_confidential.h"
#include "cryptonote_basic/asset_types.h"

namespace cryptonote
{
namespace assets
{
  bool load_registry_from_db(
    const BlockchainDB& db,
    network_type expected_network,
    asset_registry& registry,
    std::string* error = nullptr);

  // The caller must hold the blockchain write transaction. Semantic
  // validation finishes before the first database write, and any exception
  // raised by storage must cause that outer transaction to be aborted.
  bool apply_block_extensions_to_db(
    BlockchainDB& db,
    const std::vector<transaction_extension>& extensions,
    const std::vector<crypto::hash>& carrier_prefix_hashes,
    network_type expected_network,
    uint64_t height,
    std::vector<crypto::hash>& asset_ids,
    std::string* error = nullptr);

  // Resolve every claimed ring member against consensus storage and reject
  // key images already spent by an earlier accepted asset transaction before
  // performing the cryptographic ownership check.
  bool verify_asset_ownership_against_db(
    const BlockchainDB& db,
    const asset_ownership_proof& proof,
    network_type expected_network,
    const crypto::hash& carrier_prefix_hash,
    std::string* error = nullptr);
}
}