21 lines
600 B
C++
21 lines
600 B
C++
#include "TxOutput.h"
|
|
#include "VarInt.h"
|
|
|
|
#include <iostream>
|
|
|
|
TxOutput::TxOutput(const std::byte *data) {
|
|
_value = *reinterpret_cast<const uint64_t*>(data);
|
|
data += sizeof(_value);
|
|
VarInt scriptPubKeySize(data);
|
|
data += scriptPubKeySize.size();
|
|
|
|
//std::cout << "=== Creating PubKey script of size: " << scriptPubKeySize.value() << std::endl;
|
|
_pubKeyScript = std::make_unique<Script>(std::span((uint8_t*)data, scriptPubKeySize.value()));
|
|
|
|
_size = sizeof(_value) + scriptPubKeySize.size() + scriptPubKeySize.value();
|
|
}
|
|
|
|
size_t TxOutput::size() const {
|
|
return _size;
|
|
}
|