| 66 | } |
| 67 | |
| 68 | std::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 | |
| 101 | void enableCompactBlocks(CNode& node, bool highBandwidth) { |
| 102 | uint64_t version = 1; |