mirror of
https://github.com/ZmnSCPxj/clboss.git
synced 2026-08-13 12:33:20 +02:00
22 lines
554 B
C++
22 lines
554 B
C++
#include"Bitcoin/TxOut.hpp"
|
|
#include"Bitcoin/le.hpp"
|
|
#include"Bitcoin/varint.hpp"
|
|
|
|
std::ostream& operator<<(std::ostream& os, Bitcoin::TxOut const& v) {
|
|
os << Bitcoin::le(v.amount)
|
|
<< Bitcoin::varint(v.scriptPubKey.size())
|
|
;
|
|
for (auto b : v.scriptPubKey)
|
|
os.put(b);
|
|
return os;
|
|
}
|
|
std::istream& operator>>(std::istream& is, Bitcoin::TxOut& v) {
|
|
auto len = std::uint64_t();
|
|
is >> Bitcoin::le(v.amount)
|
|
>> Bitcoin::varint(len)
|
|
;
|
|
v.scriptPubKey.resize(std::size_t(len));
|
|
for (auto& b : v.scriptPubKey)
|
|
b = is.get();
|
|
return is;
|
|
}
|