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

Method get_transaction_hash

src/CryptoNote.cpp:515–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

513}
514
515Hash cn::get_transaction_hash(const Transaction &tx) {
516 if (tx.version >= parameters::TRANSACTION_VERSION_AMETHYST) {
517 std::pair<Hash, Hash> ha;
518 ha.first = get_transaction_prefix_hash(tx);
519 BinaryArray binary_sigs = seria::to_binary(tx.signatures, static_cast<const TransactionPrefix &>(tx));
520 ha.second = crypto::cn_fast_hash(binary_sigs.data(), binary_sigs.size());
521 BinaryArray ba = seria::to_binary(ha);
522 // BinaryArray tx_body = seria::to_binary(static_cast<const TransactionPrefix&>(tx));
523 // common::append(tx_body, binary_sigs);
524 // invariant(tx_body == seria::to_binary(tx), "");
525 return crypto::cn_fast_hash(ba.data(), ba.size());
526 }
527 BinaryArray ba = seria::to_binary(tx);
528 return crypto::cn_fast_hash(ba.data(), ba.size());
529}
530
531Hash cn::get_block_hash(const BlockHeader &bh, const BlockBodyProxy &body_proxy) {
532 // get_object_hash prepends array size before hashing.

Callers

nothing calls this directly

Calls 4

to_binaryFunction · 0.85
cn_fast_hashFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected