MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / allTransactions

Method allTransactions

src/compactthin.cpp:68–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68std::vector<ThinTx> CompactStub::allTransactions() const {
69
70 std::vector<ThinTx> all(block.BlockTxCount(), ThinTx::Null());
71
72 int lastIndex = -1;
73 for (size_t i = 0; i < block.prefilledtxn.size(); ++i) {
74 lastIndex += block.prefilledtxn.at(i).index + 1;
75 all.at(lastIndex) = ThinTx(
76 block.prefilledtxn.at(i).tx.GetHash());
77
78 }
79
80 uint64_t offset = 0;
81 for (size_t i = 0; i < block.shorttxids.size(); ++i) {
82 while (all.at(i + offset).hasFull())
83 ++offset;
84
85 all.at(i + offset) = ThinTx(block.shorttxids.at(i),
86 block.shorttxidk0, block.shorttxidk1);
87 }
88
89 for (size_t i = 0; i < all.size(); ++i) {
90 if (!all[i].isNull())
91 continue;
92 std::stringstream err;
93 err << "Failed to read all tx ids from block. "
94 << "Tx at index " << i << " is null "
95 << " (total " << all.size() << "txs)";
96 throw thinblock_error(err.str());
97 }
98 return all;
99}
100
101void enableCompactBlocks(CNode& node, bool highBandwidth) {
102 uint64_t version = 1;

Callers 4

buildStubMethod · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 8

thinblock_errorClass · 0.85
BlockTxCountMethod · 0.80
hasFullMethod · 0.80
strMethod · 0.80
ThinTxClass · 0.70
sizeMethod · 0.45
GetHashMethod · 0.45
isNullMethod · 0.45

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36