OpenCBDC Transaction Processor
|
A condensed, hash-only transaction representation. More...
#include <transaction.hpp>
Public Member Functions | |
auto | operator== (const compact_tx &tx) const noexcept -> bool |
Equality of two compact transactions. | |
compact_tx ()=default | |
compact_tx (const full_tx &tx) | |
auto | sign (secp256k1_context *ctx, const privkey_t &key) const -> sentinel_attestation |
Sign the compact transaction and return the signature. | |
auto | verify (secp256k1_context *ctx, const sentinel_attestation &att) const -> bool |
Verify the given attestation contains a valid signature that matches the compact transaction. | |
auto | hash () const -> hash_t |
Return the hash of the compact transaction, without the sentinel attestations included. | |
Data Fields | |
hash_t | m_id {} |
The hash of the full transaction returned by tx_id. | |
std::vector< hash_t > | m_inputs |
The set of hashes of the transaction's inputs. | |
std::vector< hash_t > | m_uhs_outputs |
The set of hashes of the new outputs created in the transaction. | |
std::unordered_map< pubkey_t, signature_t, hashing::null > | m_attestations |
Signatures from sentinels attesting the compact TX is valid. | |
A condensed, hash-only transaction representation.
The minimum amount of data necessary for the transaction processor to update the UHS with the changes from a full_tx.
Definition at line 119 of file transaction.hpp.
|
default |
|
explicit |
Definition at line 126 of file transaction.cpp.
References m_id, m_inputs, cbdc::transaction::full_tx::m_inputs, cbdc::transaction::full_tx::m_outputs, m_uhs_outputs, cbdc::transaction::tx_id(), and cbdc::transaction::uhs_id_from_output().
|
nodiscard |
Return the hash of the compact transaction, without the sentinel attestations included.
Used as the message which is signed in sentinel attestations.
Definition at line 158 of file transaction.cpp.
References cbdc::make_buffer().
|
noexcept |
Equality of two compact transactions.
Only compares the transaction IDs.
Definition at line 122 of file transaction.cpp.
|
nodiscard |
Sign the compact transaction and return the signature.
ctx | secp256k1 context with which to sign the transaction. |
key | private key with which to sign the transaction. |
Definition at line 137 of file transaction.cpp.
References cbdc::pubkey_from_privkey().
|
nodiscard |
Verify the given attestation contains a valid signature that matches the compact transaction.
ctx | secp256k1 contact with which to validate the signature. |
att | sentinel attestation containing a public key and signature. |
Definition at line 170 of file transaction.cpp.
std::unordered_map<pubkey_t, signature_t, hashing::null> cbdc::transaction::compact_tx::m_attestations |
Signatures from sentinels attesting the compact TX is valid.
Definition at line 131 of file transaction.hpp.
hash_t cbdc::transaction::compact_tx::m_id {} |
The hash of the full transaction returned by tx_id.
Definition at line 121 of file transaction.hpp.
Referenced by cbdc::locking_shard::locking_shard::apply_outputs(), and compact_tx().
std::vector<hash_t> cbdc::transaction::compact_tx::m_inputs |
The set of hashes of the transaction's inputs.
Definition at line 124 of file transaction.hpp.
Referenced by cbdc::locking_shard::locking_shard::apply_outputs(), and compact_tx().
std::vector<hash_t> cbdc::transaction::compact_tx::m_uhs_outputs |
The set of hashes of the new outputs created in the transaction.
Definition at line 127 of file transaction.hpp.
Referenced by cbdc::locking_shard::locking_shard::apply_outputs(), and compact_tx().