public async Task SetPreimage(Primitives.PaymentPreimage paymentPreimage) { using var tx = await _engine.OpenTransaction(); await tx.GetTable(DBKeys.HashToPreimage).Insert(paymentPreimage.Hash.ToBytes(false), paymentPreimage.ToByteArray()); await tx.Commit(); }
public void Setup() { folder = @"BenchData"; Directory.CreateDirectory($@"BenchData"); Directory.CreateDirectory($@"{folder}\trie"); trie = DBTrieEngine.OpenFromFolder($@"{folder}\trie").Result; ldb = new DB(new Options { CreateIfMissing = true }, $@"{folder}\ldb"); Directory.CreateDirectory($@"{folder}\litedb"); litedb = new LiteDatabase(new ConnectionString() { Filename = $@"{folder}\litedb\db" }); this.litedbCol = litedb.GetCollection <LiteDbEntity>("tbl"); trx = trie.OpenTransaction().Result; tbl = trx.GetTable("tbl"); rocksdb = rdb.RocksDb.Open(new rdb.DbOptions().SetCreateIfMissing(true), $@"{folder}\rocksdb"); }
public async Task SetPreimage(Primitives.PaymentPreimage paymentPreimage, CancellationToken ct = default) { if (paymentPreimage == null) { throw new ArgumentNullException(nameof(paymentPreimage)); } using var tx = await _engine.OpenTransaction(ct); await tx.GetTable(DBKeys.HashToPreimage).Insert(paymentPreimage.Hash.ToBytes(false), paymentPreimage.ToByteArray()); await tx.Commit(); }