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

Method is_valid

src/Core/TransactionExtra.cpp:87–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87bool cn::extra::is_valid(const BinaryArray &extra) {
88 try {
89 common::MemoryInputStream iss(extra.data(), extra.size());
90
91 while (!iss.empty()) {
92 int c = iss.read_byte();
93 if (c == extra::Padding::tag)
94 return true; // last field
95 if (c == extra::TransactionPublicKey::tag) {
96 extra::TransactionPublicKey value;
97 iss.read(value.public_key.data, sizeof(value.public_key.data));
98 continue;
99 }
100 // other tags have uniform format
101 BinaryArray field_data;
102 auto size = iss.read_varint<size_t>();
103 iss.read(field_data, size);
104 }
105 return true;
106 } catch (std::exception &) {
107 }
108 return false;
109}
110
111void cn::extra::add_transaction_public_key(BinaryArray &tx_extra, const PublicKey &tx_pub_key) {
112 tx_extra.push_back(TransactionPublicKey::tag);

Callers

nothing calls this directly

Calls 5

read_byteMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected