Status randomData(DataChunk &result, size_t size) { DataChunk out; out.resize(size); if (!RAND_bytes(out.data(), out.size())) return ABC_ERROR(ABC_CC_Error, "Random data generation failed"); result = std::move(out); return Status(); }
Status watcherBridgeRawTx(Wallet &self, const char *szTxID, DataChunk &result) { Watcher *watcher = nullptr; ABC_CHECK(watcherFind(watcher, self)); bc::hash_digest txid; if (!bc::decode_hash(txid, szTxID)) return ABC_ERROR(ABC_CC_ParseError, "Bad txid"); auto tx = watcher->find_tx(txid); result.resize(satoshi_raw_size(tx)); bc::satoshi_save(tx, result.begin()); return Status(); }