Example #1
0
	vector<bool> GetCoinsByTxHash(const HashValue& hash) override {
		DbDataReader dr = m_cmdTxFindCoins.Bind(1, ReducedHashValue(hash)).ExecuteVector();
		vector<bool> vec;
		if (!dr.IsDBNull(0)) {
			CMemReadStream stm(dr.GetBytes(0));
			for (int v; (v=stm.ReadByte())!=-1;) {
				for (int i=0; i<8; ++i)
					vec.push_back(v & (1 << i));
			}
		}
		return vec;
	}
Example #2
0
	pair<int, int> FindPrevTxCoords(DbWriter& wr, int height, const HashValue& hash) override {
//!!!		ASSERT(!MtxSqlite.try_lock());

		DbDataReader dr = m_cmdTxHashToBlockordIdx
								.Bind(1, ReducedHashValue(hash))
								.ExecuteVector();
		int heightOut = dr.GetInt32(0);
		wr.Write7BitEncoded(height-heightOut+1);
		pair<int, int> pp = TxHashesOutNums(dr.GetBytes(1)).StartingTxOutIdx(hash);
		if (pp.second < 0)
			Throw(E_COIN_InconsistentDatabase);
		return pp;
	}
Example #3
0
	Blob FindPubkey(Int64 id) override {
		EXT_LOCK (MtxSqlite) {
			DbDataReader dr = CmdPubkeyIdToData.Bind(1, id).ExecuteReader();
			return dr.Read() ? Blob(dr.GetBytes(0)) : Blob(nullptr);
		}
	}